summaryrefslogtreecommitdiff
path: root/src/gui/widgets/extendedlistbox.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/extendedlistbox.cpp
parent81d317cf80f4c333396c708bbefca16be2362c8c (diff)
downloadmanaplus-2babe1d6491f5231b0e97349ccb198b92bb90ba9.tar.gz
manaplus-2babe1d6491f5231b0e97349ccb198b92bb90ba9.tar.bz2
manaplus-2babe1d6491f5231b0e97349ccb198b92bb90ba9.tar.xz
manaplus-2babe1d6491f5231b0e97349ccb198b92bb90ba9.zip
Improve draw speed in listboxes.
Diffstat (limited to 'src/gui/widgets/extendedlistbox.cpp')
-rw-r--r--src/gui/widgets/extendedlistbox.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/gui/widgets/extendedlistbox.cpp b/src/gui/widgets/extendedlistbox.cpp
index bad1472ac..af1480f86 100644
--- a/src/gui/widgets/extendedlistbox.cpp
+++ b/src/gui/widgets/extendedlistbox.cpp
@@ -60,7 +60,8 @@ void ExtendedListBox::draw(gcn::Graphics *graphics)
Graphics *const g = static_cast<Graphics *const>(graphics);
updateAlpha();
- graphics->setFont(getFont());
+ gcn::Font *const font = getFont();
+ graphics->setFont(font);
const int height = getRowHeight();
int textPos = (height - getFont()->getHeight()) / 2 + mPadding;
@@ -87,14 +88,14 @@ void ExtendedListBox::draw(gcn::Graphics *graphics)
const Image *const image = model->getImageAt(i);
if (!image)
{
- graphics->drawText(mListModel->getElementAt(i),
+ font->drawString(graphics, mListModel->getElementAt(i),
mPadding, y + textPos);
}
else
{
g->drawImage(image, mImagePadding, y + (height
- image->getHeight()) / 2 + mPadding);
- graphics->drawText(mListModel->getElementAt(i),
+ font->drawString(graphics, mListModel->getElementAt(i),
image->getWidth() + mImagePadding + mSpacing, y + textPos);
}
}
@@ -104,13 +105,13 @@ void ExtendedListBox::draw(gcn::Graphics *graphics)
const Image *const image = model->getImageAt(mSelected);
if (!image)
{
- graphics->drawText(mListModel->getElementAt(mSelected),
+ font->drawString(graphics, mListModel->getElementAt(mSelected),
mPadding, mSelected * height + textPos);
}
else
{
graphics->setColor(mForegroundSelectedColor);
- graphics->drawText(mListModel->getElementAt(mSelected),
+ font->drawString(graphics, mListModel->getElementAt(mSelected),
image->getWidth() + mImagePadding + mSpacing,
mSelected * height + textPos);
}