summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-12-27 00:05:12 +0300
committerAndrei Karas <akaras@inbox.ru>2012-12-27 23:15:05 +0300
commit0c34224ca4f6cbc21c24e2e6018ded03c6906c44 (patch)
treeb1545b23727393b8b6e81c8b2d14d66e01af5072 /src
parentee5cd2f31dcea97654288ec6c6a5c291fc11ddcb (diff)
downloadmanaplus-0c34224ca4f6cbc21c24e2e6018ded03c6906c44.tar.gz
manaplus-0c34224ca4f6cbc21c24e2e6018ded03c6906c44.tar.bz2
manaplus-0c34224ca4f6cbc21c24e2e6018ded03c6906c44.tar.xz
manaplus-0c34224ca4f6cbc21c24e2e6018ded03c6906c44.zip
Improve servers list draw speed.
Diffstat (limited to 'src')
-rw-r--r--src/gui/serverdialog.cpp26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp
index 220f0c1b3..926b9332a 100644
--- a/src/gui/serverdialog.cpp
+++ b/src/gui/serverdialog.cpp
@@ -189,6 +189,12 @@ public:
height));
}
+ gcn::Font *const font1 = boldFont;
+ gcn::Font *const font2 = getFont();
+ const int fontHeight = font1->getHeight();
+ const int pad1 = fontHeight + mPadding;
+ const int pad2 = height / 4 + mPadding;
+ const int width = getWidth();
// Draw the list elements
for (int i = 0, y = 0; i < model->getNumberOfElements();
++i, y += height)
@@ -205,28 +211,24 @@ public:
if (!info.name.empty())
{
- graphics->setFont(boldFont);
- x += boldFont->getWidth(info.name) + 15;
- graphics->drawText(info.name, mPadding, y + mPadding);
- top = y + boldFont->getHeight() + mPadding;
+ x += font1->getWidth(info.name) + 15;
+ font1->drawString(graphics, info.name, mPadding, y + mPadding);
+ top = y + pad1;
}
else
{
- top = y + height / 4 + mPadding;
+ top = y + pad2;
}
- graphics->setFont(getFont());
-
if (!info.description.empty())
- graphics->drawText(info.description, x, y + mPadding);
- graphics->drawText(model->getElementAt(i), mPadding, top);
+ font2->drawString(graphics, info.description, x, y + mPadding);
+ font2->drawString(graphics, model->getElementAt(i), mPadding, top);
if (info.version.first > 0)
{
graphics->setColor(mNotSupportedColor);
-
- graphics->drawText(info.version.second,
- getWidth() - info.version.first - mPadding, top);
+ font2->drawString(graphics, info.version.second,
+ width - info.version.first - mPadding, top);
}
}
}