lel

Fork of Hiltjo's Farbfeld image viewer. (It was just for fun, not much use)
Log | Files | Refs | README | LICENSE

commit 4969a4dbe94f7f47aa6054cd28d9cc41fd2df655
parent bf021b6653c962c98d193f8b494e33660aff46cd
Author: Jacob R. Edwards <jacobouno@protonmail.com>
Date:   Sun, 18 Apr 2021 15:11:59 -0700

Always respect zoom

Diffstat:
Mlel.c | 21+++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/lel.c b/lel.c @@ -224,21 +224,30 @@ ximage(unsigned int newwidth, unsigned int newheight) static void scaleview(void) { + unsigned int w, h; + switch(viewmode) { case FULL_STRETCH: - ximage(winwidth, winheight); + w = winwidth; + h = winheight; break; case FULL_ASPECT: - if (winwidth * img.height > winheight * img.width) - ximage(img.width * winheight / img.height, winheight); - else - ximage(winwidth, img.height * winwidth / img.width); + if (winwidth * img.height > winheight * img.width) { + w = img.width * winheight / img.height; + h = winheight; + } else { + w = winwidth; + h = img.height * winwidth / img.width; + } break; case ASPECT: default: - ximage(img.width * img.view.zoomfact, img.height * img.view.zoomfact); + w = img.width; + h = img.height; break; } + + ximage(w * img.view.zoomfact, h * img.view.zoomfact); img.state |= SCALED; }