From 60add2c149c9c61bfbede5ae92cfe216927aca8a Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 27 Dec 2012 14:42:15 +0300 Subject: Improve a bit draw speed in other controls. --- src/gui/viewport.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/gui/viewport.cpp') diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index df5fe4353..ada563b8d 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -49,6 +49,8 @@ #include "resources/resourcemanager.h" +#include + #include "debug.h" extern volatile int tick_time; @@ -358,6 +360,8 @@ void Viewport::_drawPath(Graphics *const graphics, const Path &path, { graphics->setColor(color); + gcn::Font *const font = getFont(); + #ifdef MANASERV_SUPPORT if (Net::getNetworkType() != ServerInfo::MANASERV) #endif @@ -372,8 +376,9 @@ void Viewport::_drawPath(Graphics *const graphics, const Path &path, graphics->fillRectangle(gcn::Rectangle(squareX, squareY, 8, 8)); if (mMap) { - graphics->drawText(toString(cnt), - squareX + 4, squareY + 12, gcn::Graphics::CENTER); + const std::string str = toString(cnt); + font->drawString(graphics, str, squareX + 4 + - font->getWidth(str) / 2, squareY + 12); } cnt ++; } @@ -391,9 +396,10 @@ void Viewport::_drawPath(Graphics *const graphics, const Path &path, 8, 8)); if (mMap) { - graphics->drawText( - toString(mMap->getMetaTile(i->x / 32, i->y / 32)->Gcost), - squareX + 4, squareY + 12, gcn::Graphics::CENTER); + const std::string str = toString(mMap->getMetaTile( + i->x / 32, i->y / 32)->Gcost); + font->drawString(graphics, str, + squareX + 4 - font->getWidth(text) / 2, squareY + 12); } } } -- cgit v1.2.3-70-g09d2