diff options
author | Matthew Stewart | 2018-07-08 15:44:02 -0400 |
---|---|---|
committer | Thierry Crozat | 2018-07-08 22:30:31 +0100 |
commit | a5a45fdae16dbae164eb3f3a5ca9113e89851761 (patch) | |
tree | c05e00945a73e111ffebf3772c8ef2874b7c2721 /backends/graphics | |
parent | a382a6dd303a97a0f813eb2f86bc93f27ef83aa9 (diff) | |
download | scummvm-rg350-a5a45fdae16dbae164eb3f3a5ca9113e89851761.tar.gz scummvm-rg350-a5a45fdae16dbae164eb3f3a5ca9113e89851761.tar.bz2 scummvm-rg350-a5a45fdae16dbae164eb3f3a5ca9113e89851761.zip |
SDL: Clip mouse range in convertVirtualToWindow
Diffstat (limited to 'backends/graphics')
-rw-r--r-- | backends/graphics/windowed.h | 9 |
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)); } /** |