diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-09-02 23:58:55 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-09-02 23:58:55 +0300 |
commit | 937e8601f3091c72c23e4b9621662dc5239209a0 (patch) | |
tree | db1dcdf08061eeef80fa4aeeb22f80b301076165 /src | |
parent | 97ce6d0704369022c64030b0f39a1bdc0cd92797 (diff) | |
download | plus-937e8601f3091c72c23e4b9621662dc5239209a0.tar.gz plus-937e8601f3091c72c23e4b9621662dc5239209a0.tar.bz2 plus-937e8601f3091c72c23e4b9621662dc5239209a0.tar.xz plus-937e8601f3091c72c23e4b9621662dc5239209a0.zip |
improve avatarlistbox draw speed.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/widgets/avatarlistbox.cpp | 19 |
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") |