summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2022-04-12 12:12:24 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2022-04-12 12:12:24 +0200
commit8e1c0054b3545863e41d51c95b69ab7fdb0cc61d (patch)
tree5db96e6ef9a646238ecc7e5cae71fbec57db719b
parent78784ccfadaee1c86207ecc360db7236285713f5 (diff)
downloademacs-8e1c0054b3545863e41d51c95b69ab7fdb0cc61d.tar.gz
Fix thinko in the anim cache
* src/image.c (gif_load): Fix resetting the cache when we're out of sync. (anim_create_cache): Start from zero, not 1.
-rw-r--r--src/image.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/image.c b/src/image.c
index 38c3f1496aa..f6143f5b46e 100644
--- a/src/image.c
+++ b/src/image.c
@@ -2847,7 +2847,7 @@ anim_create_cache (Lisp_Object spec)
cache->handle = NULL;
cache->temp = NULL;
- cache->index = 0;
+ cache->index = -1;
cache->next = NULL;
cache->spec = spec;
return cache;
@@ -8825,15 +8825,14 @@ gif_load (struct frame *f, struct image *img)
{
/* If this is an animated image, create a cache for it. */
cache = anim_get_animation_cache (img->spec);
+ /* We have an old cache entry, so use it. */
if (cache->handle)
{
- /* We have an old cache entry, and it looks correct, so use
- it. */
- if (cache->index == idx - 1)
- {
- gif = cache->handle;
- pixmap = cache->temp;
- }
+ gif = cache->handle;
+ pixmap = cache->temp;
+ /* We're out of sync, so start from the beginning. */
+ if (cache->index != idx - 1)
+ cache->index = -1;
}
}