aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backends/graphics/windowed.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/backends/graphics/windowed.h b/backends/graphics/windowed.h
index 40ae561df1..b725ca08b4 100644
--- a/backends/graphics/windowed.h
+++ b/backends/graphics/windowed.h
@@ -102,8 +102,11 @@ protected:
error("convertVirtualToWindow called without a valid draw rect");
}
- return Common::Point(targetX + (x * targetWidth + sourceWidth / 2) / sourceWidth,
- targetY + (y * targetHeight + sourceHeight / 2) / sourceHeight);
+ int windowX = targetX + (x * targetWidth + sourceWidth / 2) / sourceWidth;
+ int windowY = targetY + (y * targetHeight + sourceHeight / 2) / sourceHeight;
+
+ return Common::Point(CLIP<int>(windowX, targetX, targetX + targetWidth - 1),
+ CLIP<int>(windowY, targetY, targetY + targetHeight - 1));
}
/**
@@ -132,7 +135,7 @@ protected:
int virtualY = ((y - sourceY) * targetHeight + sourceHeight / 2) / sourceHeight;
return Common::Point(CLIP<int>(virtualX, 0, targetWidth - 1),
- CLIP<int>(virtualY, 0, targetHeight - 1));
+ CLIP<int>(virtualY, 0, targetHeight - 1));
}
/**