aboutsummaryrefslogtreecommitdiff
path: root/engines/composer
diff options
context:
space:
mode:
authorAlyssa Milburn2011-07-18 15:06:38 +0200
committerAlyssa Milburn2011-07-18 15:06:38 +0200
commitd176fb1a37819b560d5aa44cd3625b4dd37e1ff7 (patch)
treed82dfd980655e6d47141e06906bf1a74e63feebb /engines/composer
parent305023aef5d36af451ce2ac2a6928d0659a205a9 (diff)
downloadscummvm-rg350-d176fb1a37819b560d5aa44cd3625b4dd37e1ff7.tar.gz
scummvm-rg350-d176fb1a37819b560d5aa44cd3625b4dd37e1ff7.tar.bz2
scummvm-rg350-d176fb1a37819b560d5aa44cd3625b4dd37e1ff7.zip
COMPOSER: Clip sprite drawing.
Diffstat (limited to 'engines/composer')
-rw-r--r--engines/composer/composer.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/engines/composer/composer.cpp b/engines/composer/composer.cpp
index 0a3b7b722a..854363d2bd 100644
--- a/engines/composer/composer.cpp
+++ b/engines/composer/composer.cpp
@@ -1901,10 +1901,14 @@ void ComposerEngine::drawSprite(const Sprite &sprite) {
// incoming data is BMP-style (bottom-up), so flip it
byte *pixels = (byte *)_surface.pixels;
for (int j = 0; j < sprite._surface.h; j++) {
+ if (j + y < 0)
+ continue;
+ if (j + y >= _surface.h)
+ break;
byte *in = (byte *)sprite._surface.pixels + (sprite._surface.h - j - 1) * sprite._surface.w;
byte *out = pixels + ((j + y) * _surface.w) + x;
- for (uint i = 0; i < sprite._surface.w; i++)
- if (in[i])
+ for (int i = 0; i < sprite._surface.w; i++)
+ if ((x + i >= 0) && (x + i < _surface.w) && in[i])
out[i] = in[i];
}
}