diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-12-27 00:05:12 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-12-27 23:15:05 +0300 |
commit | 0c34224ca4f6cbc21c24e2e6018ded03c6906c44 (patch) | |
tree | b1545b23727393b8b6e81c8b2d14d66e01af5072 /src/gui/serverdialog.cpp | |
parent | ee5cd2f31dcea97654288ec6c6a5c291fc11ddcb (diff) | |
download | plus-0c34224ca4f6cbc21c24e2e6018ded03c6906c44.tar.gz plus-0c34224ca4f6cbc21c24e2e6018ded03c6906c44.tar.bz2 plus-0c34224ca4f6cbc21c24e2e6018ded03c6906c44.tar.xz plus-0c34224ca4f6cbc21c24e2e6018ded03c6906c44.zip |
Improve servers list draw speed.
Diffstat (limited to 'src/gui/serverdialog.cpp')
-rw-r--r-- | src/gui/serverdialog.cpp | 26 |
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); } } } |