forked from enlightenment/efl
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:
parent
7847c2dafe
commit
5b5ee4857a
|
@ -128,6 +128,7 @@ evas_image_load_file_head_tga(void *loader_data,
|
||||||
if (!((bpp == 32) || (bpp == 24) || (bpp == 16) || (bpp == 8)))
|
if (!((bpp == 32) || (bpp == 24) || (bpp == 16) || (bpp == 8)))
|
||||||
goto close_file;
|
goto close_file;
|
||||||
if ((bpp == 32) && (header->descriptor & TGA_DESC_ABITS)) hasa = 1;
|
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
|
// don't handle colormapped images
|
||||||
if ((header->colorMapType) != 0)
|
if ((header->colorMapType) != 0)
|
||||||
goto close_file;
|
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)))
|
if (!((bpp == 32) || (bpp == 24) || (bpp == 16) || (bpp == 8)))
|
||||||
goto close_file;
|
goto close_file;
|
||||||
if ((bpp == 32) && (header->descriptor & TGA_DESC_ABITS)) hasa = 1;
|
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;
|
abits = header->descriptor & TGA_DESC_ABITS;
|
||||||
// don't handle colormapped images
|
// don't handle colormapped images
|
||||||
if ((header->colorMapType) != 0)
|
if ((header->colorMapType) != 0)
|
||||||
|
|
Loading…
Reference in New Issue