From 04f47f060f94ec0e2dfc3cccf62cff167e0ecd68 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 22 Jun 2014 15:55:34 +0300 Subject: Reoder some text and image drawing for better batching. --- src/gui/widgets/avatarlistbox.cpp | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'src/gui/widgets/avatarlistbox.cpp') diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp index a9ef12c99..ae7a745bc 100644 --- a/src/gui/widgets/avatarlistbox.cpp +++ b/src/gui/widgets/avatarlistbox.cpp @@ -146,6 +146,23 @@ void AvatarListBox::draw(Graphics *graphics) } } } + } + + if (useCaching) + { + graphics->finalize(&vertexes); + graphics->drawTileCollection(&vertexes); + } + + graphics->setColorAll(mForegroundColor, mForegroundColor2); + + for (int i = 0, y = 0; + i < model->getNumberOfElements(); + ++i, y += fontHeight) + { + const Avatar *const a = model->getAvatarAt(i); + if (!a) + continue; std::string text; @@ -281,8 +298,6 @@ void AvatarListBox::draw(Graphics *graphics) } } - graphics->setColorAll(mForegroundColor, mForegroundColor2); - // Draw Name if (a->getDisplayBold()) { @@ -312,12 +327,6 @@ void AvatarListBox::draw(Graphics *graphics) } } - if (useCaching) - { - graphics->finalize(&vertexes); - graphics->drawTileCollection(&vertexes); - } - setWidth(parent->getWidth() - 10); BLOCK_END("AvatarListBox::draw") } -- cgit v1.2.3-70-g09d2