diff options
author | Johannes Schickel | 2013-08-06 22:31:36 +0200 |
---|---|---|
committer | Narek Mailian | 2013-08-22 11:46:49 +0200 |
commit | af13b74d023c3f7880f1b06f427d3b69e5c8831e (patch) | |
tree | a753f3a54a91d69f1ce1eb3bfb562e3bf3775b00 | |
parent | 81ae06cae36a398c4126cfa80022677703e9ab57 (diff) | |
download | scummvm-rg350-af13b74d023c3f7880f1b06f427d3b69e5c8831e.tar.gz scummvm-rg350-af13b74d023c3f7880f1b06f427d3b69e5c8831e.tar.bz2 scummvm-rg350-af13b74d023c3f7880f1b06f427d3b69e5c8831e.zip |
GRAPHICS: Unify drawing paths in VectorRendererSpec::drawString.
Formerly, the behavior between when a drawable area was specified and when not
was different in a sense which is not expected. For example, when an empty
textDrawableArea was passed and the text could be drawn outside the 'area'
specified. While when a textDrawableArea covering the whole screen was passed
the text was clipped inside 'area'. Now, the code does follow the latter logic
in both cases.
I am not sure whether this will cause any issues, but a quick check of the
launcher and options menu didn't reveal anything...
-rw-r--r-- | graphics/VectorRendererSpec.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/graphics/VectorRendererSpec.cpp b/graphics/VectorRendererSpec.cpp index 73fcee10e6..e68242575e 100644 --- a/graphics/VectorRendererSpec.cpp +++ b/graphics/VectorRendererSpec.cpp @@ -726,19 +726,22 @@ drawString(const Graphics::Font *font, const Common::String &text, const Common: } } + Common::Rect drawArea; if (textDrawableArea.isEmpty()) { - font->drawString(_activeSurface, text, area.left, offset, area.width() - deltax, _fgColor, alignH, deltax, ellipsis); + // In case no special area to draw to is given we only draw in the + // area specified by the user. + drawArea = area; // warning("there is no text drawable area. Please set this area for clipping"); } else { // The area we can draw to is the intersection between the allowed // drawing area (textDrawableArea) and the area where we try to draw // the text (area). - Common::Rect drawArea = textDrawableArea.findIntersectingRect(area); - - 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); - } + drawArea = textDrawableArea.findIntersectingRect(area); + } + + 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); } } |