aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2010-06-29 20:13:57 +0000
committerFilippos Karapetis2010-06-29 20:13:57 +0000
commit3a2ac994d4565beff844aa802211099a4785a3e0 (patch)
tree50c303947e8889b485bf0292106fc0048d68a903
parent42351265f16779569cf170ff0e85658db26e7ee7 (diff)
downloadscummvm-rg350-3a2ac994d4565beff844aa802211099a4785a3e0.tar.gz
scummvm-rg350-3a2ac994d4565beff844aa802211099a4785a3e0.tar.bz2
scummvm-rg350-3a2ac994d4565beff844aa802211099a4785a3e0.zip
Handle empty clip rectangles in GfxView::drawScaled(). Fixes an assert in the first room of the game
svn-id: r50503
-rw-r--r--engines/sci/graphics/view.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/engines/sci/graphics/view.cpp b/engines/sci/graphics/view.cpp
index ee9611b046..244114e866 100644
--- a/engines/sci/graphics/view.cpp
+++ b/engines/sci/graphics/view.cpp
@@ -660,8 +660,12 @@ void GfxView::drawScaled(const Common::Rect &rect, const Common::Rect &clipRect,
scaledWidth = MIN(clipRect.width(), scaledWidth);
scaledHeight = MIN(clipRect.height(), scaledHeight);
- const uint16 offsetY = clipRect.top - rect.top;
- const uint16 offsetX = clipRect.left - rect.left;
+ const int16 offsetY = clipRect.top - rect.top;
+ const int16 offsetX = clipRect.left - rect.left;
+
+ // Happens in SQ6, first room
+ if (offsetX < 0 || offsetY < 0)
+ return;
assert(scaledHeight + offsetY <= ARRAYSIZE(scalingY));
assert(scaledWidth + offsetX <= ARRAYSIZE(scalingX));