From 2fbc21a2050d1e8e8711afce765b7d34104f45de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bert=20M=C3=BCnnich?= Date: Mon, 1 Sep 2014 20:41:27 +0200 Subject: Simplified img_frame_animate --- commands.c | 2 +- image.c | 15 +++++---------- image.h | 2 +- main.c | 2 +- 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/commands.c b/commands.c index 75cb101..db73524 100644 --- a/commands.c +++ b/commands.c @@ -293,7 +293,7 @@ bool ci_toggle_animation(arg_t a) if (img.multi.cnt > 0) { img.multi.animate = !img.multi.animate; if (img.multi.animate) { - dirty = img_frame_animate(&img, true); + dirty = img_frame_animate(&img); set_timeout(animate, img.multi.frames[img.multi.sel].delay, true); } else { reset_timeout(animate); diff --git a/image.c b/image.c index 8f14461..d4093bf 100644 --- a/image.c +++ b/image.c @@ -824,21 +824,16 @@ bool img_frame_navigate(img_t *img, int d) return img_frame_goto(img, d); } -bool img_frame_animate(img_t *img, bool restart) +bool img_frame_animate(img_t *img) { if (img == NULL || img->im == NULL || img->multi.cnt == 0) return false; - if (img->multi.sel + 1 >= img->multi.cnt) { + if (img->multi.sel + 1 >= img->multi.cnt) img_frame_goto(img, 0); - img->dirty = true; - return true; - } else if (!restart) { + else img_frame_goto(img, img->multi.sel + 1); - img->dirty = true; - return true; - } else { - return false; - } + img->dirty = true; + return true; } diff --git a/image.h b/image.h index 0eb5020..35c0d71 100644 --- a/image.h +++ b/image.h @@ -91,6 +91,6 @@ void img_toggle_antialias(img_t*); bool img_change_gamma(img_t*, int); bool img_frame_navigate(img_t*, int); -bool img_frame_animate(img_t*, bool); +bool img_frame_animate(img_t*); #endif /* IMAGE_H */ diff --git a/main.c b/main.c index bf10088..933c3cd 100644 --- a/main.c +++ b/main.c @@ -449,7 +449,7 @@ void reset_cursor(void) void animate(void) { - if (img_frame_animate(&img, false)) { + if (img_frame_animate(&img)) { redraw(); set_timeout(animate, img.multi.frames[img.multi.sel].delay, true); } -- cgit v1.2.3