From 701cf1377fa37a1d0c6556eeaf12118c73f4f841 Mon Sep 17 00:00:00 2001 From: ulteq Date: Sat, 10 Mar 2018 21:28:32 +0100 Subject: Adapt the new --offset option --- src/winwidget.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) (limited to 'src') 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; } } -- cgit v1.2.3