diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-12-27 01:22:21 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-12-27 23:15:05 +0300 |
commit | 2babe1d6491f5231b0e97349ccb198b92bb90ba9 (patch) | |
tree | 3db30d7bff509ec233ba91ee14f55ea95ebb159c /src/gui/widgets/listbox.cpp | |
parent | 81d317cf80f4c333396c708bbefca16be2362c8c (diff) | |
download | mv-2babe1d6491f5231b0e97349ccb198b92bb90ba9.tar.gz mv-2babe1d6491f5231b0e97349ccb198b92bb90ba9.tar.bz2 mv-2babe1d6491f5231b0e97349ccb198b92bb90ba9.tar.xz mv-2babe1d6491f5231b0e97349ccb198b92bb90ba9.zip |
Improve draw speed in listboxes.
Diffstat (limited to 'src/gui/widgets/listbox.cpp')
-rw-r--r-- | src/gui/widgets/listbox.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
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<int>(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); } } |