evas - tga loader - fix alpha handling for 16/15bpp images

tga provides 16bpp images as actually 15bpp. the upper bit (alpha mask
bit) can be 0 or 1, but we don't check the  descriptor byte to see if
this bit is relevant or not. coverity pointed this out in CID 1039473
- logically dead code that should not have been dead except for this
missing logic. well done coverity!
This commit is contained in:
Carsten Haitzler 2014-08-27 11:58:35 +09:00
parent 7847c2dafe
commit 5b5ee4857a
1 changed files with 2 additions and 0 deletions

View File

@ -128,6 +128,7 @@ evas_image_load_file_head_tga(void *loader_data,
if (!((bpp == 32) || (bpp == 24) || (bpp == 16) || (bpp == 8)))
goto close_file;
if ((bpp == 32) && (header->descriptor & TGA_DESC_ABITS)) hasa = 1;
if ((bpp == 16) && (header->descriptor & TGA_DESC_ABITS)) hasa = 1;
// don't handle colormapped images
if ((header->colorMapType) != 0)
goto close_file;
@ -228,6 +229,7 @@ evas_image_load_file_data_tga(void *loader_data,
if (!((bpp == 32) || (bpp == 24) || (bpp == 16) || (bpp == 8)))
goto close_file;
if ((bpp == 32) && (header->descriptor & TGA_DESC_ABITS)) hasa = 1;
if ((bpp == 16) && (header->descriptor & TGA_DESC_ABITS)) hasa = 1;
abits = header->descriptor & TGA_DESC_ABITS;
// don't handle colormapped images
if ((header->colorMapType) != 0)