nsxiv2fbc21a
Simplified img_frame_animate
+8 −13
4 files changed
- M commands.c +1 −1
- M image.c +5 −10
- M image.h +1 −1
- M main.c +1 −1
| @@ -293,7 +293,7 @@ bool ci_toggle_animation(arg_t a) | |||
| 293 | 293 | if (img.multi.cnt > 0) { | |
| 294 | 294 | img.multi.animate = !img.multi.animate; | |
| 295 | 295 | if (img.multi.animate) { | |
| 296 | − | dirty = img_frame_animate(&img, true); | |
| 296 | + | dirty = img_frame_animate(&img); | |
| 297 | 297 | set_timeout(animate, img.multi.frames[img.multi.sel].delay, true); | |
| 298 | 298 | } else { | |
| 299 | 299 | reset_timeout(animate); | |
| @@ -824,21 +824,16 @@ bool img_frame_navigate(img_t *img, int d) | |||
| 824 | 824 | return img_frame_goto(img, d); | |
| 825 | 825 | } | |
| 826 | 826 | ||
| 827 | − | bool img_frame_animate(img_t *img, bool restart) | |
| 827 | + | bool img_frame_animate(img_t *img) | |
| 828 | 828 | { | |
| 829 | 829 | if (img == NULL || img->im == NULL || img->multi.cnt == 0) | |
| 830 | 830 | return false; | |
| 831 | 831 | ||
| 832 | − | if (img->multi.sel + 1 >= img->multi.cnt) { | |
| 832 | + | if (img->multi.sel + 1 >= img->multi.cnt) | |
| 833 | 833 | img_frame_goto(img, 0); | |
| 834 | − | img->dirty = true; | |
| 835 | − | return true; | |
| 836 | − | } else if (!restart) { | |
| 834 | + | else | |
| 837 | 835 | img_frame_goto(img, img->multi.sel + 1); | |
| 838 | − | img->dirty = true; | |
| 839 | − | return true; | |
| 840 | − | } else { | |
| 841 | − | return false; | |
| 842 | − | } | |
| 836 | + | img->dirty = true; | |
| 837 | + | return true; | |
| 843 | 838 | } | |
| 844 | 839 | ||
| @@ -91,6 +91,6 @@ void img_toggle_antialias(img_t*); | |||
| 91 | 91 | bool img_change_gamma(img_t*, int); | |
| 92 | 92 | ||
| 93 | 93 | bool img_frame_navigate(img_t*, int); | |
| 94 | − | bool img_frame_animate(img_t*, bool); | |
| 94 | + | bool img_frame_animate(img_t*); | |
| 95 | 95 | ||
| 96 | 96 | #endif /* IMAGE_H */ | |
| @@ -449,7 +449,7 @@ void reset_cursor(void) | |||
| 449 | 449 | ||
| 450 | 450 | void animate(void) | |
| 451 | 451 | { | |
| 452 | − | if (img_frame_animate(&img, false)) { | |
| 452 | + | if (img_frame_animate(&img)) { | |
| 453 | 453 | redraw(); | |
| 454 | 454 | set_timeout(animate, img.multi.frames[img.multi.sel].delay, true); | |
| 455 | 455 | } | |