diff options
author | ulteq <ulteq@web.de> | 2017-12-28 19:12:52 +0100 |
---|---|---|
committer | ulteq <ulteq@web.de> | 2017-12-28 19:12:52 +0100 |
commit | a06eae174885e998031dd179457a0faafa545c59 (patch) | |
tree | 36b556d59465d2f1222c97cd6b90249c539948ef /src | |
parent | 51ed4f02a56ac292a95f4347fbd0d385335a239c (diff) |
Only calculate needed zoom when necessary
This will prevent unnecessary calls to 'feh_calc_needed_zoom'
Diffstat (limited to 'src')
-rw-r--r-- | src/winwidget.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/winwidget.c b/src/winwidget.c index 7ee63c2..d636a85 100644 --- a/src/winwidget.c +++ b/src/winwidget.c @@ -498,12 +498,6 @@ void winwidget_render_image(winwidget winwid, int resize, int force_alias) && (winwid->im_h < max_h)); if (!smaller || opt.zoom_mode) { - double ratio = 0.0; - - /* Image is larger than the screen (so wants shrinking), or it's - smaller but wants expanding to fill it */ - ratio = feh_calc_needed_zoom(&(winwid->zoom), winwid->im_w, winwid->im_h, max_w, max_h); - /* contributed by Jens Laas <jens.laas@data.slu.se> * What it does: * zooms images by a fixed amount but never larger than the screen. @@ -535,6 +529,10 @@ void winwidget_render_image(winwidget winwid, int resize, int force_alias) winwid->im_y = ((int) (max_h - (winwid->im_h * winwid->zoom))) >> 1; } else { + /* Image is larger than the screen (so wants shrinking), or it's + smaller but wants expanding to fill it */ + double ratio = feh_calc_needed_zoom(&(winwid->zoom), winwid->im_w, winwid->im_h, max_w, max_h); + if (ratio > 1.0) { /* height is the factor */ winwid->im_x = 0; |