diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-12-27 00:14:17 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-12-27 23:15:05 +0300 |
commit | e56ea6cbf7726b258a4eb6b51a0574cddd862558 (patch) | |
tree | 5b5fe42389d3c67a6b30f222b92bac5e303a0b32 /src | |
parent | 0c34224ca4f6cbc21c24e2e6018ded03c6906c44 (diff) | |
download | mv-e56ea6cbf7726b258a4eb6b51a0574cddd862558.tar.gz mv-e56ea6cbf7726b258a4eb6b51a0574cddd862558.tar.bz2 mv-e56ea6cbf7726b258a4eb6b51a0574cddd862558.tar.xz mv-e56ea6cbf7726b258a4eb6b51a0574cddd862558.zip |
Improve a bit equipment window draw speed.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/equipmentwindow.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp index 54eaaf58d..cb0577783 100644 --- a/src/gui/equipmentwindow.cpp +++ b/src/gui/equipmentwindow.cpp @@ -151,7 +151,8 @@ void EquipmentWindow::draw(gcn::Graphics *graphics) Graphics *const g = static_cast<Graphics*>(graphics); int i = 0; - const int fontHeight = getFont()->getHeight(); + gcn::Font *const font = getFont(); + const int fontHeight = font->getHeight(); if (openGLMode != 2) { @@ -220,9 +221,10 @@ void EquipmentWindow::draw(gcn::Graphics *graphics) if (i == EQUIP_PROJECTILE_SLOT) { g->setColor(mLabelsColor); - graphics->drawText(toString(item->getQuantity()), - box->x + (mBoxSize / 2), box->y - fontHeight, - gcn::Graphics::CENTER); + const std::string str = toString(item->getQuantity()); + font->drawString(g, str, + box->x + (mBoxSize - font->getWidth(str)) / 2, + box->y - fontHeight); } } } |