aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Hesse2009-02-22 14:04:07 +0000
committerSven Hesse2009-02-22 14:04:07 +0000
commit462ef2c78c0f232472e7f11e736e55a8e8137a2f (patch)
treedb1d68e80e8c3f459450330d8ced6fa541aa273a
parentb5ce8d93200d60c3a752720300d77773750bf583 (diff)
downloadscummvm-rg350-462ef2c78c0f232472e7f11e736e55a8e8137a2f.tar.gz
scummvm-rg350-462ef2c78c0f232472e7f11e736e55a8e8137a2f.tar.bz2
scummvm-rg350-462ef2c78c0f232472e7f11e736e55a8e8137a2f.zip
Clipping the rendering to the output surface.
This should fix the crash in the Italian version of Woodruff (#1981031 - "Crash after dancing at Puh-Let Party!!") svn-id: r38784
-rw-r--r--engines/gob/coktelvideo.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/engines/gob/coktelvideo.cpp b/engines/gob/coktelvideo.cpp
index 9d0ca76f87..8f0f20a6d0 100644
--- a/engines/gob/coktelvideo.cpp
+++ b/engines/gob/coktelvideo.cpp
@@ -1388,6 +1388,7 @@ uint32 Vmd::renderFrame(int16 &left, int16 &top, int16 &right, int16 &bottom) {
int16 width = right - left + 1;
int16 height = bottom - top + 1;
int16 sW = _vidMemWidth;
+ int16 sH = _vidMemHeight;
uint32 dataLen = _frameDataLen;
byte *dataPtr = _frameData;
byte *imdVidMem = _vidMem + sW * top + left;
@@ -1427,6 +1428,7 @@ uint32 Vmd::renderFrame(int16 &left, int16 &top, int16 &right, int16 &bottom) {
dest = _vidMemBuffer + postScaleX(_width) * (top - _y) + postScaleX((left - _x));
imdVidMem = _vidMem + _vidMemWidth * top + preScaleX(left);
sW = postScaleX(_width);
+ sH = _height;
}
if (type & 0x80) { // Frame data is compressed
@@ -1468,11 +1470,15 @@ uint32 Vmd::renderFrame(int16 &left, int16 &top, int16 &right, int16 &bottom) {
dest = destBak;
}
} else if (type == 2) { // Whole block
- for (int i = 0; i < height; i++) {
- memcpy(dest, srcPtr, postScaleX(width));
+ int16 w = MIN<int32>(postScaleX(width), sW);
+ int16 h = MIN(height, sH);
+
+ for (int i = 0; i < h; i++) {
+ memcpy(dest, srcPtr, w);
srcPtr += postScaleX(width);
dest += sW;
}
+
} else if (type == 3) { // RLE block
for (int i = 0; i < height; i++) {
destBak = dest;