aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorrichiesams2013-08-14 10:43:37 -0500
committerrichiesams2013-08-14 11:20:21 -0500
commit8d57880c51f29374a745c2060260fd222a26afe4 (patch)
treeadf1e6f0c46e8d00faa709a155a5604212dd6f4d /engines
parentd8f9be74ff63d2ab21f23e6c1520a7bdebdf1286 (diff)
downloadscummvm-rg350-8d57880c51f29374a745c2060260fd222a26afe4.tar.gz
scummvm-rg350-8d57880c51f29374a745c2060260fd222a26afe4.tar.bz2
scummvm-rg350-8d57880c51f29374a745c2060260fd222a26afe4.zip
ZVISION: Clip coords outside the working window
Diffstat (limited to 'engines')
-rw-r--r--engines/zvision/render_table.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/engines/zvision/render_table.cpp b/engines/zvision/render_table.cpp
index ba506b1206..aab4735d81 100644
--- a/engines/zvision/render_table.cpp
+++ b/engines/zvision/render_table.cpp
@@ -61,6 +61,13 @@ void RenderTable::setRenderState(RenderState newState) {
}
const Common::Point RenderTable::convertWarpedCoordToFlatCoord(const Common::Point &point) {
+ // If we're outside the range of the RenderTable, no warping is happening. Return the maximum image coords
+ if (point.x >= _numColumns || point.y >= _numRows) {
+ int16 x = CLIP<int16>(point.x, 0, _numColumns);
+ int16 y = CLIP<int16>(point.y, 0, _numRows);
+ return Common::Point(x, y);
+ }
+
uint32 index = point.y * _numColumns + point.x;
Common::Point newPoint(point);