From 8d57880c51f29374a745c2060260fd222a26afe4 Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 14 Aug 2013 10:43:37 -0500 Subject: ZVISION: Clip coords outside the working window --- engines/zvision/render_table.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'engines') 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(point.x, 0, _numColumns); + int16 y = CLIP(point.y, 0, _numRows); + return Common::Point(x, y); + } + uint32 index = point.y * _numColumns + point.x; Common::Point newPoint(point); -- cgit v1.2.3