aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2014-07-04 22:05:02 -0400
committerPaul Gilbert2014-07-04 22:05:02 -0400
commit21a4c44bea2e413444716994671f63e8fe6aa373 (patch)
tree6e8aa26790d6bd56d6881bdde0da7d4c300b6080
parente15f40978a6904dec7a50cfefbb2a05c454c6c74 (diff)
downloadscummvm-rg350-21a4c44bea2e413444716994671f63e8fe6aa373.tar.gz
scummvm-rg350-21a4c44bea2e413444716994671f63e8fe6aa373.tar.bz2
scummvm-rg350-21a4c44bea2e413444716994671f63e8fe6aa373.zip
CGE2: Add extra clipping to Bitmap::hide
-rw-r--r--engines/cge2/vga13h.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/engines/cge2/vga13h.cpp b/engines/cge2/vga13h.cpp
index f40c84ebfc..805c1e751b 100644
--- a/engines/cge2/vga13h.cpp
+++ b/engines/cge2/vga13h.cpp
@@ -1131,12 +1131,15 @@ void Bitmap::show(V2D pos) {
void Bitmap::hide(V2D pos) {
xLatPos(pos);
- for (int yp = pos.y; yp < pos.y + _h; yp++) {
+ int w = MIN<int>(_w, kScrWidth - pos.x);
+ int h = MIN<int>(_h, kScrHeight - pos.y);
+
+ for (int yp = pos.y; yp < pos.y + h; yp++) {
if (yp >= 0 && yp < kScrHeight) {
const byte *srcP = (const byte *)_vm->_vga->_page[2]->getBasePtr(pos.x, yp);
byte *destP = (byte *)_vm->_vga->_page[1]->getBasePtr(pos.x, yp);
- Common::copy(srcP, srcP + _w, destP);
+ Common::copy(srcP, srcP + w, destP);
}
}
}