aboutsummaryrefslogtreecommitdiff
path: root/scumm/charset.cpp
diff options
context:
space:
mode:
authorMax Horn2004-09-27 20:42:10 +0000
committerMax Horn2004-09-27 20:42:10 +0000
commitd3444e3ba1f014bcd9fdca199ce10e584b91467d (patch)
treef8ecfc858e0475090228f76bf73e2c090fb7f88d /scumm/charset.cpp
parentd066b12eae2bd20e08a47059304e16ea58ccf658 (diff)
downloadscummvm-rg350-d3444e3ba1f014bcd9fdca199ce10e584b91467d.tar.gz
scummvm-rg350-d3444e3ba1f014bcd9fdca199ce10e584b91467d.tar.bz2
scummvm-rg350-d3444e3ba1f014bcd9fdca199ce10e584b91467d.zip
Perform some more clipping -- yet another attempt at bug #1033857 :-)
svn-id: r15308
Diffstat (limited to 'scumm/charset.cpp')
-rw-r--r--scumm/charset.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/scumm/charset.cpp b/scumm/charset.cpp
index 1b4a08f216..4a5cee9c4a 100644
--- a/scumm/charset.cpp
+++ b/scumm/charset.cpp
@@ -1327,9 +1327,24 @@ void CharsetRendererClassic::printChar(int chr) {
// any spots where I can test this...
if (!_ignoreCharsetMask)
warning("This might be broken -- please report where you encountered this to Fingolfin");
- int h = height;
+
+ // Perform some clipping
+ int w = MIN(width, dstSurface.w - _left);
+ int h = MIN(height, dstSurface.h - drawTop);
+ if (_left < 0) {
+ w += _left;
+ back -= _left;
+ dst -= _left;
+ }
+ if (drawTop < 0) {
+ h += drawTop;
+ back -= drawTop * backSurface.pitch;
+ dst -= drawTop * dstSurface.pitch;
+ }
+
+ // Blit the image data
do {
- memcpy(back, dst, width);
+ memcpy(back, dst, w);
back += backSurface.pitch;
dst += dstSurface.pitch;
} while (--h);