Skip to content

Instantly share code, notes, and snippets.

@yoya
Created May 29, 2013 16:07
Show Gist options
  • Save yoya/5671482 to your computer and use it in GitHub Desktop.
Save yoya/5671482 to your computer and use it in GitHub Desktop.
diff -C 1 ImageMagick-6.1.2-7/coders/gif.c ImageMagick-6.1.3-7/coders/gif.c
*** ImageMagick-6.1.2-7/coders/gif.c 2004-10-22 04:34:42.000000000 +0900
--- ImageMagick-6.1.3-7/coders/gif.c 2013-05-29 21:57:41.911236886 +0900
***************
*** 1285,1293 ****
GetQuantizeInfo(&quantize_info);
quantize_info.dither=IsPaletteImage(image,&image->exception) ==
MagickFalse ? MagickTrue : MagickFalse;
! if ((LocaleCompare(write_info->magick,"GIF87") == 0) ||
! (image->matte == MagickFalse))
! (void) QuantizeImage(&quantize_info,image);
! else
{
/*
--- 1285,1296 ----
GetQuantizeInfo(&quantize_info);
+ quantize_info.number_colors=256;
quantize_info.dither=IsPaletteImage(image,&image->exception) ==
MagickFalse ? MagickTrue : MagickFalse;
! (void) QuantizeImage(&quantize_info,image);
! if ((LocaleCompare(write_info->magick,"GIF87") != 0) &&
! (image->matte != MagickFalse))
{
+ MagickSizeType
+ length;
+
/*
***************
*** 1298,1301 ****
opacity=(long) image->colors++;
! image->colormap=(PixelPacket *) ResizeMagickMemory(image->colormap,
! (size_t) image->colors*sizeof(*image->colormap));
if (image->colormap == (PixelPacket *) NULL)
--- 1301,1305 ----
opacity=(long) image->colors++;
! length=(size_t) image->colors*sizeof(*image->colormap);
! image->colormap=(PixelPacket *)
! ResizeMagickMemory(image->colormap,length);
if (image->colormap == (PixelPacket *) NULL)
***************
*** 1309,1311 ****
}
! image->colormap[opacity]=image->background_color;
for (y=0; y < (long) image->rows; y++)
--- 1313,1316 ----
}
! (void) QueryColorDatabase("#cccccc",image->colormap+opacity,
! &image->exception);
for (y=0; y < (long) image->rows; y++)
***************
*** 1382,1387 ****
(void) WriteBlobByte(image,(unsigned char) c);
! for (j=0; j < (long) Max(image->colors-1,1); j++)
if (ColorMatch(&image->background_color,image->colormap+j))
break;
! (void) WriteBlobByte(image,(unsigned char) j); /* background color */
(void) WriteBlobByte(image,(unsigned char) 0x00); /* reserved */
--- 1387,1393 ----
(void) WriteBlobByte(image,(unsigned char) c);
! for (j=0; j < (long) image->colors; j++)
if (ColorMatch(&image->background_color,image->colormap+j))
break;
! (void) WriteBlobByte(image,(unsigned char)
! j == (long) image->colors ? 0 : j); /* background color */
(void) WriteBlobByte(image,(unsigned char) 0x00); /* reserved */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment