aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/zvision/render_table.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/engines/zvision/render_table.cpp b/engines/zvision/render_table.cpp
index 7188530075..ec0cdba7c2 100644
--- a/engines/zvision/render_table.cpp
+++ b/engines/zvision/render_table.cpp
@@ -114,15 +114,17 @@ void RenderTable::mutateImage(uint16 *sourceBuffer, uint16* destBuffer, int16 im
int16 sourceXIndex = x + _internalBuffer[index].x;
if (wrap) {
- if (sourceXIndex >= imageWidth) {
+ while (sourceXIndex >= imageWidth) {
sourceXIndex -= imageWidth;
- } else if (sourceXIndex < 0) {
+ }
+ while (sourceXIndex < 0) {
sourceXIndex += imageWidth;
}
- if (sourceYIndex >= imageHeight) {
+ while (sourceYIndex >= imageHeight) {
sourceYIndex -= imageHeight;
- } else if (sourceYIndex < 0) {
+ }
+ while (sourceYIndex < 0) {
sourceYIndex += imageHeight;
}
} else {