diff options
author | Carsten Haitzler (Rasterman) <raster@rasterman.com> | 2016-04-04 09:51:12 +0900 |
---|---|---|
committer | Carsten Haitzler (Rasterman) <raster@rasterman.com> | 2016-04-04 09:51:12 +0900 |
commit | db4ff548d356243638f5fa0898b2ee4ff1be55f5 (patch) | |
tree | ed8093e7686223f295ea8f34738de33288527d9b | |
parent | 8fb153cf8cab550121136aeb2710fc2d9f42fadc (diff) | |
download | efl-db4ff548d356243638f5fa0898b2ee4ff1be55f5.tar.gz |
evas - gif loader - handle missing colormap
follow on from dd90b6afadf706aafec9e53a6b1efa8f899ab277 - this handled
if a gif file has no colormap (it'll decode as blank now as a colormap
of all 0's is used instead).
@fix
-rw-r--r-- | src/modules/evas/image_loaders/gif/evas_image_load_gif.c | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/src/modules/evas/image_loaders/gif/evas_image_load_gif.c b/src/modules/evas/image_loaders/gif/evas_image_load_gif.c index 09d3b27ffe..ac403522f8 100644 --- a/src/modules/evas/image_loaders/gif/evas_image_load_gif.c +++ b/src/modules/evas/image_loaders/gif/evas_image_load_gif.c @@ -128,11 +128,16 @@ _fill_frame(DATA32 *data, int rowpix, GifFileType *gif, Frame_Info *finfo, else cmap = gif->SColorMap; bg = gif->SBackGroundColor; - // fill in local color table of guaranteed 256 entires with cmap & pad - for (cnum = 0; cnum < cmap->ColorCount; cnum++) - colors[cnum] = cmap->Colors[cnum]; - for (cnum = cmap->ColorCount; cnum < 256; cnum++) - colors[cnum] = cmap->Colors[0]; + if (cmap) + { + // fill in local color table of guaranteed 256 with cmap & pad + for (cnum = 0; cnum < cmap->ColorCount; cnum++) + colors[cnum] = cmap->Colors[cnum]; + for (cnum = cmap->ColorCount; cnum < 256; cnum++) + colors[cnum] = cmap->Colors[0]; + } + else + memset(colors, 0, sizeof(colors)); // and do the fill _fill_image (data, rowpix, @@ -258,11 +263,16 @@ _decode_image(GifFileType *gif, DATA32 *data, int rowpix, int xin, int yin, if (gif->Image.ColorMap) cmap = gif->Image.ColorMap; else cmap = gif->SColorMap; - // fill in local color table of guaranteed 256 entires with cmap & pad - for (cnum = 0; cnum < cmap->ColorCount; cnum++) - colors[cnum] = cmap->Colors[cnum]; - for (cnum = cmap->ColorCount; cnum < 256; cnum++) - colors[cnum] = cmap->Colors[0]; + if (cmap) + { + // fill in local color table of guaranteed 256 entires with cmap & pad + for (cnum = 0; cnum < cmap->ColorCount; cnum++) + colors[cnum] = cmap->Colors[cnum]; + for (cnum = cmap->ColorCount; cnum < 256; cnum++) + colors[cnum] = cmap->Colors[0]; + } + else + memset(colors, 0, sizeof(colors)); // if we need to deal with transparent pixels at all... if (transparent >= 0) { |