diff options
author | Sven Hesse | 2010-04-28 19:14:20 +0000 |
---|---|---|
committer | Sven Hesse | 2010-04-28 19:14:20 +0000 |
commit | 89c0e30ddc3cd12d790da51c99a7d92d9e9739d0 (patch) | |
tree | b45baea3d2a42f789d9d7630b9e72926c14c9f89 /engines/gob | |
parent | 9793430e58d0a29bbae3da24ab86a14d5504ef23 (diff) | |
download | scummvm-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.cpp | 7 |
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++; } |