aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/m4/mads_views.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/engines/m4/mads_views.cpp b/engines/m4/mads_views.cpp
index dd5eb7a266..08b579cfb0 100644
--- a/engines/m4/mads_views.cpp
+++ b/engines/m4/mads_views.cpp
@@ -738,9 +738,12 @@ void MadsDirtyArea::setArea(int width, int height, int maxWidth, int maxHeight)
--bounds.left;
++width;
}
- int right = bounds.left + width;
+
if (bounds.left < 0)
bounds.left = 0;
+ else if (bounds.left > maxWidth)
+ bounds.left = maxWidth;
+ int right = bounds.left + width;
if (right < 0)
right = 0;
if (right > maxWidth)
@@ -752,6 +755,8 @@ void MadsDirtyArea::setArea(int width, int height, int maxWidth, int maxHeight)
if (bounds.top < 0)
bounds.top = 0;
+ else if (bounds.top > maxHeight)
+ bounds.top = maxHeight;
int bottom = bounds.top + height;
if (bottom < 0)
bottom = 0;