diff options
-rw-r--r-- | engines/sci/graphics/paint32.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/engines/sci/graphics/paint32.cpp b/engines/sci/graphics/paint32.cpp index f94c65c76b..7d106b5b02 100644 --- a/engines/sci/graphics/paint32.cpp +++ b/engines/sci/graphics/paint32.cpp @@ -43,8 +43,12 @@ GfxPaint32::~GfxPaint32() { void GfxPaint32::fillRect(Common::Rect rect, byte color) { int16 y, x; - for (y = rect.top; y < rect.bottom; y++) { - for (x = rect.left; x < rect.right; x++) { + Common::Rect clipRect = rect; + + clipRect.clip(_screen->getWidth(), _screen->getHeight()); + + for (y = clipRect.top; y < clipRect.bottom; y++) { + for (x = clipRect.left; x < clipRect.right; x++) { _screen->putPixel(x, y, GFX_SCREEN_MASK_VISUAL, color, 0, 0); } } |