From 91cc7782f7d8779d01f17ec6a340b16b6bf52cb1 Mon Sep 17 00:00:00 2001 From: speedie Date: Wed, 8 Mar 2023 18:58:52 +0100 Subject: [PATCH] greatly speed up image redrawing/resizing by removing unnecessary calls to drawimage() and cleanupimage() we don't need to call cleanupimage() as it is already called in cleanup() we don't need to call drawimage() because X11 events should handle that for us anyway --- libs/arg.c | 8 -------- libs/event.c | 1 + libs/img.c | 2 -- 3 files changed, 1 insertion(+), 10 deletions(-) diff --git a/libs/arg.c b/libs/arg.c index 9cff673..1faddd3 100644 --- a/libs/arg.c +++ b/libs/arg.c @@ -319,8 +319,6 @@ flipimg(const Arg *arg) flip = flip ? 0 : arg->i ? 1 : 2; - cleanupimage(); - drawimage(); drawmenu(); } @@ -335,8 +333,6 @@ rotateimg(const Arg *arg) rotation++; - cleanupimage(); - drawimage(); drawmenu(); } @@ -347,12 +343,9 @@ toggleimg(const Arg *arg) return; #endif - cleanupimage(); - hideimage = !hideimage; drawmenu(); - drawimage(); } void @@ -371,5 +364,4 @@ defaultimg(const Arg *arg) } drawmenu(); - drawimage(); } diff --git a/libs/event.c b/libs/event.c index dc8ea51..ab2d510 100644 --- a/libs/event.c +++ b/libs/event.c @@ -37,6 +37,7 @@ eventloop(void) break; } + /* redraw image on X11 event */ #if USEIMAGE drawimage(); #endif diff --git a/libs/img.c b/libs/img.c index a46aba2..37280dd 100644 --- a/libs/img.c +++ b/libs/img.c @@ -11,8 +11,6 @@ setimagesize(int width, int height) /* this makes sure we cannot scale the image up or down too much */ if ((!image && height < imageheight) || (!image && width < imagewidth) || width > mw || hideimage) return; - cleanupimage(); - oih = imageheight; oiw = imagewidth;