diff options
author | Robert Göffringmann | 2005-04-01 03:00:51 +0000 |
---|---|---|
committer | Robert Göffringmann | 2005-04-01 03:00:51 +0000 |
commit | 65596240d70869900df61ece1812d080c5acd22f (patch) | |
tree | 153b7eaec7071b47114925e821c605867b1d1380 /backends | |
parent | ebe4c1b6b6cf066dd3497057eb27f9ed3ccbbf51 (diff) | |
download | scummvm-rg350-65596240d70869900df61ece1812d080c5acd22f.tar.gz scummvm-rg350-65596240d70869900df61ece1812d080c5acd22f.tar.bz2 scummvm-rg350-65596240d70869900df61ece1812d080c5acd22f.zip |
ps2: clip coordinates in copyRectToScreen, necessary for The Dig
svn-id: r17318
Diffstat (limited to 'backends')
-rw-r--r-- | backends/ps2/systemps2.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/backends/ps2/systemps2.cpp b/backends/ps2/systemps2.cpp index 619e842fa6..64636baf48 100644 --- a/backends/ps2/systemps2.cpp +++ b/backends/ps2/systemps2.cpp @@ -367,7 +367,22 @@ void OSystem_PS2::setPalette(const byte *colors, uint start, uint num) { } void OSystem_PS2::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) { - _screen->copyScreenRect((const uint8*)buf, (uint16)pitch, (uint16)x, (uint16)y, (uint16)w, (uint16)h); + if (x < 0) { + w += x; + buf -= x; + x = 0; + } + if (y < 0) { + h += y; + buf -= y * pitch; + y = 0; + } + if (w > x + _width) + w = _width - x; + if (h > y + _height) + h = _height - y; + if ((w > 0) && (h > 0)) + _screen->copyScreenRect((const uint8*)buf, (uint16)pitch, (uint16)x, (uint16)y, (uint16)w, (uint16)h); } void OSystem_PS2::updateScreen(void) { |