From af13b74d023c3f7880f1b06f427d3b69e5c8831e Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 6 Aug 2013 22:31:36 +0200 Subject: 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... --- graphics/VectorRendererSpec.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'graphics/VectorRendererSpec.cpp') 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); } } -- cgit v1.2.3