From acea03a9cd9ce14b210fe4b2fc650e34e8ae657b Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 17 Aug 2013 11:36:42 -0500 Subject: ZVISION: Allow RenderTable indicies to be negative --- engines/zvision/render_table.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'engines') diff --git a/engines/zvision/render_table.cpp b/engines/zvision/render_table.cpp index 23394b7bc2..7188530075 100644 --- a/engines/zvision/render_table.cpp +++ b/engines/zvision/render_table.cpp @@ -100,18 +100,18 @@ uint16 mixTwoRGB(uint16 colorOne, uint16 colorTwo, float percentColorOne) { void RenderTable::mutateImage(uint16 *sourceBuffer, uint16* destBuffer, int16 imageWidth, int16 imageHeight, int16 destinationX, int16 destinationY, const Common::Rect &subRect, bool wrap, bool isTransposed) { for (int16 y = subRect.top; y < subRect.bottom; y++) { - uint16 normalizedY = y - subRect.top; - uint32 internalColumnIndex = (normalizedY + destinationY) * _numColumns; - uint32 destColumnIndex = normalizedY * _numColumns; + int16 normalizedY = y - subRect.top; + int32 internalColumnIndex = (normalizedY + destinationY) * _numColumns; + int32 destColumnIndex = normalizedY * _numColumns; for (int16 x = subRect.left; x < subRect.right; x++) { - uint16 normalizedX = x - subRect.left; + int16 normalizedX = x - subRect.left; - uint32 index = internalColumnIndex + normalizedX + destinationX; + int32 index = internalColumnIndex + normalizedX + destinationX; // RenderTable only stores offsets from the original coordinates - uint16 sourceYIndex = y + _internalBuffer[index].y; - uint16 sourceXIndex = x + _internalBuffer[index].x; + int16 sourceYIndex = y + _internalBuffer[index].y; + int16 sourceXIndex = x + _internalBuffer[index].x; if (wrap) { if (sourceXIndex >= imageWidth) { @@ -127,10 +127,10 @@ void RenderTable::mutateImage(uint16 *sourceBuffer, uint16* destBuffer, int16 im } } else { // Clamp the yIndex to the size of the image - sourceYIndex = CLIP(sourceYIndex, 0, imageHeight - 1); + sourceYIndex = CLIP(sourceYIndex, 0, imageHeight - 1); // Clamp the xIndex to the size of the image - sourceXIndex = CLIP(sourceXIndex, 0, imageWidth - 1); + sourceXIndex = CLIP(sourceXIndex, 0, imageWidth - 1); } if (isTransposed) { -- cgit v1.2.3