aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2019-07-01 14:45:34 +0200
committerEugene Sandulenko2019-09-03 17:17:06 +0200
commitd93e0a2d615f233e5a004723f3195ce86e0345ad (patch)
treea9395a0bbc2033777ae79d42151c4a58cd4d4072
parentf9c560fd9a5630e25280150dbeca049a9ffaec24 (diff)
downloadscummvm-rg350-d93e0a2d615f233e5a004723f3195ce86e0345ad.tar.gz
scummvm-rg350-d93e0a2d615f233e5a004723f3195ce86e0345ad.tar.bz2
scummvm-rg350-d93e0a2d615f233e5a004723f3195ce86e0345ad.zip
HDB: Clip to screen when rendering text. This prevents crash when aborting the cinematics
-rw-r--r--engines/hdb/draw-manager.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/engines/hdb/draw-manager.cpp b/engines/hdb/draw-manager.cpp
index 1b53a5e5d6..852718f101 100644
--- a/engines/hdb/draw-manager.cpp
+++ b/engines/hdb/draw-manager.cpp
@@ -572,7 +572,13 @@ void DrawMan::drawText(const char *string) {
// Blit the character
g_hdb->_drawMan->_globalSurface.transBlitFrom(_fontSurfaces[c], Common::Point(_cursorX, _cursorY), 0xf81f);
- g_system->copyRectToScreen(g_hdb->_drawMan->_globalSurface.getBasePtr(_cursorX, _cursorY), g_hdb->_drawMan->_globalSurface.pitch, _cursorX, _cursorY, width, _fontHeader.height);
+
+ Common::Rect clip(0, 0, width, _fontHeader.height);
+ clip.moveTo(_cursorX, _cursorY);
+ clip.clip(_globalSurface.getBounds());
+ if (!clip.isEmpty()) {
+ g_system->copyRectToScreen(g_hdb->_drawMan->_globalSurface.getBasePtr(clip.left, clip.top), g_hdb->_drawMan->_globalSurface.pitch, clip.left, clip.top, clip.width(), clip.height());
+ }
// Advance the cursor
_cursorX += width + _fontHeader.kerning + kFontIncrement;