diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-05-25 01:58:52 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-05-25 01:58:52 +0300 |
commit | e3682e2cdcb59c36792f6f9c39569e0af01088f0 (patch) | |
tree | b4d7a665652e4a8c00f28d557f96b120abc62002 /src/gui/widgets/serverslistbox.h | |
parent | 1b3a9751ae558e45c614f04525d5ff65e3c0fc1e (diff) | |
download | mv-e3682e2cdcb59c36792f6f9c39569e0af01088f0.tar.gz mv-e3682e2cdcb59c36792f6f9c39569e0af01088f0.tar.bz2 mv-e3682e2cdcb59c36792f6f9c39569e0af01088f0.tar.xz mv-e3682e2cdcb59c36792f6f9c39569e0af01088f0.zip |
Dont set global color variables before drawing text.
This allow not set actual OpenGL color on each call
because it useless for drawing text.
Diffstat (limited to 'src/gui/widgets/serverslistbox.h')
-rw-r--r-- | src/gui/widgets/serverslistbox.h | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/src/gui/widgets/serverslistbox.h b/src/gui/widgets/serverslistbox.h index a16547cd1..cd94e10bc 100644 --- a/src/gui/widgets/serverslistbox.h +++ b/src/gui/widgets/serverslistbox.h @@ -80,14 +80,17 @@ class ServersListBox final : public ListBox { const ServerInfo &info = model->getServer(i); + const Color *color1; + const Color *color2; if (mSelected == i) { - graphics->setColorAll(mForegroundSelectedColor, - mForegroundSelectedColor2); + color1 = &mForegroundSelectedColor; + color2 = &mForegroundSelectedColor2; } else { - graphics->setColorAll(mForegroundColor, mForegroundColor2); + color1 = &mForegroundColor; + color2 = &mForegroundColor2; } int top; @@ -97,6 +100,8 @@ class ServersListBox final : public ListBox { x += font1->getWidth(info.name) + 15; font1->drawString(graphics, + *color1, + *color2, info.name, mPadding, y + mPadding); @@ -110,21 +115,27 @@ class ServersListBox final : public ListBox if (!info.description.empty()) { font2->drawString(graphics, + *color1, + *color2, info.description, x, y + mPadding); } font2->drawString(graphics, + *color1, + *color2, model->getElementAt(i), mPadding, top); if (info.version.first > 0) { - graphics->setColorAll(mNotSupportedColor, - mNotSupportedColor2); - font2->drawString(graphics, info.version.second, - width - info.version.first - mPadding, top); + font2->drawString(graphics, + mNotSupportedColor, + mNotSupportedColor2, + info.version.second, + width - info.version.first - mPadding, + top); } } } |