diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-11-27 21:01:02 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-11-27 21:01:02 +0300 |
commit | 192af63cd2d63e06172c1d42ed096af33188fd61 (patch) | |
tree | 10960e874fd0ef560d2b31a00f7a496d09471246 /src/gui/widgets/emoteshortcutcontainer.cpp | |
parent | b6de7d304965f9edbf0c84cd64c99dd91d7e91ce (diff) | |
download | ManaVerse-192af63cd2d63e06172c1d42ed096af33188fd61.tar.gz ManaVerse-192af63cd2d63e06172c1d42ed096af33188fd61.tar.bz2 ManaVerse-192af63cd2d63e06172c1d42ed096af33188fd61.tar.xz ManaVerse-192af63cd2d63e06172c1d42ed096af33188fd61.zip |
Improve a bit draw speed in emoteshortcutcontainer.
Diffstat (limited to 'src/gui/widgets/emoteshortcutcontainer.cpp')
-rw-r--r-- | src/gui/widgets/emoteshortcutcontainer.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp index 5e2666fd8..256c2a666 100644 --- a/src/gui/widgets/emoteshortcutcontainer.cpp +++ b/src/gui/widgets/emoteshortcutcontainer.cpp @@ -128,13 +128,20 @@ void EmoteShortcutContainer::draw(gcn::Graphics *graphics) font->drawString(g, key, emoteX + 2, emoteY + 2); } - const unsigned sz = static_cast<unsigned>(mEmoteImg.size()); - for (unsigned i = 0; i < mMaxItems; i++) + unsigned sz = static_cast<unsigned>(mEmoteImg.size()); + if (sz > mMaxItems) + sz = mMaxItems; + for (unsigned i = 0; i < sz; i++) { - if (i < sz && mEmoteImg[i] && mEmoteImg[i]->sprite) + const EmoteSprite *const emoteImg = mEmoteImg[i]; + if (emoteImg) { - mEmoteImg[i]->sprite->draw(g, (i % mGridWidth) * mBoxWidth + 2, - (i / mGridWidth) * mBoxHeight + 10); + const AnimatedSprite *const sprite = emoteImg->sprite; + if (sprite) + { + sprite->draw(g, (i % mGridWidth) * mBoxWidth + 2, + (i / mGridWidth) * mBoxHeight + 10); + } } } |