From bb577d274dbd9981a726092a504466bc9b5c9bdb Mon Sep 17 00:00:00 2001 From: Bert Date: Fri, 19 Aug 2011 18:46:17 +0200 Subject: Added command to toggle gif animations --- image.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'image.c') 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; } -- cgit v1.2.3-54-g00ecf