aboutsummaryrefslogtreecommitdiff
path: root/graphics
diff options
context:
space:
mode:
authorJohannes Schickel2013-08-06 22:59:59 +0200
committerNarek Mailian2013-08-22 11:46:50 +0200
commita2fabef87c3558a6407fb2f53e86b3b687a755f6 (patch)
tree2a1590b3151cbb005d442044e3050c93196762b4 /graphics
parentaf13b74d023c3f7880f1b06f427d3b69e5c8831e (diff)
downloadscummvm-rg350-a2fabef87c3558a6407fb2f53e86b3b687a755f6.tar.gz
scummvm-rg350-a2fabef87c3558a6407fb2f53e86b3b687a755f6.tar.bz2
scummvm-rg350-a2fabef87c3558a6407fb2f53e86b3b687a755f6.zip
GRAPHICS: Increase robustness of VectorRendererSpec::drawString.
Diffstat (limited to 'graphics')
-rw-r--r--graphics/VectorRendererSpec.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/graphics/VectorRendererSpec.cpp b/graphics/VectorRendererSpec.cpp
index e68242575e..280bd6ec76 100644
--- a/graphics/VectorRendererSpec.cpp
+++ b/graphics/VectorRendererSpec.cpp
@@ -738,7 +738,12 @@ drawString(const Graphics::Font *font, const Common::String &text, const Common:
// the text (area).
drawArea = textDrawableArea.findIntersectingRect(area);
}
-
+
+ // Better safe than sorry. We intersect with the actual surface boundaries
+ // to avoid any ugly clipping in _activeSurface->getSubArea which messes
+ // up the calculation of the x and y coordinates where to draw the string.
+ drawArea = drawArea.findIntersectingRect(Common::Rect(0, 0, _activeSurface->w, _activeSurface->h));
+
if (!drawArea.isEmpty()) {
Surface textAreaSurface = _activeSurface->getSubArea(drawArea);
font->drawString(&textAreaSurface, text, area.left - drawArea.left, offset - drawArea.top, area.width() - deltax, _fgColor, alignH, deltax, ellipsis);