aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2017-02-02 09:18:08 +0100
committerEugene Sandulenko2017-02-02 09:18:08 +0100
commit255c76b3acce13a17a11a0022e10706e9c0045d3 (patch)
treec0eb8d7ed5700363413c9fdca92bbd0466615b81
parent29f913289cd059ecfc7bed61b6faa635c4ace3a9 (diff)
downloadscummvm-rg350-255c76b3acce13a17a11a0022e10706e9c0045d3.tar.gz
scummvm-rg350-255c76b3acce13a17a11a0022e10706e9c0045d3.tar.bz2
scummvm-rg350-255c76b3acce13a17a11a0022e10706e9c0045d3.zip
GRAPHICS: Optimize for empty substrings in MacText
-rw-r--r--graphics/macgui/mactext.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index 84db1c2b4a..0201b19abd 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -162,7 +162,7 @@ void MacText::splitString(Common::String &str) {
curChunk = 0;
}
} else {
- if (nextChunk && 0) { // No text, replacing formatting
+ if (nextChunk) { // No text, replacing formatting
_textLines[curLine].chunks[curChunk] = _currentFormatting;
}
}
@@ -248,6 +248,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++) {
+ 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);
xOffset += _textLines[i].chunks[j].getFont()->getStringWidth(_textLines[i].chunks[j].text);
}