aboutsummaryrefslogtreecommitdiff
path: root/engines/wage/gui.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/wage/gui.cpp')
-rw-r--r--engines/wage/gui.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp
index 212e75be48..cd259e6ddd 100644
--- a/engines/wage/gui.cpp
+++ b/engines/wage/gui.cpp
@@ -220,8 +220,19 @@ void Gui::draw() {
_wm.draw();
if (_cursorDirty && _cursorRect.left < _screen.w && _cursorRect.bottom < _screen.h) {
- g_system->copyRectToScreen(_screen.getBasePtr(_cursorRect.left, _cursorRect.top), _screen.pitch,
- _cursorRect.left, _cursorRect.top, _cursorRect.width(), _cursorRect.height());
+ int x = _cursorRect.left, y = _cursorRect.top, w = _cursorRect.width(), h = _cursorRect.height();
+ if (x < 0) {
+ w += x;
+ x = 0;
+ }
+ if (y < 0) {
+ h += y;
+ y = 0;
+ }
+ if (x + w > _screen.w) w = _screen.w - x;
+ if (y + h > _screen.h) h = _screen.h - y;
+ if (w != 0 && h != 0)
+ g_system->copyRectToScreen(_screen.getBasePtr(x, y), _screen.pitch, x, y, w, h);
_cursorDirty = false;
}