[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r113892: (imagemagick_compute_animated_image): Imple
From: |
Lars Ingebrigtsen |
Subject: |
[Emacs-diffs] trunk r113892: (imagemagick_compute_animated_image): Implement a simple cache |
Date: |
Thu, 15 Aug 2013 16:01:17 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 113892
revision-id: address@hidden
parent: address@hidden
committer: Lars Magne Ingebrigtsen <address@hidden>
branch nick: trunk
timestamp: Thu 2013-08-15 18:01:13 +0200
message:
(imagemagick_compute_animated_image): Implement a simple cache
(imagemagick_compute_animated_image): Fix some compilation
warnings. Implement a very simple cache to make the animation
usable at all, but it should be replaced with a per-image cache.
modified:
src/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1438
src/image.c image.c-20091113204419-o5vbwnq5f7feedwu-2969
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2013-08-15 15:37:03 +0000
+++ b/src/ChangeLog 2013-08-15 16:01:13 +0000
@@ -18,6 +18,9 @@
* image.c (imagemagick_compute_animated_image): Implement animated
images (bug#14700).
+ (imagemagick_compute_animated_image): Fix some compilation
+ warnings. Implement a very simple cache to make the animation
+ usable at all, but it should be replaced with a per-image cache.
2013-08-15 Dmitry Antipov <address@hidden>
=== modified file 'src/image.c'
--- a/src/image.c 2013-08-15 15:10:12 +0000
+++ b/src/image.c 2013-08-15 16:01:13 +0000
@@ -7871,19 +7871,26 @@
compute ann the preceding images to be able to display a particular
sub-image. */
+static MagickWand *animation_cache = NULL;
+static int animation_index = 0;
+
static MagickWand *
imagemagick_compute_animated_image (MagickWand *super_wand, int ino)
{
MagickWand *composite_wand;
MagickSetIteratorIndex (super_wand, 0);
- composite_wand = MagickGetImage (super_wand);
-
- for (int i = 1; i <= ino; i++) {
+
+ if (ino == 0 || animation_cache == NULL)
+ composite_wand = MagickGetImage (super_wand);
+ else
+ composite_wand = animation_cache;
+
+ for (int i = max (1, animation_index); i <= ino; i++) {
MagickWand *sub_wand;
PixelIterator *source_iterator, *dest_iterator;
PixelWand **source, **dest;
- long source_width, dest_width;
+ unsigned long source_width, dest_width;
MagickPixelPacket pixel;
MagickSetIteratorIndex (super_wand, i);
@@ -7910,7 +7917,8 @@
return NULL;
}
- while (source = PixelGetNextIteratorRow (source_iterator, &source_width)) {
+ while ((source = PixelGetNextIteratorRow (source_iterator, &source_width))
+ != NULL) {
dest = PixelGetNextIteratorRow (dest_iterator, &dest_width);
for (int x = 0; x < source_width; x++)
{
@@ -7929,6 +7937,11 @@
DestroyMagickWand (sub_wand);
}
+ /* Cache a copy for the next iteration. The current wand will be
+ destroyed by the caller. */
+ animation_cache = CloneMagickWand (composite_wand);
+ animation_index = ino;
+
return composite_wand;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r113892: (imagemagick_compute_animated_image): Implement a simple cache,
Lars Ingebrigtsen <=