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)
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,
128 else cmap = gif->SColorMap; 128 else cmap = gif->SColorMap;
129 bg = gif->SBackGroundColor; 129 bg = gif->SBackGroundColor;
130 130
131 // fill in local color table of guaranteed 256 entires with cmap & pad 131 if (cmap)
132 for (cnum = 0; cnum < cmap->ColorCount; cnum++) 132 {
133 colors[cnum] = cmap->Colors[cnum]; 133 // fill in local color table of guaranteed 256 with cmap & pad
134 for (cnum = cmap->ColorCount; cnum < 256; cnum++) 134 for (cnum = 0; cnum < cmap->ColorCount; cnum++)
135 colors[cnum] = cmap->Colors[0]; 135 colors[cnum] = cmap->Colors[cnum];
136 for (cnum = cmap->ColorCount; cnum < 256; cnum++)
137 colors[cnum] = cmap->Colors[0];
138 }
139 else
140 memset(colors, 0, sizeof(colors));
136 // and do the fill 141 // and do the fill
137 _fill_image 142 _fill_image
138 (data, rowpix, 143 (data, rowpix,
@@ -258,11 +263,16 @@ _decode_image(GifFileType *gif, DATA32 *data, int rowpix, int xin, int yin,
258 if (gif->Image.ColorMap) cmap = gif->Image.ColorMap; 263 if (gif->Image.ColorMap) cmap = gif->Image.ColorMap;
259 else cmap = gif->SColorMap; 264 else cmap = gif->SColorMap;
260 265
261 // fill in local color table of guaranteed 256 entires with cmap & pad 266 if (cmap)
262 for (cnum = 0; cnum < cmap->ColorCount; cnum++) 267 {
263 colors[cnum] = cmap->Colors[cnum]; 268 // fill in local color table of guaranteed 256 entires with cmap & pad
264 for (cnum = cmap->ColorCount; cnum < 256; cnum++) 269 for (cnum = 0; cnum < cmap->ColorCount; cnum++)
265 colors[cnum] = cmap->Colors[0]; 270 colors[cnum] = cmap->Colors[cnum];
271 for (cnum = cmap->ColorCount; cnum < 256; cnum++)
272 colors[cnum] = cmap->Colors[0];
273 }
274 else
275 memset(colors, 0, sizeof(colors));
266 // if we need to deal with transparent pixels at all... 276 // if we need to deal with transparent pixels at all...
267 if (transparent >= 0) 277 if (transparent >= 0)
268 { 278 {