summaryrefslogtreecommitdiff
path: root/src/gui/widgets/listbox.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-12-27 01:22:21 +0300
committerAndrei Karas <akaras@inbox.ru>2012-12-27 23:15:05 +0300
commit2babe1d6491f5231b0e97349ccb198b92bb90ba9 (patch)
tree3db30d7bff509ec233ba91ee14f55ea95ebb159c /src/gui/widgets/listbox.cpp
parent81d317cf80f4c333396c708bbefca16be2362c8c (diff)
downloadmanaverse-2babe1d6491f5231b0e97349ccb198b92bb90ba9.tar.gz
manaverse-2babe1d6491f5231b0e97349ccb198b92bb90ba9.tar.bz2
manaverse-2babe1d6491f5231b0e97349ccb198b92bb90ba9.tar.xz
manaverse-2babe1d6491f5231b0e97349ccb198b92bb90ba9.zip
Improve draw speed in listboxes.
Diffstat (limited to 'src/gui/widgets/listbox.cpp')
-rw-r--r--src/gui/widgets/listbox.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/gui/widgets/listbox.cpp b/src/gui/widgets/listbox.cpp
index 87ecc9460..dbd54f3f3 100644
--- a/src/gui/widgets/listbox.cpp
+++ b/src/gui/widgets/listbox.cpp
@@ -92,7 +92,8 @@ void ListBox::draw(gcn::Graphics *graphics)
mHighlightColor.a = static_cast<int>(mAlpha * 255.0f);
graphics->setColor(mHighlightColor);
- graphics->setFont(getFont());
+ gcn::Font *const font = getFont();
+ graphics->setFont(font);
const int height = getRowHeight();
@@ -107,7 +108,7 @@ void ListBox::draw(gcn::Graphics *graphics)
if (sel >= 0)
{
graphics->setColor(mForegroundSelectedColor);
- graphics->drawText(mListModel->getElementAt(sel),
+ font->drawString(graphics, mListModel->getElementAt(sel),
mPadding, sel * height + mPadding);
}
// Draw the list elements
@@ -117,7 +118,7 @@ void ListBox::draw(gcn::Graphics *graphics)
{
if (i != sel)
{
- graphics->drawText(mListModel->getElementAt(i),
+ font->drawString(graphics, mListModel->getElementAt(i),
mPadding, y + mPadding);
}
}