GRAPHICS: MACGUI: Use proper width when rendering MacText

This commit is contained in:
Eugene Sandulenko 2019-12-26 17:58:52 +01:00
parent 97abe323c4
commit 95f02a8f9a

View File

@ -335,6 +335,8 @@ void MacText::render(int from, int to) {
from = MAX<int>(0, from);
to = MIN<int>(to, _textLines.size() - 1);
int w = MIN(_maxWidth, _textMaxWidth);
// Clear the screen
_surface->fillRect(Common::Rect(0, _textLines[from].y, _surface->w, _textLines[to].y + getLineHeight(to)), _bgcolor);
@ -352,7 +354,7 @@ void MacText::render(int from, int to) {
if (_textLines[i].chunks[j].text.empty())
continue;
_textLines[i].chunks[j].getFont()->drawString(_surface, _textLines[i].chunks[j].text, xOffset, _textLines[i].y, _maxWidth, _fgcolor);
_textLines[i].chunks[j].getFont()->drawString(_surface, _textLines[i].chunks[j].text, xOffset, _textLines[i].y, w, _fgcolor);
xOffset += _textLines[i].chunks[j].getFont()->getStringWidth(_textLines[i].chunks[j].text);
}
}