Improve ui::drawTextBox() performance

This commit is contained in:
David Capello 2016-11-22 13:33:01 -03:00
parent 0ed0ad287c
commit 0d169fed75

View File

@ -109,6 +109,10 @@ void drawTextBox(Graphics* g, Widget* widget,
x2 = vp.x + vp.w; x2 = vp.x + vp.w;
y2 = vp.y + vp.h; y2 = vp.y + vp.h;
// Fill background
if (g)
g->fillRect(bg, vp);
chr = 0; chr = 0;
// Without word-wrap // Without word-wrap
@ -202,11 +206,7 @@ void drawTextBox(Graphics* g, Widget* widget,
else // Left align else // Left align
xout = x; xout = x;
g->drawUIString(beg, fg, bg, gfx::Point(xout, y)); g->drawUIString(beg, fg, gfx::ColorNone, gfx::Point(xout, y));
g->fillAreaBetweenRects(
bg,
gfx::Rect(x1, y, x2 - x1, textheight),
gfx::Rect(xout, y, len, textheight));
} }
if (w) if (w)
@ -225,10 +225,6 @@ void drawTextBox(Graphics* g, Widget* widget,
if (w) *w += widget->border().width(); if (w) *w += widget->border().width();
if (h) *h += widget->border().height(); if (h) *h += widget->border().height();
// Fill bottom area
if (g && y < y2)
g->fillRect(bg, gfx::Rect(x1, y, x2 - x1, y2 - y));
} }
} // namespace ui } // namespace ui