aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2019-12-26 18:45:30 +0100
committerEugene Sandulenko2019-12-26 18:45:30 +0100
commit4512845d58d048598a7824a000cef526cb8ef757 (patch)
tree49059bc2e389178016b6378f0f48226055f2122b
parent95f02a8f9a3de18fc42b3cc379fbb56b1218f9a5 (diff)
downloadscummvm-rg350-4512845d58d048598a7824a000cef526cb8ef757.tar.gz
scummvm-rg350-4512845d58d048598a7824a000cef526cb8ef757.tar.bz2
scummvm-rg350-4512845d58d048598a7824a000cef526cb8ef757.zip
GRAPHICS: MACGUI: Fix incorrect text dimension calculations
-rw-r--r--graphics/macgui/mactext.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index cb520652b6..0df403ac8c 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -349,7 +349,9 @@ void MacText::render(int from, int to) {
// TODO: _textMaxWidth, when -1, was not rendering ANY text.
for (uint j = 0; j < _textLines[i].chunks.size(); j++) {
- debug(9, "MacText::render: line %d[%d]/%d at %d,%d (%s)", i, j, xOffset, _textLines[i].chunks[j].fontId, _textLines[i].y, _textLines[i].chunks[j].text.encode().c_str());
+ debug(9, "MacText::render: line %d[%d] h:%d at %d,%d (%s) fontid: %d on %dx%d",
+ i, j, xOffset, _textLines[i].y, _textLines[i].height, _textLines[i].chunks[j].text.encode().c_str(),
+ _textLines[i].chunks[j].fontId, _surface->w, _surface->h);
if (_textLines[i].chunks[j].text.empty())
continue;
@@ -426,8 +428,10 @@ void MacText::recalcDims() {
for (uint i = 0; i < _textLines.size(); i++) {
_textLines[i].y = y;
- y += getLineHeight(i) + _interLinear;
+ // We must calculate width first, because it enforces
+ // the computation. Calling Height() will return cached value!
_textMaxWidth = MAX(_textMaxWidth, getLineWidth(i, true));
+ y += getLineHeight(i) + _interLinear;
}
_textMaxHeight = y - _interLinear;