diff options
author | Sven Hesse | 2009-09-01 21:53:00 +0000 |
---|---|---|
committer | Sven Hesse | 2009-09-01 21:53:00 +0000 |
commit | 21163f5ae193a6675324438a8c38bea50580b64b (patch) | |
tree | 67a98b12a2afef388bd048b94e34660d59b57ea4 /graphics | |
parent | aace86a6eb701cc3d075bbaa066662a5c1395f53 (diff) | |
download | scummvm-rg350-21163f5ae193a6675324438a8c38bea50580b64b.tar.gz scummvm-rg350-21163f5ae193a6675324438a8c38bea50580b64b.tar.bz2 scummvm-rg350-21163f5ae193a6675324438a8c38bea50580b64b.zip |
Add some more drawing constraints, so prevent overflowing the video memory
svn-id: r43902
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/video/coktelvideo/coktelvideo.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/graphics/video/coktelvideo/coktelvideo.cpp b/graphics/video/coktelvideo/coktelvideo.cpp index 78404eb89a..b056388f7d 100644 --- a/graphics/video/coktelvideo/coktelvideo.cpp +++ b/graphics/video/coktelvideo/coktelvideo.cpp @@ -1891,19 +1891,22 @@ uint32 Vmd::renderFrame(int16 &left, int16 &top, int16 &right, int16 &bottom) { width = postScaleX(width); + uint16 drawWidth = MIN<uint16>(width , sW - left); + uint16 drawHeight = MIN<uint16>(height, sH - top ); + // Evaluate the block type if (type == 0x01) - renderBlockSparse (dest, srcPtr, width, height, sW, sH); + renderBlockSparse (dest, srcPtr, drawWidth, drawHeight, sW, sH); else if (type == 0x02) - renderBlockWhole (dest, srcPtr, width, height, sW, sH); + renderBlockWhole (dest, srcPtr, drawWidth, drawHeight, sW, sH); else if (type == 0x03) - renderBlockRLE (dest, srcPtr, width, height, sW, sH); + renderBlockRLE (dest, srcPtr, drawWidth, drawHeight, sW, sH); else if (type == 0x42) - renderBlockWhole4X (dest, srcPtr, width, height, sW, sH); + renderBlockWhole4X (dest, srcPtr, drawWidth, drawHeight, sW, sH); else if ((type & 0x0F) == 0x02) - renderBlockWhole2Y (dest, srcPtr, width, height, sW, sH); + renderBlockWhole2Y (dest, srcPtr, drawWidth, drawHeight, sW, sH); else - renderBlockSparse2Y(dest, srcPtr, width, height, sW, sH); + renderBlockSparse2Y(dest, srcPtr, drawWidth, drawHeight, sW, sH); dest = _vidMemBuffer + postScaleX(_width) * (top - _y) + postScaleX(left - _x); |