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/shoplistbox.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/gui/widgets/shoplistbox.cpp') 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(mAlpha * 255.0f); - Graphics *graphics = static_cast(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); } -- cgit v1.2.3-60-g2f50