changeset 5250:db84c9d41437

Apply GIF colormap fix from Adam Sjogren for issues 150 and 713
author Vin Shelton <acs@xemacs.org>
date Thu, 26 Aug 2010 22:45:58 -0400
parents d4fae3ebf26a
children b0ba3598beb1
files src/ChangeLog src/glyphs-eimage.c
diffstat 2 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Fri Aug 20 13:04:54 2010 +0200
+++ b/src/ChangeLog	Thu Aug 26 22:45:58 2010 -0400
@@ -1,3 +1,9 @@
+2010-08-26  Adam Sjøgren <asjo@koldfront.dk>
+
+	* glyphs-eimage.c (gif_instantiate): Try harder to find an
+	appropriate GIF colormap and then flag an error if one can't be
+	found.
+
 2010-08-21  Aidan Kehoe  <kehoea@parhasard.net>
 
 	* lread.c (read_escape):
--- a/src/glyphs-eimage.c	Fri Aug 20 13:04:54 2010 +0200
+++ b/src/glyphs-eimage.c	Thu Aug 26 22:45:58 2010 -0400
@@ -694,7 +694,7 @@
 
   /* 3. Now create the EImage(s) */
   {
-    ColorMapObject *cmo = unwind.giffile->SColorMap;
+    ColorMapObject *cmo = (unwind.giffile->Image.ColorMap ? unwind.giffile->Image.ColorMap : unwind.giffile->SColorMap);
     int i, j, row, pass, interlace, slice;
     UINT_64_BIT pixels_sq;
     Binbyte *eip;
@@ -703,6 +703,9 @@
     static int InterlacedOffset[] = { 0, 4, 2, 1 };
     static int InterlacedJumps[] = { 8, 8, 4, 2 };
 
+    if (cmo == NULL)
+      signal_image_error ("GIF image has no color map", instantiator);
+
     height = unwind.giffile->SHeight;
     width = unwind.giffile->SWidth;
     pixels_sq = (UINT_64_BIT) width * (UINT_64_BIT) height;