summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2016-04-04 09:51:12 +0900
committerSimon Lees <sflees@suse.de>2016-06-17 14:51:36 +0930
commit326af987003ba8997102007de1c7ae537fa47c99 (patch)
tree45f0f37b01fbae8b0fcec7e7a3a4661ac2cf2279
parent783adb59cc19f8556b3d3f1d91d95935e62b51da (diff)
downloadefl-326af987003ba8997102007de1c7ae537fa47c99.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.c30
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)
{