summaryrefslogtreecommitdiff
path: root/src/gui/widgets/emoteshortcutcontainer.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-11-27 21:01:02 +0300
committerAndrei Karas <akaras@inbox.ru>2013-11-27 21:01:02 +0300
commit192af63cd2d63e06172c1d42ed096af33188fd61 (patch)
tree10960e874fd0ef560d2b31a00f7a496d09471246 /src/gui/widgets/emoteshortcutcontainer.cpp
parentb6de7d304965f9edbf0c84cd64c99dd91d7e91ce (diff)
downloadManaVerse-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.cpp17
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);
+ }
}
}