SDL: Clip mouse range in convertVirtualToWindow

This commit is contained in:
Matthew Stewart 2018-07-08 15:44:02 -04:00 committed by Thierry Crozat
parent a382a6dd30
commit a5a45fdae1

View file

@ -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));
}
/**