summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-09-02 23:58:55 +0300
committerAndrei Karas <akaras@inbox.ru>2013-09-02 23:58:55 +0300
commit937e8601f3091c72c23e4b9621662dc5239209a0 (patch)
treedb1dcdf08061eeef80fa4aeeb22f80b301076165 /src/gui/widgets
parent97ce6d0704369022c64030b0f39a1bdc0cd92797 (diff)
downloadmanaverse-937e8601f3091c72c23e4b9621662dc5239209a0.tar.gz
manaverse-937e8601f3091c72c23e4b9621662dc5239209a0.tar.bz2
manaverse-937e8601f3091c72c23e4b9621662dc5239209a0.tar.xz
manaverse-937e8601f3091c72c23e4b9621662dc5239209a0.zip
improve avatarlistbox draw speed.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/avatarlistbox.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp
index aacb3aabe..7b6b0d611 100644
--- a/src/gui/widgets/avatarlistbox.cpp
+++ b/src/gui/widgets/avatarlistbox.cpp
@@ -23,6 +23,7 @@
#include "actorspritemanager.h"
#include "configuration.h"
+#include "graphicsvertexes.h"
#include "guild.h"
#include "maplayer.h"
@@ -111,6 +112,9 @@ void AvatarListBox::draw(gcn::Graphics *gcnGraphics)
// Draw the list elements
graphics->setColorAll(mForegroundColor, mForegroundColor2);
+ ImageCollection vertexes;
+ const bool useCaching = openGLMode != RENDER_SAFE_OPENGL;
+
for (int i = 0, y = 0;
i < model->getNumberOfElements();
++i, y += fontHeight)
@@ -125,7 +129,17 @@ void AvatarListBox::draw(gcn::Graphics *gcnGraphics)
const Image *const icon = a->getOnline()
? onlineIcon : offlineIcon;
if (icon)
- graphics->drawImage(icon, mImagePadding, y + mPadding);
+ {
+ if (useCaching)
+ {
+ graphics->calcTile(&vertexes, icon,
+ mImagePadding, y + mPadding);
+ }
+ else
+ {
+ graphics->drawImage(icon, mImagePadding, y + mPadding);
+ }
+ }
}
std::string text;
@@ -290,6 +304,9 @@ void AvatarListBox::draw(gcn::Graphics *gcnGraphics)
}
}
+ if (useCaching)
+ graphics->drawTile(&vertexes);
+
if (parent)
setWidth(parent->getWidth() - 10);
BLOCK_END("AvatarListBox::draw")