From 2babe1d6491f5231b0e97349ccb198b92bb90ba9 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 27 Dec 2012 01:22:21 +0300 Subject: Improve draw speed in listboxes. --- src/gui/widgets/listbox.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/gui/widgets/listbox.cpp') diff --git a/src/gui/widgets/listbox.cpp b/src/gui/widgets/listbox.cpp index 87ecc9460..dbd54f3f3 100644 --- a/src/gui/widgets/listbox.cpp +++ b/src/gui/widgets/listbox.cpp @@ -92,7 +92,8 @@ void ListBox::draw(gcn::Graphics *graphics) mHighlightColor.a = static_cast(mAlpha * 255.0f); graphics->setColor(mHighlightColor); - graphics->setFont(getFont()); + gcn::Font *const font = getFont(); + graphics->setFont(font); const int height = getRowHeight(); @@ -107,7 +108,7 @@ void ListBox::draw(gcn::Graphics *graphics) if (sel >= 0) { graphics->setColor(mForegroundSelectedColor); - graphics->drawText(mListModel->getElementAt(sel), + font->drawString(graphics, mListModel->getElementAt(sel), mPadding, sel * height + mPadding); } // Draw the list elements @@ -117,7 +118,7 @@ void ListBox::draw(gcn::Graphics *graphics) { if (i != sel) { - graphics->drawText(mListModel->getElementAt(i), + font->drawString(graphics, mListModel->getElementAt(i), mPadding, y + mPadding); } } -- cgit v1.2.3-60-g2f50