From 0f3766eaaba949bc2eac276cb0a08e0195c17441 Mon Sep 17 00:00:00 2001 From: N-R-K <79544946+N-R-K@users.noreply.github.com> Date: Mon, 3 Jan 2022 02:07:43 +0600 Subject: [PATCH] fix: animation slowdown when zoomed in (#200) rendering is a pretty expensive operation, especially when scaling with anti-aliasing. by waiting for the image to render before setting timeout, the actual timeout ends up being (render time + actual delay). this pretty much fixes the slowdown entirely on all the images i've tested. it should also improve things noticeably even in cases where the delay between frames is shorter than how fast we can render. although on such images, the issue may not be fixed entirely. Closes: https://github.com/nsxiv/nsxiv/issues/70 --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 732e690..0bd923e 100644 --- a/main.c +++ b/main.c @@ -470,8 +470,8 @@ void reset_cursor(void) void animate(void) { if (img_frame_animate(&img)) { - redraw(); set_timeout(animate, img.multi.frames[img.multi.sel].delay, true); + redraw(); } }