comparison src/glyphs-eimage.c @ 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 97eb4942aec8
children 6c3a695f54f5 308d34e9f07d
comparison
equal deleted inserted replaced
5249:d4fae3ebf26a 5250:db84c9d41437
692 signal_image_error (gif_decode_error_string (), instantiator); 692 signal_image_error (gif_decode_error_string (), instantiator);
693 } 693 }
694 694
695 /* 3. Now create the EImage(s) */ 695 /* 3. Now create the EImage(s) */
696 { 696 {
697 ColorMapObject *cmo = unwind.giffile->SColorMap; 697 ColorMapObject *cmo = (unwind.giffile->Image.ColorMap ? unwind.giffile->Image.ColorMap : unwind.giffile->SColorMap);
698 int i, j, row, pass, interlace, slice; 698 int i, j, row, pass, interlace, slice;
699 UINT_64_BIT pixels_sq; 699 UINT_64_BIT pixels_sq;
700 Binbyte *eip; 700 Binbyte *eip;
701 /* interlaced gifs have rows in this order: 701 /* interlaced gifs have rows in this order:
702 0, 8, 16, ..., 4, 12, 20, ..., 2, 6, 10, ..., 1, 3, 5, ... */ 702 0, 8, 16, ..., 4, 12, 20, ..., 2, 6, 10, ..., 1, 3, 5, ... */
703 static int InterlacedOffset[] = { 0, 4, 2, 1 }; 703 static int InterlacedOffset[] = { 0, 4, 2, 1 };
704 static int InterlacedJumps[] = { 8, 8, 4, 2 }; 704 static int InterlacedJumps[] = { 8, 8, 4, 2 };
705
706 if (cmo == NULL)
707 signal_image_error ("GIF image has no color map", instantiator);
705 708
706 height = unwind.giffile->SHeight; 709 height = unwind.giffile->SHeight;
707 width = unwind.giffile->SWidth; 710 width = unwind.giffile->SWidth;
708 pixels_sq = (UINT_64_BIT) width * (UINT_64_BIT) height; 711 pixels_sq = (UINT_64_BIT) width * (UINT_64_BIT) height;
709 if (pixels_sq > ((size_t) -1) / (3 * unwind.giffile->ImageCount)) 712 if (pixels_sq > ((size_t) -1) / (3 * unwind.giffile->ImageCount))