aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoruruk2014-02-18 15:42:31 +0100
committeruruk2014-02-18 15:42:31 +0100
commit72c40dbd47b8684358432567cd20cbd3b9af92b8 (patch)
tree6b5b4ffc3e42a52e2afd3f9fabeac114c13f9ce4
parent1b5cf54cedeb4fdac2849a57dfd6185d3bd0ade7 (diff)
downloadscummvm-rg350-72c40dbd47b8684358432567cd20cbd3b9af92b8.tar.gz
scummvm-rg350-72c40dbd47b8684358432567cd20cbd3b9af92b8.tar.bz2
scummvm-rg350-72c40dbd47b8684358432567cd20cbd3b9af92b8.zip
AVALANCHE: Repair writing off the boundaries in loadPictureGraphic().
-rw-r--r--engines/avalanche/graphics.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp
index 4bd6695bb8..367ca27c09 100644
--- a/engines/avalanche/graphics.cpp
+++ b/engines/avalanche/graphics.cpp
@@ -790,7 +790,10 @@ Graphics::Surface GraphicManager::loadPictureGraphic(Common::File &file) {
byte pixel = file.readByte();
for (int bit = 0; bit < 8; bit++) {
byte pixelBit = (pixel >> bit) & 1;
- *(byte *)picture.getBasePtr(x + 7 - bit, y) += (pixelBit << plane);
+ // If the picture's width is not a multiple of 8, and we get over the boundary with the 'x' cycle, pixelBit is surely == 0.
+ // Otherwise, it doesn't cause trouble, since addign 0 doesn't have an effect at all.
+ if (pixelBit != 0)
+ *(byte *)picture.getBasePtr(x + 7 - bit, y) += (pixelBit << plane);
}
}
}