aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLars Magne Ingebrigtsen2013-08-15 21:46:02 +0200
committerLars Magne Ingebrigtsen2013-08-15 21:46:02 +0200
commit7967001450f4a3e76e37355740fa942290cede26 (patch)
tree9daeb7a67d90f18f650d565a1fe6aa68d1adfcc8 /src
parent1d18b1e6ab1aabab94554fc10e24811478346fab (diff)
downloademacs-7967001450f4a3e76e37355740fa942290cede26.tar.gz
emacs-7967001450f4a3e76e37355740fa942290cede26.zip
(imagemagick_compute_animated_image): Allow certain degenerate images
(imagemagick_compute_animated_image): Allow images that say they have sub-images that are bigger than the main image, but just crop them.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog3
-rw-r--r--src/image.c25
2 files changed, 15 insertions, 13 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 431802eab45..dd4697298ac 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -4,6 +4,9 @@
4 when sub-images are smaller than the main image. 4 when sub-images are smaller than the main image.
5 (imagemagick_compute_animated_image): Setting the iterator row to 5 (imagemagick_compute_animated_image): Setting the iterator row to
6 zero is apparently not allowed. 6 zero is apparently not allowed.
7 (imagemagick_compute_animated_image): Allow images that say they
8 have sub-images that are bigger than the main image, but just crop
9 them.
7 10
82013-08-15 Jan Djärv <jan.h.d@swipnet.se> 112013-08-15 Jan Djärv <jan.h.d@swipnet.se>
9 12
diff --git a/src/image.c b/src/image.c
index 6f92c583554..d7e1d7991dd 100644
--- a/src/image.c
+++ b/src/image.c
@@ -7900,6 +7900,7 @@ imagemagick_compute_animated_image (MagickWand *super_wand, int ino)
7900 ssize_t source_left, source_top; 7900 ssize_t source_left, source_top;
7901 MagickPixelPacket pixel; 7901 MagickPixelPacket pixel;
7902 DisposeType dispose; 7902 DisposeType dispose;
7903 ptrdiff_t lines = 0;
7903 7904
7904 MagickSetIteratorIndex (super_wand, i); 7905 MagickSetIteratorIndex (super_wand, i);
7905 sub_wand = MagickGetImage (super_wand); 7906 sub_wand = MagickGetImage (super_wand);
@@ -7907,17 +7908,6 @@ imagemagick_compute_animated_image (MagickWand *super_wand, int ino)
7907 MagickGetImagePage (sub_wand, &source_width, &source_height, 7908 MagickGetImagePage (sub_wand, &source_width, &source_height,
7908 &source_left, &source_top); 7909 &source_left, &source_top);
7909 7910
7910 /* Sanity check. The sub-image should not be bigger than the
7911 base image. */
7912 if (source_height + source_top > dest_height)
7913 {
7914 DestroyMagickWand (composite_wand);
7915 DestroyMagickWand (sub_wand);
7916 animation_cache = NULL;
7917 image_error ("Inconsinstent animation size", Qnil, Qnil);
7918 return NULL;
7919 }
7920
7921 dispose = MagickGetImageDispose (sub_wand); 7911 dispose = MagickGetImageDispose (sub_wand);
7922 7912
7923 source_iterator = NewPixelIterator (sub_wand); 7913 source_iterator = NewPixelIterator (sub_wand);
@@ -7946,17 +7936,26 @@ imagemagick_compute_animated_image (MagickWand *super_wand, int ino)
7946 /* The sub-image may not start at origo, so move the destination 7936 /* The sub-image may not start at origo, so move the destination
7947 iterator to where the sub-image should start. */ 7937 iterator to where the sub-image should start. */
7948 if (source_top > 0) 7938 if (source_top > 0)
7949 PixelSetIteratorRow (dest_iterator, source_top); 7939 {
7940 PixelSetIteratorRow (dest_iterator, source_top);
7941 lines = source_top;
7942 }
7950 7943
7951 while ((source = PixelGetNextIteratorRow (source_iterator, &source_width)) 7944 while ((source = PixelGetNextIteratorRow (source_iterator, &source_width))
7952 != NULL) 7945 != NULL)
7953 { 7946 {
7954 ptrdiff_t x; 7947 ptrdiff_t x;
7948
7949 /* Sanity check. This shouldn't happen, but apparently
7950 does in some pictures. */
7951 if (++lines >= dest_height)
7952 break;
7953
7955 dest = PixelGetNextIteratorRow (dest_iterator, &dest_width); 7954 dest = PixelGetNextIteratorRow (dest_iterator, &dest_width);
7956 for (x = 0; x < source_width; x++) 7955 for (x = 0; x < source_width; x++)
7957 { 7956 {
7958 /* Sanity check. This shouldn't happen, but apparently 7957 /* Sanity check. This shouldn't happen, but apparently
7959 does in some pictures. */ 7958 also does in some pictures. */
7960 if (x + source_left > dest_width) 7959 if (x + source_left > dest_width)
7961 break; 7960 break;
7962 /* Normally we only copy over non-transparent pixels, 7961 /* Normally we only copy over non-transparent pixels,