From 3935a427f94c7619c56976db3c8c4aeca1df500b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 7 Jul 2014 21:48:02 -0400 Subject: CGE2: Add extra clipping to Bitmap::hide --- engines/cge2/vga13h.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/cge2/vga13h.cpp b/engines/cge2/vga13h.cpp index d7e0552253..a53a1160b8 100644 --- a/engines/cge2/vga13h.cpp +++ b/engines/cge2/vga13h.cpp @@ -1134,10 +1134,24 @@ void Bitmap::show(V2D pos) { void Bitmap::hide(V2D pos) { xLatPos(pos); - + + // Perform clipping to screen int w = MIN(_w, kScrWidth - pos.x); int h = MIN(_h, kScrHeight - pos.y); + if (pos.x < 0) { + w -= -pos.x; + pos.x = 0; + if (w < 0) + return; + } + if (pos.y < 0) { + h -= -pos.y; + pos.y = 0; + if (h < 0) + return; + } + // Perform copying of screen section 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); -- cgit v1.2.3