summaryrefslogtreecommitdiff
path: root/src/viewport.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/viewport.cpp')
-rw-r--r--src/viewport.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/viewport.cpp b/src/viewport.cpp
index 307b90598..74c774ff2 100644
--- a/src/viewport.cpp
+++ b/src/viewport.cpp
@@ -296,10 +296,13 @@ static void SetViewportPosition(Window *w, int x, int y)
vp->virtual_left = x;
vp->virtual_top = y;
- old_left = UnScaleByZoom(old_left, vp->zoom);
- old_top = UnScaleByZoom(old_top, vp->zoom);
- x = UnScaleByZoom(x, vp->zoom);
- y = UnScaleByZoom(y, vp->zoom);
+ /* viewport is bound to its left top corner, so it must be rounded down (UnScaleByZoomLower)
+ * else glitch described in FS#1412 will happen (offset by 1 pixel with zoom level > NORMAL)
+ */
+ old_left = UnScaleByZoomLower(old_left, vp->zoom);
+ old_top = UnScaleByZoomLower(old_top, vp->zoom);
+ x = UnScaleByZoomLower(x, vp->zoom);
+ y = UnScaleByZoomLower(y, vp->zoom);
old_left -= x;
old_top -= y;