aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
Diffstat (limited to 'backends')
-rw-r--r--backends/graphics/windowed.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/backends/graphics/windowed.h b/backends/graphics/windowed.h
index 4732ea9708..40ae561df1 100644
--- a/backends/graphics/windowed.h
+++ b/backends/graphics/windowed.h
@@ -128,8 +128,11 @@ protected:
x = CLIP<int>(x, sourceX, sourceMaxX);
y = CLIP<int>(y, sourceY, sourceMaxY);
- return Common::Point(((x - sourceX) * targetWidth + sourceWidth / 2) / sourceWidth,
- ((y - sourceY) * targetHeight + sourceHeight / 2) / sourceHeight);
+ int virtualX = ((x - sourceX) * targetWidth + sourceWidth / 2) / sourceWidth;
+ int virtualY = ((y - sourceY) * targetHeight + sourceHeight / 2) / sourceHeight;
+
+ return Common::Point(CLIP<int>(virtualX, 0, targetWidth - 1),
+ CLIP<int>(virtualY, 0, targetHeight - 1));
}
/**