summaryrefslogtreecommitdiffstats
path: root/image.c
diff options
context:
space:
mode:
authorBert <ber.t@gmx.com>2011-08-19 18:46:17 +0200
committerBert <ber.t@gmx.com>2011-08-19 18:46:17 +0200
commitbb577d274dbd9981a726092a504466bc9b5c9bdb (patch)
treef3bbf611ddd904f80dfe20bb4d1171d1dc45ed3d /image.c
parent8b3ae5027e9490bd7edfeea3d3cd2fbc5ec4beaf (diff)
downloadnsxiv-bb577d274dbd9981a726092a504466bc9b5c9bdb.tar.zst
Added command to toggle gif animations
Diffstat (limited to 'image.c')
-rw-r--r--image.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/image.c b/image.c
index 178ace3..efd4569 100644
--- a/image.c
+++ b/image.c
@@ -596,22 +596,18 @@ int img_frame_animate(img_t *img, int restart) {
if (!img || !img->multi.cnt)
return 0;
- if (!img->multi.animate && !restart)
- return 0;
-
- if (restart) {
- img_frame_goto(img, 0);
- img->multi.animate = 1;
- } else if (img->multi.sel + 1 >= img->multi.cnt) {
- if (!GIF_LOOP) {
+ if (img->multi.sel + 1 >= img->multi.cnt) {
+ if (restart || GIF_LOOP) {
+ img_frame_goto(img, 0);
+ } else {
img->multi.animate = 0;
return 0;
- } else {
- img_frame_goto(img, 0);
}
- } else {
+ } else if (!restart) {
img_frame_goto(img, img->multi.sel + 1);
}
+ img->multi.animate = 1;
+
return img->multi.frames[img->multi.sel].delay;
}