Krolyxon
Commit 2fbc21a

Branches

Refs →

nsxiv2fbc21a

Simplified img_frame_animate

Author
Bert Münnich
Date
2014-09-01 20:41 +0200
Committer
Bert Münnich · 2014-09-01 20:41 +0200
Parent
95a7496
Commit
2fbc21a2050d1e8e8711afce765b7d34104f45de

+8 −13

4 files changed

  1. M commands.c +1 −1
  2. M image.c +5 −10
  3. M image.h +1 −1
  4. M main.c +1 −1
M commands.c View
@@ -293,7 +293,7 @@ bool ci_toggle_animation(arg_t a)
293293 if (img.multi.cnt > 0) {
294294 img.multi.animate = !img.multi.animate;
295295 if (img.multi.animate) {
296− dirty = img_frame_animate(&img, true);
296+ dirty = img_frame_animate(&img);
297297 set_timeout(animate, img.multi.frames[img.multi.sel].delay, true);
298298 } else {
299299 reset_timeout(animate);
M image.c View
@@ -824,21 +824,16 @@ bool img_frame_navigate(img_t *img, int d)
824824 return img_frame_goto(img, d);
825825 }
826826
827−bool img_frame_animate(img_t *img, bool restart)
827+bool img_frame_animate(img_t *img)
828828 {
829829 if (img == NULL || img->im == NULL || img->multi.cnt == 0)
830830 return false;
831831
832− if (img->multi.sel + 1 >= img->multi.cnt) {
832+ if (img->multi.sel + 1 >= img->multi.cnt)
833833 img_frame_goto(img, 0);
834− img->dirty = true;
835− return true;
836− } else if (!restart) {
834+ else
837835 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;
843838 }
844839
M image.h View
@@ -91,6 +91,6 @@ void img_toggle_antialias(img_t*);
9191 bool img_change_gamma(img_t*, int);
9292
9393 bool img_frame_navigate(img_t*, int);
94−bool img_frame_animate(img_t*, bool);
94+bool img_frame_animate(img_t*);
9595
9696 #endif /* IMAGE_H */
M main.c View
@@ -449,7 +449,7 @@ void reset_cursor(void)
449449
450450 void animate(void)
451451 {
452− if (img_frame_animate(&img, false)) {
452+ if (img_frame_animate(&img)) {
453453 redraw();
454454 set_timeout(animate, img.multi.frames[img.multi.sel].delay, true);
455455 }