From e56ea6cbf7726b258a4eb6b51a0574cddd862558 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 27 Dec 2012 00:14:17 +0300 Subject: Improve a bit equipment window draw speed. --- src/gui/equipmentwindow.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') 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); 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); } } } -- cgit v1.2.3-70-g09d2