aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scumm/gfx.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/scumm/gfx.cpp b/scumm/gfx.cpp
index 9131d50cf3..6451860a26 100644
--- a/scumm/gfx.cpp
+++ b/scumm/gfx.cpp
@@ -844,9 +844,13 @@ void Scumm::restoreBG(ScummVM::Rect rect, byte backColor) {
blit(backbuff, bgbak, width, height);
if (vs->number == 0 && _charset->_hasMask && height) {
byte *mask;
- int mask_width = (width >> 3);
+ // Note: At first sight it may look as if this could
+ // be optimized to (rect.right - rect.left) >> 3 and
+ // thus to width >> 3, but that's not the case since
+ // we are dealing with integer math here.
+ int mask_width = (rect.right >> 3) - (rect.left >> 3);
- if (width & 0x07)
+ if (rect.right & 0x07)
mask_width++;
mask = getResourceAddress(rtBuffer, 9) + rect.top * gdi._numStrips + (rect.left >> 3) + _screenStartStrip;