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
This commit is contained in:
speedie 2023-03-08 18:58:52 +01:00
parent 93ebe11e06
commit 91cc7782f7
3 changed files with 1 additions and 10 deletions

View file

@ -319,8 +319,6 @@ flipimg(const Arg *arg)
flip = flip ? 0 : arg->i ? 1 : 2; flip = flip ? 0 : arg->i ? 1 : 2;
cleanupimage();
drawimage();
drawmenu(); drawmenu();
} }
@ -335,8 +333,6 @@ rotateimg(const Arg *arg)
rotation++; rotation++;
cleanupimage();
drawimage();
drawmenu(); drawmenu();
} }
@ -347,12 +343,9 @@ toggleimg(const Arg *arg)
return; return;
#endif #endif
cleanupimage();
hideimage = !hideimage; hideimage = !hideimage;
drawmenu(); drawmenu();
drawimage();
} }
void void
@ -371,5 +364,4 @@ defaultimg(const Arg *arg)
} }
drawmenu(); drawmenu();
drawimage();
} }

View file

@ -37,6 +37,7 @@ eventloop(void)
break; break;
} }
/* redraw image on X11 event */
#if USEIMAGE #if USEIMAGE
drawimage(); drawimage();
#endif #endif

View file

@ -11,8 +11,6 @@ setimagesize(int width, int height)
/* this makes sure we cannot scale the image up or down too much */ /* this makes sure we cannot scale the image up or down too much */
if ((!image && height < imageheight) || (!image && width < imagewidth) || width > mw || hideimage) return; if ((!image && height < imageheight) || (!image && width < imagewidth) || width > mw || hideimage) return;
cleanupimage();
oih = imageheight; oih = imageheight;
oiw = imagewidth; oiw = imagewidth;