From 06482119e24c8ee2befec32ba7abbbf05150b767 Mon Sep 17 00:00:00 2001 From: Gerd Moellmann Date: Thu, 14 Oct 1999 23:19:50 +0000 Subject: [PATCH] (gif_load): Fix handling of interlaced GIFs. --- src/ChangeLog | 4 ++++ src/xfns.c | 31 +++++++++++++++++++++---------- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 4c9c5092bd5..af5025f7a82 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +1999-10-15 Gerd Moellmann + + * xfns.c (gif_load): Fix handling of interlaced GIFs. + 1999-10-14 Dave Love * xdisp.c (handle_fontified_prop): GCPRO `pos'. diff --git a/src/xfns.c b/src/xfns.c index 4afa9d2dee8..eee9b919eef 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -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 -- 2.39.5