]> git.eshelyaron.com Git - emacs.git/commitdiff
(gif_load): Fix handling of interlaced GIFs.
authorGerd Moellmann <gerd@gnu.org>
Thu, 14 Oct 1999 23:19:50 +0000 (23:19 +0000)
committerGerd Moellmann <gerd@gnu.org>
Thu, 14 Oct 1999 23:19:50 +0000 (23:19 +0000)
src/ChangeLog
src/xfns.c

index 4c9c5092bd58c62b6500ccfc0428076a63dc002f..af5025f7a820340de66ca4cae11c62992f7b064c 100644 (file)
@@ -1,3 +1,7 @@
+1999-10-15  Gerd Moellmann  <gerd@gnu.org>
+
+       * xfns.c (gif_load): Fix handling of interlaced GIFs.
+
 1999-10-14  Dave Love  <fx@gnu.org>
 
        * xdisp.c (handle_fontified_prop): GCPRO `pos'.
index 4afa9d2dee88580bb441d47ab20fe83961b091fe..eee9b919eef25fef45b9101344f0e9e329cfe7a2 100644 (file)
@@ -7966,7 +7966,7 @@ static struct image_keyword png_format[PNG_LAST] =
   {":heuristic-mask",  IMAGE_DONT_CHECK_VALUE_TYPE,            0}
 };
 
-/* Structure describing the image type `gif'.  */
+/* Structure describing the image type `png'.  */
 
 static struct image_type png_type =
 {
@@ -8958,17 +8958,28 @@ gif_load (f, img)
       static int interlace_start[] = {0, 4, 2, 1};
       static int interlace_increment[] = {8, 8, 4, 2};
       int pass, inc;
+      int row = interlace_start[0];
+
+      pass = 0;
 
-      for (pass = 0; pass < 4; ++pass)
+      for (y = 0; y < image_height; y++)
        {
-         inc = interlace_increment[pass];
-         for (y = interlace_start[pass]; y < image_height; y += inc)
-           for (x = 0; x < image_width; ++x)
-             {
-               unsigned i = gif->SavedImages[ino].RasterBits[y * image_width + x];
-               XPutPixel (ximg, x + image_left, y + image_top, 
-                          pixel_colors[i]);
-             }
+         if (row >= image_height)
+           {
+             row = interlace_start[++pass];
+             while (row >= image_height)
+               row = interlace_start[++pass];
+           }
+         
+         for (x = 0; x < image_width; x++)
+           {
+             unsigned int i
+               = gif->SavedImages[ino].RasterBits[(y * image_width) + x];
+             XPutPixel (ximg, x + image_left, row + image_top,
+                        pixel_colors[i]);
+           }
+         
+         row += interlace_increment[pass];
        }
     }
   else