summaryrefslogtreecommitdiff
path: root/src/gui/widgets/itemcontainer.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-12-27 01:09:30 +0300
committerAndrei Karas <akaras@inbox.ru>2012-12-27 23:15:05 +0300
commit81d317cf80f4c333396c708bbefca16be2362c8c (patch)
tree1bd2818130625873c50ecbda9b3e826e51c809bb /src/gui/widgets/itemcontainer.cpp
parente56ea6cbf7726b258a4eb6b51a0574cddd862558 (diff)
downloadplus-81d317cf80f4c333396c708bbefca16be2362c8c.tar.gz
plus-81d317cf80f4c333396c708bbefca16be2362c8c.tar.bz2
plus-81d317cf80f4c333396c708bbefca16be2362c8c.tar.xz
plus-81d317cf80f4c333396c708bbefca16be2362c8c.zip
Improve containders text draw speed.
Diffstat (limited to 'src/gui/widgets/itemcontainer.cpp')
-rw-r--r--src/gui/widgets/itemcontainer.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index 6e9ce1657..ffb6c590f 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -43,6 +43,7 @@
#include "resources/image.h"
+#include <guichan/font.hpp>
#include <guichan/mouseinput.hpp>
#include <guichan/selectionlistener.hpp>
@@ -234,8 +235,8 @@ void ItemContainer::draw(gcn::Graphics *graphics)
BLOCK_START("ItemContainer::draw")
Graphics *const g = static_cast<Graphics *const>(graphics);
-
- g->setFont(getFont());
+ gcn::Font *const font = getFont();
+ g->setFont(font);
for (int j = 0; j < mGridRows; j++)
{
@@ -315,8 +316,9 @@ void ItemContainer::draw(gcn::Graphics *graphics)
else
g->setColor(mUnEquipedColor);
- g->drawText(caption, itemX + mBoxWidth / 2,
- itemY + mEquippedTextPadding, gcn::Graphics::CENTER);
+ font->drawString(g, caption,
+ itemX + (mBoxWidth - font->getWidth(caption)) / 2,
+ itemY + mEquippedTextPadding);
}
}
BLOCK_END("ItemContainer::draw")