significantly clean up the image size functions

This commit is contained in:
speedie 2023-06-12 00:15:29 +02:00
parent 0e5b5b240b
commit 4d505459b1
2 changed files with 4 additions and 21 deletions

View file

@ -369,6 +369,7 @@ out:
void setimgsize(Arg *arg) {
#if USEIMAGE
setimagesize(imagewidth + arg->i, imageheight + arg->i);
drawmenu();
#endif
}

View file

@ -2,30 +2,12 @@
#if USEIMAGE
void setimagesize(int width, int height) {
int oih = 0;
int oiw = 0;
// this makes sure we cannot scale the image up or down too much
if ((!image && height < imageheight) || (!image && width < imagewidth) || (width < 0) || width > mw || hideimage || fullscreen) return;
// original width/height
oih = imageheight;
oiw = imagewidth;
drawimage();
imageheight = height;
imagewidth = width;
needredraw = 0;
if (!image) {
imageheight = oih;
imagewidth = oiw;
if (!image || fullscreen || hideimage || height < 5 || width < 5 || width > mw) {
return;
}
drawmenu();
imageheight = height;
imagewidth = width;
}
void flipimage(void) {