aboutsummaryrefslogtreecommitdiff
path: root/engines/m4
diff options
context:
space:
mode:
authorPaul Gilbert2010-06-26 11:14:38 +0000
committerPaul Gilbert2010-06-26 11:14:38 +0000
commitd7fe98825154ede7beb0987ee3177ed46f1a3fa4 (patch)
treea070aae26fad022c083722a4669f6192fdf04bcb /engines/m4
parent906b3221f58d71c0c73a9c60f9fd3feb7fcafaab (diff)
downloadscummvm-rg350-d7fe98825154ede7beb0987ee3177ed46f1a3fa4.tar.gz
scummvm-rg350-d7fe98825154ede7beb0987ee3177ed46f1a3fa4.tar.bz2
scummvm-rg350-d7fe98825154ede7beb0987ee3177ed46f1a3fa4.zip
Bugfix to dirty area handling to prevent creation of invalid rects
svn-id: r50312
Diffstat (limited to 'engines/m4')
-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;