Skip to content

Commit

Permalink
GRAPHICS: Unify drawing paths in VectorRendererSpec::drawString.
Browse files Browse the repository at this point in the history
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...
  • Loading branch information
Johannes Schickel authored and rundfunk47 committed Aug 22, 2013
1 parent 81ae06c commit af13b74
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions graphics/VectorRendererSpec.cpp
Expand Up @@ -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);
}
}

Expand Down

0 comments on commit af13b74

Please sign in to comment.