aboutsummaryrefslogtreecommitdiff
path: root/engines/gob
diff options
context:
space:
mode:
authorSven Hesse2010-04-28 19:14:20 +0000
committerSven Hesse2010-04-28 19:14:20 +0000
commit89c0e30ddc3cd12d790da51c99a7d92d9e9739d0 (patch)
treeb45baea3d2a42f789d9d7630b9e72926c14c9f89 /engines/gob
parent9793430e58d0a29bbae3da24ab86a14d5504ef23 (diff)
downloadscummvm-rg350-89c0e30ddc3cd12d790da51c99a7d92d9e9739d0.tar.gz
scummvm-rg350-89c0e30ddc3cd12d790da51c99a7d92d9e9739d0.tar.bz2
scummvm-rg350-89c0e30ddc3cd12d790da51c99a7d92d9e9739d0.zip
Only draw letters that actually fit on the surface. Should fix bug #2992268 (Reproducible crash creating Intuition formula)
svn-id: r48829
Diffstat (limited to 'engines/gob')
-rw-r--r--engines/gob/draw.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/engines/gob/draw.cpp b/engines/gob/draw.cpp
index 75177ff02d..ff6d558998 100644
--- a/engines/gob/draw.cpp
+++ b/engines/gob/draw.cpp
@@ -384,7 +384,12 @@ void Draw::drawString(const char *str, int16 x, int16 y, int16 color1, int16 col
int16 transp, SurfaceDesc &dest, const Font &font) {
while (*str != '\0') {
- _vm->_video->drawLetter(*str, x, y, font, transp, color1, color2, dest);
+ const int16 charRight = x + font.getCharWidth(*str);
+ const int16 charBottom = y + font.getCharHeight();
+
+ if ((charRight <= dest.getWidth()) && (charBottom <= dest.getHeight()))
+ _vm->_video->drawLetter(*str, x, y, font, transp, color1, color2, dest);
+
x += font.getCharWidth(*str);
str++;
}