aboutsummaryrefslogtreecommitdiff
path: root/engines/gob/driver_vga.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/gob/driver_vga.cpp')
-rw-r--r--engines/gob/driver_vga.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/engines/gob/driver_vga.cpp b/engines/gob/driver_vga.cpp
index 759136180e..4923387ef8 100644
--- a/engines/gob/driver_vga.cpp
+++ b/engines/gob/driver_vga.cpp
@@ -105,8 +105,8 @@ void VGAVideoDriver::drawSprite(SurfaceDesc *source, SurfaceDesc *dest,
(y >= dest->getHeight()) || (y < 0))
return;
- int16 width = (right - left) + 1;
- int16 height = (bottom - top) + 1;
+ int16 width = MIN((right - left) + 1, (int) dest->getWidth());
+ int16 height = MIN((bottom - top) + 1, (int) dest->getHeight());
byte *srcPos = source->getVidMem() + (top * source->getWidth()) + left;
byte *destPos = dest->getVidMem() + (y * dest->getWidth()) + x;