diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-09-15 23:05:16 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-09-15 23:05:16 +0300 |
commit | b162094c7609fa37f2eef6be3fed0e26830bc506 (patch) | |
tree | 072b83f0ce6b7f871acd9a2d2c6c49b8dac7dc64 /src/gui/widgets/shoplistbox.cpp | |
parent | 4031a5068859fb99f604dfecceb2fb1c954e166f (diff) | |
download | manaplus-b162094c7609fa37f2eef6be3fed0e26830bc506.tar.gz manaplus-b162094c7609fa37f2eef6be3fed0e26830bc506.tar.bz2 manaplus-b162094c7609fa37f2eef6be3fed0e26830bc506.tar.xz manaplus-b162094c7609fa37f2eef6be3fed0e26830bc506.zip |
Improve a bit widgets speed.
Diffstat (limited to 'src/gui/widgets/shoplistbox.cpp')
-rw-r--r-- | src/gui/widgets/shoplistbox.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp index 0bd126482..480f220ea 100644 --- a/src/gui/widgets/shoplistbox.cpp +++ b/src/gui/widgets/shoplistbox.cpp @@ -55,7 +55,7 @@ ShopListBox::ShopListBox(gcn::ListModel *const listModel) : mBackgroundColor(Theme::getThemeColor(Theme::BACKGROUND)), mWarningColor(Theme::getThemeColor(Theme::SHOP_WARNING)) { - setForegroundColor(Theme::getThemeColor(Theme::LISTBOX)); + mForegroundColor = Theme::getThemeColor(Theme::LISTBOX); } ShopListBox::ShopListBox(gcn::ListModel *const listModel, @@ -70,7 +70,7 @@ ShopListBox::ShopListBox(gcn::ListModel *const listModel, mBackgroundColor(Theme::getThemeColor(Theme::BACKGROUND)), mWarningColor(Theme::getThemeColor(Theme::SHOP_WARNING)) { - setForegroundColor(Theme::getThemeColor(Theme::LISTBOX)); + mForegroundColor = Theme::getThemeColor(Theme::LISTBOX); } void ShopListBox::init() @@ -91,12 +91,11 @@ void ShopListBox::draw(gcn::Graphics *gcnGraphics) mAlpha = Client::getGuiAlpha(); const int alpha = static_cast<int>(mAlpha * 255.0f); - mHighlightColor.a = alpha; Graphics *graphics = static_cast<Graphics*>(gcnGraphics); graphics->setFont(getFont()); - graphics->setColor(getForegroundColor()); +// graphics->setColor(mForegroundColor); // Draw the list elements for (int i = 0, y = 0; @@ -106,7 +105,6 @@ void ShopListBox::draw(gcn::Graphics *gcnGraphics) bool needDraw(false); gcn::Color temp; gcn::Color* backgroundColor = &mBackgroundColor; - mBackgroundColor.a = alpha; if (mShopItems && mShopItems->at(i) && mPlayerMoney < mShopItems->at(i)->getPrice() && mPriceCheck) @@ -129,9 +127,14 @@ void ShopListBox::draw(gcn::Graphics *gcnGraphics) } else if (i == mSelected) { + mHighlightColor.a = alpha; backgroundColor = &mHighlightColor; needDraw = true; } + else + { + mBackgroundColor.a = alpha; + } if (needDraw) { @@ -149,7 +152,7 @@ void ShopListBox::draw(gcn::Graphics *gcnGraphics) graphics->drawImage(icon, 1, y); } } - graphics->setColor(getForegroundColor()); + graphics->setColor(mForegroundColor); graphics->drawText(mListModel->getElementAt(i), ITEM_ICON_SIZE + 5, y + (ITEM_ICON_SIZE - getFont()->getHeight()) / 2); } |