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/shoplistbox.cpp | |
parent | 81d317cf80f4c333396c708bbefca16be2362c8c (diff) | |
download | plus-2babe1d6491f5231b0e97349ccb198b92bb90ba9.tar.gz plus-2babe1d6491f5231b0e97349ccb198b92bb90ba9.tar.bz2 plus-2babe1d6491f5231b0e97349ccb198b92bb90ba9.tar.xz plus-2babe1d6491f5231b0e97349ccb198b92bb90ba9.zip |
Improve draw speed in listboxes.
Diffstat (limited to 'src/gui/widgets/shoplistbox.cpp')
-rw-r--r-- | src/gui/widgets/shoplistbox.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp index 1dd58532e..11f350165 100644 --- a/src/gui/widgets/shoplistbox.cpp +++ b/src/gui/widgets/shoplistbox.cpp @@ -95,10 +95,9 @@ void ShopListBox::draw(gcn::Graphics *gcnGraphics) mAlpha = Client::getGuiAlpha(); const int alpha = static_cast<int>(mAlpha * 255.0f); - Graphics *graphics = static_cast<Graphics*>(gcnGraphics); - - graphics->setFont(getFont()); + gcn::Font *const font = getFont(); + graphics->setFont(font); // Draw the list elements for (int i = 0, y = 0; @@ -159,7 +158,7 @@ void ShopListBox::draw(gcn::Graphics *gcnGraphics) graphics->setColor(mForegroundSelectedColor); else graphics->setColor(mForegroundColor); - graphics->drawText(mListModel->getElementAt(i), + font->drawString(graphics, mListModel->getElementAt(i), ITEM_ICON_SIZE + mPadding, y + (ITEM_ICON_SIZE - getFont()->getHeight()) / 2 + mPadding); } |