From: Lars Magne Ingebrigtsen Date: Thu, 15 Aug 2013 17:20:06 +0000 (+0200) Subject: (imagemagick_compute_animated_image): Respect the GIF disposal methods. X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~1686^2~226 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a5b5f73f32a8af8a45a252ed13a381d7526ad1b7;p=emacs.git (imagemagick_compute_animated_image): Respect the GIF disposal methods. --- diff --git a/src/ChangeLog b/src/ChangeLog index c12b32ebc71..028c33848a4 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2013-08-15 Lars Magne Ingebrigtsen + + * image.c (imagemagick_compute_animated_image): Respect the GIF + disposal methods. + 2013-08-15 Ken Brown * emacs.c (main): Update comment about G_SLICE_ALWAYS_MALLOC. diff --git a/src/image.c b/src/image.c index 3cab72edf74..3c5ee4ce66f 100644 --- a/src/image.c +++ b/src/image.c @@ -7887,17 +7887,20 @@ imagemagick_compute_animated_image (MagickWand *super_wand, int ino) else composite_wand = animation_cache; - for (i = max (1, animation_index); i <= ino; i++) + for (i = max (1, animation_index + 1); i <= ino; i++) { MagickWand *sub_wand; PixelIterator *source_iterator, *dest_iterator; PixelWand **source, **dest; size_t source_width, dest_width; MagickPixelPacket pixel; + DisposeType dispose; MagickSetIteratorIndex (super_wand, i); sub_wand = MagickGetImage (super_wand); + dispose = MagickGetImageDispose (sub_wand); + source_iterator = NewPixelIterator (sub_wand); if (! source_iterator) { @@ -7926,12 +7929,20 @@ imagemagick_compute_animated_image (MagickWand *super_wand, int ino) dest = PixelGetNextIteratorRow (dest_iterator, &dest_width); for (x = 0; x < source_width; x++) { - /* Copy over non-transparent pixels. */ - if (PixelGetAlpha (source[x])) + if (dispose == BackgroundDispose) { PixelGetMagickColor (source[x], &pixel); PixelSetMagickColor (dest[x], &pixel); } + else + { + /* Copy over non-transparent pixels. */ + if (PixelGetAlpha (source[x])) + { + PixelGetMagickColor (source[x], &pixel); + PixelSetMagickColor (dest[x], &pixel); + } + } } PixelSyncIterator(dest_iterator); }