From 5adcad73b15aafa56ef77c794bf7ebfeff28049b Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 1 Oct 2012 03:34:08 +0300 Subject: Improve emotes window draw speed. --- src/gui/widgets/itemcontainer.cpp | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) (limited to 'src/gui/widgets/itemcontainer.cpp') diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index 854d055d2..4ccfb566f 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -263,6 +263,27 @@ void ItemContainer::draw(gcn::Graphics *graphics) image->setAlpha(1.0f); // ensure the image if fully drawn... g->drawImage(image, itemX, itemY); } + } + } + + for (int j = 0; j < mGridRows; j++) + { + const int intY0 = j * BOX_HEIGHT; + int itemIndex = j * mGridColumns - 1; + for (int i = 0; i < mGridColumns; i++) + { + int itemX = i * BOX_WIDTH; + int itemY = intY0; + itemIndex ++; + if (mShowMatrix[itemIndex] < 0) + continue; + + const Item *const item = mInventory->getItem( + mShowMatrix[itemIndex]); + + if (!item || item->getId() == 0) + continue; + // Draw item caption std::string caption; if (item->getQuantity() > 1 || mForceQuantity) @@ -279,17 +300,6 @@ void ItemContainer::draw(gcn::Graphics *graphics) itemY + BOX_HEIGHT - 14, gcn::Graphics::CENTER); } } - -/* - // Draw an orange box around the selected item - if (isFocused() && mHighlightedIndex != -1 && mGridColumns) - { - const int itemX = (mHighlightedIndex % mGridColumns) * BOX_WIDTH; - const int itemY = (mHighlightedIndex / mGridColumns) * BOX_HEIGHT; - g->setColor(gcn::Color(255, 128, 0)); - g->drawRectangle(gcn::Rectangle(itemX, itemY, BOX_WIDTH, BOX_HEIGHT)); - } -*/ } void ItemContainer::selectNone() -- cgit v1.2.3-70-g09d2