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...
This commit is contained in:
Johannes Schickel 2013-08-06 22:31:36 +02:00 committed by Narek Mailian
parent 81ae06cae3
commit af13b74d02

View File

@ -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);
}
}