diff options
author | ulteq <ulteq@web.de> | 2018-03-10 21:28:32 +0100 |
---|---|---|
committer | ulteq <ulteq@web.de> | 2018-03-10 22:13:45 +0100 |
commit | 701cf1377fa37a1d0c6556eeaf12118c73f4f841 (patch) | |
tree | 90758f6fcabdd065d0053b417b3cec856e3e8ad9 /src | |
parent | 0235156ba92bff1f9b023a2fd91540bfca66ce1b (diff) |
Adapt the new --offset option
Diffstat (limited to 'src')
-rw-r--r-- | src/winwidget.c | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/src/winwidget.c b/src/winwidget.c index 03aa9e8..4374752 100644 --- a/src/winwidget.c +++ b/src/winwidget.c @@ -450,33 +450,23 @@ void winwidget_render_image(winwidget winwid, int resize, int force_alias) && (!opt.default_zoom || required_zoom < winwid->zoom)) winwid->zoom = required_zoom; - winwid->im_x = (int) (winwid->w - (winwid->im_w * winwid->zoom)) >> 1; - winwid->im_y = (int) (winwid->h - (winwid->im_h * winwid->zoom)) >> 1; - } - - /* - * Adjust X/Y offset if the image is larger than the window and - * --inner-geometry is set. This will cause odd behaviour when - * zooming an already large image in --inner-geometry mode, but in most - * cases this should be what the user wants. Plus, it doesn't require - * fiddling around in two or three places above, so it's the best - * solution considering a future refactoring of this function. - */ - - if (had_resize) { - if ((opt.offset_flags & XValue) && (winwid->im_w * winwid->zoom) > winwid->w) { + if (opt.offset_flags & XValue) { if (opt.offset_flags & XNegative) { winwid->im_x = winwid->w - (winwid->im_w * winwid->zoom) - opt.offset_x; } else { winwid->im_x = - opt.offset_x * winwid->zoom; } + } else { + winwid->im_x = (int) (winwid->w - (winwid->im_w * winwid->zoom)) >> 1; } - if ((opt.offset_flags & YValue) && (winwid->im_h * winwid->zoom) > winwid->h) { + if (opt.offset_flags & YValue) { if (opt.offset_flags & YNegative) { winwid->im_y = winwid->h - (winwid->im_h * winwid->zoom) - opt.offset_y; } else { winwid->im_y = - opt.offset_y * winwid->zoom; } + } else { + winwid->im_y = (int) (winwid->h - (winwid->im_h * winwid->zoom)) >> 1; } } |