summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-12-14 16:59:21 +0300
committerAndrei Karas <akaras@inbox.ru>2013-12-14 16:59:21 +0300
commitd9a77eb8ac5d507665cbf8b20f5d8187148ebfd1 (patch)
treedb2f8a25d466ce6aa5ca1747216156f7869a06d1 /src/gui/widgets
parent2851324a6847efa7ea6f556941b369e9e304dc23 (diff)
downloadmv-d9a77eb8ac5d507665cbf8b20f5d8187148ebfd1.tar.gz
mv-d9a77eb8ac5d507665cbf8b20f5d8187148ebfd1.tar.bz2
mv-d9a77eb8ac5d507665cbf8b20f5d8187148ebfd1.tar.xz
mv-d9a77eb8ac5d507665cbf8b20f5d8187148ebfd1.zip
Improve a bit separate images drawing.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/avatarlistbox.cpp2
-rw-r--r--src/gui/widgets/browserbox.cpp2
-rw-r--r--src/gui/widgets/button.cpp9
-rw-r--r--src/gui/widgets/checkbox.cpp2
-rw-r--r--src/gui/widgets/desktop.cpp2
-rw-r--r--src/gui/widgets/dropdown.cpp4
-rw-r--r--src/gui/widgets/dropshortcutcontainer.cpp2
-rw-r--r--src/gui/widgets/emotepage.cpp2
-rw-r--r--src/gui/widgets/extendedlistbox.cpp4
-rw-r--r--src/gui/widgets/icon.cpp3
-rw-r--r--src/gui/widgets/itemcontainer.cpp8
-rw-r--r--src/gui/widgets/itemshortcutcontainer.cpp6
-rw-r--r--src/gui/widgets/radiobutton.cpp2
-rw-r--r--src/gui/widgets/scrollarea.cpp4
-rw-r--r--src/gui/widgets/shoplistbox.cpp2
-rw-r--r--src/gui/widgets/shortcutcontainer.cpp2
-rw-r--r--src/gui/widgets/slider.cpp12
-rw-r--r--src/gui/widgets/spellshortcutcontainer.cpp2
-rw-r--r--src/gui/widgets/tabs/tab.cpp2
-rw-r--r--src/gui/widgets/window.cpp6
20 files changed, 42 insertions, 36 deletions
diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp
index 123f7f843..6726475d2 100644
--- a/src/gui/widgets/avatarlistbox.cpp
+++ b/src/gui/widgets/avatarlistbox.cpp
@@ -137,7 +137,7 @@ void AvatarListBox::draw(gcn::Graphics *gcnGraphics)
}
else
{
- graphics->drawImage(icon, mImagePadding, y + mPadding);
+ DRAW_IMAGE(graphics, icon, mImagePadding, y + mPadding);
}
}
}
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp
index 8d1550f43..0dafe8e24 100644
--- a/src/gui/widgets/browserbox.cpp
+++ b/src/gui/widgets/browserbox.cpp
@@ -506,7 +506,7 @@ void BrowserBox::draw(gcn::Graphics *graphics)
}
else if (part.mImage)
{
- graphics2->drawImage(part.mImage, part.mX, part.mY);
+ DRAW_IMAGE(graphics2, part.mImage, part.mX, part.mY);
}
}
diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp
index e1f95c334..91c531f6b 100644
--- a/src/gui/widgets/button.cpp
+++ b/src/gui/widgets/button.cpp
@@ -499,12 +499,17 @@ void Button::draw(gcn::Graphics *graphics)
else
{
g2->drawImageRect(0, 0, width, height, skin->getBorder());
+
if (mImages)
{
if (isPressed())
- g2->drawImage(mImages[mode], imageX + 1, imageY + 1);
+ {
+ DRAW_IMAGE(g2, mImages[mode], imageX + 1, imageY + 1);
+ }
else
- g2->drawImage(mImages[mode], imageX, imageY);
+ {
+ DRAW_IMAGE(g2, mImages[mode], imageX, imageY);
+ }
}
}
diff --git a/src/gui/widgets/checkbox.cpp b/src/gui/widgets/checkbox.cpp
index e21e50c53..c8710c573 100644
--- a/src/gui/widgets/checkbox.cpp
+++ b/src/gui/widgets/checkbox.cpp
@@ -165,7 +165,7 @@ void CheckBox::drawBox(gcn::Graphics *const graphics)
if (box)
{
- static_cast<Graphics*>(graphics)->drawImage(
+ DRAW_IMAGE(static_cast<Graphics*>(graphics),
box, mImagePadding, (getHeight() - mImageSize) / 2);
}
}
diff --git a/src/gui/widgets/desktop.cpp b/src/gui/widgets/desktop.cpp
index d2e132c56..1aed4a825 100644
--- a/src/gui/widgets/desktop.cpp
+++ b/src/gui/widgets/desktop.cpp
@@ -124,7 +124,7 @@ void Desktop::draw(gcn::Graphics *graphics)
if (imageHelper->useOpenGL() == RENDER_SOFTWARE)
{
- g->drawImage(mWallpaper,
+ DRAW_IMAGE(g, mWallpaper,
(width - wallpWidth) / 2,
(height - wallpHeight) / 2);
}
diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp
index 7c41bbacc..07d48f13d 100644
--- a/src/gui/widgets/dropdown.cpp
+++ b/src/gui/widgets/dropdown.cpp
@@ -250,7 +250,7 @@ void DropDown::draw(gcn::Graphics* graphics)
}
else
{
- static_cast<Graphics*>(graphics)->drawImage(
+ DRAW_IMAGE(static_cast<Graphics*>(graphics),
image, mImagePadding, (mDimension.height
- image->getHeight()) / 2 + mPadding);
font->drawString(graphics, model->getElementAt(sel),
@@ -303,7 +303,7 @@ void DropDown::drawButton(gcn::Graphics *graphics)
Image *image = buttons[mDroppedDown][mPushed];
if (image)
{
- static_cast<Graphics*>(graphics)->drawImage(image,
+ DRAW_IMAGE(static_cast<Graphics*>(graphics), image,
mDimension.width - image->getWidth() - mImagePadding,
(height - image->getHeight()) / 2);
}
diff --git a/src/gui/widgets/dropshortcutcontainer.cpp b/src/gui/widgets/dropshortcutcontainer.cpp
index d8f2f1d68..9775b0fb0 100644
--- a/src/gui/widgets/dropshortcutcontainer.cpp
+++ b/src/gui/widgets/dropshortcutcontainer.cpp
@@ -144,7 +144,7 @@ void DropShortcutContainer::draw(gcn::Graphics *graphics)
caption = "Eq.";
image->setAlpha(1.0F);
- g->drawImage(image, itemX, itemY);
+ DRAW_IMAGE(g, image, itemX, itemY);
if (item->isEquipped())
g->setColorAll(mEquipedColor, mEquipedColor2);
else
diff --git a/src/gui/widgets/emotepage.cpp b/src/gui/widgets/emotepage.cpp
index 5af84e88d..a68836a96 100644
--- a/src/gui/widgets/emotepage.cpp
+++ b/src/gui/widgets/emotepage.cpp
@@ -103,7 +103,7 @@ void EmotePage::draw(gcn::Graphics *graphics)
const Image *const image = *it;
if (image)
{
- g->drawImage(image, x, y);
+ DRAW_IMAGE(g, image, x, y);
x += emoteWidth;
if (x + emoteWidth > width)
{
diff --git a/src/gui/widgets/extendedlistbox.cpp b/src/gui/widgets/extendedlistbox.cpp
index 68b4df766..0363b73a0 100644
--- a/src/gui/widgets/extendedlistbox.cpp
+++ b/src/gui/widgets/extendedlistbox.cpp
@@ -132,7 +132,7 @@ void ExtendedListBox::draw(gcn::Graphics *graphics)
const Image *const image = model->getImageAt(row1);
if (image)
{
- g->drawImage(image, mImagePadding, item.y + (height
+ DRAW_IMAGE(g, image, mImagePadding, item.y + (height
- image->getHeight()) / 2 + mPadding);
}
}
@@ -166,7 +166,7 @@ void ExtendedListBox::draw(gcn::Graphics *graphics)
const Image *const image = model->getImageAt(row1);
if (image)
{
- g->drawImage(image, mImagePadding, item.y + (height
+ DRAW_IMAGE(g, image, mImagePadding, item.y + (height
- image->getHeight()) / 2 + mPadding);
}
}
diff --git a/src/gui/widgets/icon.cpp b/src/gui/widgets/icon.cpp
index 9232aea0d..e4985d68f 100644
--- a/src/gui/widgets/icon.cpp
+++ b/src/gui/widgets/icon.cpp
@@ -73,7 +73,8 @@ void Icon::draw(gcn::Graphics *g)
if (mImage)
{
Graphics *const graphics = static_cast<Graphics*>(g);
- graphics->drawImage(mImage, (mDimension.width - mImage->mBounds.w) / 2,
+ DRAW_IMAGE(graphics, mImage,
+ (mDimension.width - mImage->mBounds.w) / 2,
(mDimension.height - mImage->mBounds.h) / 2);
}
BLOCK_END("Icon::draw")
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index 8754210f8..9064ca8b5 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -280,16 +280,16 @@ void ItemContainer::draw(gcn::Graphics *graphics)
if (mShowMatrix[itemIndex] == mSelectedIndex)
{
if (mSelImg)
- g->drawImage(mSelImg, itemX, itemY);
+ DRAW_IMAGE(g, mSelImg, itemX, itemY);
}
image->setAlpha(1.0F); // ensure the image if fully drawn...
- g->drawImage(image, itemX + mPaddingItemX,
+ DRAW_IMAGE(g, image, itemX + mPaddingItemX,
itemY + mPaddingItemY);
if (mProtectedImg && PlayerInfo::isItemProtected(
item->getId()))
{
- g->drawImage(mProtectedImg, itemX + mPaddingItemX,
- itemY + mPaddingItemY);
+ DRAW_IMAGE(g, mProtectedImg,
+ itemX + mPaddingItemX, itemY + mPaddingItemY);
}
}
}
diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp
index 266c96241..7271f3943 100644
--- a/src/gui/widgets/itemshortcutcontainer.cpp
+++ b/src/gui/widgets/itemshortcutcontainer.cpp
@@ -175,7 +175,7 @@ void ItemShortcutContainer::draw(gcn::Graphics *graphics)
caption = "Eq.";
image->setAlpha(1.0F);
- g->drawImage(image, itemX, itemY);
+ DRAW_IMAGE(g, image, itemX, itemY);
if (item->isEquipped())
g->setColorAll(mEquipedColor, mEquipedColor2);
else
@@ -199,7 +199,7 @@ void ItemShortcutContainer::draw(gcn::Graphics *graphics)
if (image)
{
image->setAlpha(1.0F);
- g->drawImage(image, itemX, itemY);
+ DRAW_IMAGE(g, image, itemX, itemY);
}
}
@@ -218,7 +218,7 @@ void ItemShortcutContainer::draw(gcn::Graphics *graphics)
if (image)
{
image->setAlpha(1.0F);
- g->drawImage(image, itemX, itemY);
+ DRAW_IMAGE(g, image, itemX, itemY);
}
font->drawString(g, skill->data->shortName, itemX + 2,
diff --git a/src/gui/widgets/radiobutton.cpp b/src/gui/widgets/radiobutton.cpp
index fe0195680..1dff6ae7c 100644
--- a/src/gui/widgets/radiobutton.cpp
+++ b/src/gui/widgets/radiobutton.cpp
@@ -148,7 +148,7 @@ void RadioButton::drawBox(gcn::Graphics* graphics)
if (box)
{
- static_cast<Graphics*>(graphics)->drawImage(
+ DRAW_IMAGE(static_cast<Graphics*>(graphics),
box, mImagePadding, (getHeight() - mImageSize) / 2);
}
}
diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp
index e97dad715..a2e1ca4aa 100644
--- a/src/gui/widgets/scrollarea.cpp
+++ b/src/gui/widgets/scrollarea.cpp
@@ -428,8 +428,8 @@ void ScrollArea::drawButton(gcn::Graphics *const graphics,
if (buttons[dir][state])
{
- static_cast<Graphics*>(graphics)->
- drawImage(buttons[dir][state], dim.x, dim.y);
+ DRAW_IMAGE(static_cast<Graphics*>(graphics),
+ buttons[dir][state], dim.x, dim.y);
}
}
diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp
index 9918b7788..5bf56c842 100644
--- a/src/gui/widgets/shoplistbox.cpp
+++ b/src/gui/widgets/shoplistbox.cpp
@@ -157,7 +157,7 @@ void ShopListBox::draw(gcn::Graphics *gcnGraphics)
if (icon)
{
icon->setAlpha(1.0F);
- graphics->drawImage(icon, mPadding, y + mPadding);
+ DRAW_IMAGE(graphics, icon, mPadding, y + mPadding);
}
}
if (mSelected == i)
diff --git a/src/gui/widgets/shortcutcontainer.cpp b/src/gui/widgets/shortcutcontainer.cpp
index 2fb5c4099..a68bc8b07 100644
--- a/src/gui/widgets/shortcutcontainer.cpp
+++ b/src/gui/widgets/shortcutcontainer.cpp
@@ -109,7 +109,7 @@ void ShortcutContainer::drawBackground(Graphics *g)
{
for (unsigned i = 0; i < mMaxItems; i ++)
{
- g->drawImage(mBackgroundImg, (i % mGridWidth) * mBoxWidth,
+ DRAW_IMAGE(g, mBackgroundImg, (i % mGridWidth) * mBoxWidth,
(i / mGridWidth) * mBoxHeight);
}
}
diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp
index 20fc6b21b..47d4e2215 100644
--- a/src/gui/widgets/slider.cpp
+++ b/src/gui/widgets/slider.cpp
@@ -204,7 +204,7 @@ void Slider::draw(gcn::Graphics *graphics)
{
if (!mHasMouse)
{
- g->drawImage(buttons[0].grid[HSTART], x, y);
+ DRAW_IMAGE(g, buttons[0].grid[HSTART], x, y);
const int width = buttons[0].grid[HSTART]->getWidth();
w -= width + buttons[0].grid[HEND]->getWidth();
x += width;
@@ -216,18 +216,18 @@ void Slider::draw(gcn::Graphics *graphics)
}
x += w;
- g->drawImage(buttons[0].grid[HEND], x, y);
+ DRAW_IMAGE(g, buttons[0].grid[HEND], x, y);
const Image *const img = buttons[0].grid[HGRIP];
if (img)
{
- g->drawImage(img, getMarkerPosition(),
+ DRAW_IMAGE(g, img, getMarkerPosition(),
(mDimension.height - img->getHeight()) / 2);
}
}
else
{
- g->drawImage(buttons[1].grid[HSTART], x, y);
+ DRAW_IMAGE(g, buttons[1].grid[HSTART], x, y);
const int width = buttons[1].grid[HSTART]->getWidth();
w -= width;
@@ -243,12 +243,12 @@ void Slider::draw(gcn::Graphics *graphics)
x += w;
if (buttons[1].grid[HEND])
- g->drawImage(buttons[1].grid[HEND], x, y);
+ DRAW_IMAGE(g, buttons[1].grid[HEND], x, y);
const Image *const img = buttons[1].grid[HGRIP];
if (img)
{
- g->drawImage(img, getMarkerPosition(),
+ DRAW_IMAGE(g, img, getMarkerPosition(),
(mDimension.height - img->getHeight()) / 2);
}
}
diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp
index 3a28bfabf..7d9ba6d0f 100644
--- a/src/gui/widgets/spellshortcutcontainer.cpp
+++ b/src/gui/widgets/spellshortcutcontainer.cpp
@@ -135,7 +135,7 @@ void SpellShortcutContainer::draw(gcn::Graphics *graphics)
if (image)
{
image->setAlpha(1.0F);
- g->drawImage(image, itemX, itemY);
+ DRAW_IMAGE(g, image, itemX, itemY);
}
}
diff --git a/src/gui/widgets/tabs/tab.cpp b/src/gui/widgets/tabs/tab.cpp
index cdaa84d14..fd5d8ffc5 100644
--- a/src/gui/widgets/tabs/tab.cpp
+++ b/src/gui/widgets/tabs/tab.cpp
@@ -241,7 +241,7 @@ void Tab::draw(gcn::Graphics *graphics)
if (skin1)
{
const int padding = skin1->getPadding();
- g->drawImage(mImage, padding, padding);
+ DRAW_IMAGE(g, mImage, padding, padding);
}
}
}
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index 5148ec3f5..a95bc0877 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -272,18 +272,18 @@ void Window::draw(gcn::Graphics *graphics)
const Image *const button = mSkin->getCloseImage(
mResizeHandles == CLOSE);
if (button)
- g->drawImage(button, mCloseRect.x, mCloseRect.y);
+ DRAW_IMAGE(g, button, mCloseRect.x, mCloseRect.y);
}
// Draw Sticky Button
if (mStickyButton)
{
const Image *const button = mSkin->getStickyImage(mSticky);
if (button)
- g->drawImage(button, mStickyRect.x, mStickyRect.y);
+ DRAW_IMAGE(g, button, mStickyRect.x, mStickyRect.y);
}
if (mGrip)
- g->drawImage(mGrip, mGripRect.x, mGripRect.y);
+ DRAW_IMAGE(g, mGrip, mGripRect.x, mGripRect.y);
}
// Draw title