From d3444e3ba1f014bcd9fdca199ce10e584b91467d Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 27 Sep 2004 20:42:10 +0000 Subject: Perform some more clipping -- yet another attempt at bug #1033857 :-) svn-id: r15308 --- scumm/charset.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'scumm/charset.cpp') 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); -- cgit v1.2.3