diff options
author | Eugene Sandulenko | 2016-12-20 21:19:13 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2016-12-20 21:49:29 +0100 |
commit | 88b9dd3472883de36acd4d6fdc7fd6d097328808 (patch) | |
tree | 5b4ce9bdabaa70694d7116218c2ea574d627b8bb /graphics/macgui | |
parent | 2d6c582805105f78901d7f88a77510a79e3b65a1 (diff) | |
download | scummvm-rg350-88b9dd3472883de36acd4d6fdc7fd6d097328808.tar.gz scummvm-rg350-88b9dd3472883de36acd4d6fdc7fd6d097328808.tar.bz2 scummvm-rg350-88b9dd3472883de36acd4d6fdc7fd6d097328808.zip |
GRAPHICS: Simplify MacText
Diffstat (limited to 'graphics/macgui')
-rw-r--r-- | graphics/macgui/mactext.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp index 412ddae640..2af31a9efd 100644 --- a/graphics/macgui/mactext.cpp +++ b/graphics/macgui/mactext.cpp @@ -70,7 +70,7 @@ void MacText::splitString(Common::String &str) { tmp += *s; } - if (_text.size()) + if (tmp.size()) _maxWidth = MIN(_font->wordWrapText(tmp, _maxWidth, _text), _maxWidth); } @@ -98,10 +98,6 @@ void MacText::reallocSurface() { void MacText::render() { if (_fullRefresh) { - reallocSurface(); - - _surface->clear(_bgcolor); - render(0, _text.size()); _fullRefresh = false; @@ -109,6 +105,8 @@ void MacText::render() { } void MacText::render(int from, int to) { + reallocSurface(); + from = MAX<int>(0, from); to = MIN<int>(to, _text.size()); @@ -133,8 +131,9 @@ void MacText::draw(ManagedSurface *g, int x, int y, int w, int h, int xoff, int g->fillRect(Common::Rect(x, y, x + w, y + w), _bgcolor); } - g->blitFrom(*_surface, Common::Rect(MIN<int>(_surface->w, x), MIN<int>(_surface->h, y), - MIN<int>(_surface->w, x + w), MIN<int>(_surface->w, y + w)), Common::Point(xoff, yoff)); + g->blitFrom(*_surface, Common::Rect(MIN<int>(_surface->w, x), MIN<int>(_surface->h, y), + MIN<int>(_surface->w, x + w), MIN<int>(_surface->w, y + w)), + Common::Point(xoff, yoff)); } void MacText::appendText(Common::String str) { @@ -142,8 +141,6 @@ void MacText::appendText(Common::String str) { splitString(str); - reallocSurface(); - render(oldLen + 1, _text.size()); } |