summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/winwidget.c22
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;
}
}