diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-12-29 21:22:33 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-12-29 21:22:33 +0300 |
commit | f94a6551b8d140e272ac1c46bce1ff0e5df34986 (patch) | |
tree | 35c764dfec7b76f926c30cd186b6fe36968b6529 /src/gui | |
parent | 0336b91f51cdf14e022f74d16c15892b63b658eb (diff) | |
download | plus-f94a6551b8d140e272ac1c46bce1ff0e5df34986.tar.gz plus-f94a6551b8d140e272ac1c46bce1ff0e5df34986.tar.bz2 plus-f94a6551b8d140e272ac1c46bce1ff0e5df34986.tar.xz plus-f94a6551b8d140e272ac1c46bce1ff0e5df34986.zip |
improve draw image calls.
Diffstat (limited to 'src/gui')
26 files changed, 46 insertions, 50 deletions
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 47a533bf8..a9005c4d2 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -468,7 +468,7 @@ void Gui::draw() { const int posX = mouseX - (image->mBounds.w / 2); const int posY = mouseY - (image->mBounds.h / 2); - DRAW_IMAGE(g2, image, posX, posY); + g2->drawImage2(image, posX, posY); } if (mGuiFont) { @@ -486,7 +486,7 @@ void Gui::draw() if (mouseCursor) { mouseCursor->setAlpha(mMouseCursorAlpha); - DRAW_IMAGE(g2, mouseCursor, mouseX - 15, mouseY - 17); + g2->drawImage2(mouseCursor, mouseX - 15, mouseY - 17); } } diff --git a/src/gui/sdlfont.cpp b/src/gui/sdlfont.cpp index 3998ffcd2..742f3d9aa 100644 --- a/src/gui/sdlfont.cpp +++ b/src/gui/sdlfont.cpp @@ -482,7 +482,7 @@ void SDLFont::drawString(gcn::Graphics *const graphics, if (image) { image->setAlpha(alpha); - DRAW_IMAGE(g, image, x, y); + g->drawImage2(image, x, y); } } else @@ -504,7 +504,7 @@ void SDLFont::drawString(gcn::Graphics *const graphics, const Image *const image = chunk2->img; if (image) - DRAW_IMAGE(g, image, x, y); + g->drawImage2(image, x, y); } BLOCK_END("SDLFont::drawString") } diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp index cc9b1a262..0c87df057 100644 --- a/src/gui/widgets/avatarlistbox.cpp +++ b/src/gui/widgets/avatarlistbox.cpp @@ -137,7 +137,7 @@ void AvatarListBox::draw(gcn::Graphics *gcnGraphics) } else { - DRAW_IMAGE(graphics, icon, mImagePadding, y + mPadding); + graphics->drawImage2(icon, mImagePadding, y + mPadding); } } } diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index d3e2efc67..5394054fe 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -508,7 +508,7 @@ void BrowserBox::draw(gcn::Graphics *graphics) } else if (part.mImage) { - DRAW_IMAGE(graphics2, part.mImage, part.mX, part.mY); + graphics2->drawImage2(part.mImage, part.mX, part.mY); } } diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp index c8ac617c0..b7cba68af 100644 --- a/src/gui/widgets/button.cpp +++ b/src/gui/widgets/button.cpp @@ -508,11 +508,11 @@ void Button::draw(gcn::Graphics *graphics) { if (isPressed()) { - DRAW_IMAGE(g2, mImages[mode], imageX + 1, imageY + 1); + g2->drawImage2(mImages[mode], imageX + 1, imageY + 1); } else { - DRAW_IMAGE(g2, mImages[mode], imageX, imageY); + g2->drawImage2(mImages[mode], imageX, imageY); } } } diff --git a/src/gui/widgets/checkbox.cpp b/src/gui/widgets/checkbox.cpp index 0dfd45745..1497706a1 100644 --- a/src/gui/widgets/checkbox.cpp +++ b/src/gui/widgets/checkbox.cpp @@ -167,7 +167,7 @@ void CheckBox::drawBox(gcn::Graphics *const graphics) if (box) { - DRAW_IMAGE(static_cast<Graphics*>(graphics), + static_cast<Graphics*>(graphics)->drawImage2( box, mImagePadding, (getHeight() - mImageSize) / 2); } } diff --git a/src/gui/widgets/desktop.cpp b/src/gui/widgets/desktop.cpp index 1aed4a825..7d464b46d 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) { - DRAW_IMAGE(g, mWallpaper, + g->drawImage2(mWallpaper, (width - wallpWidth) / 2, (height - wallpHeight) / 2); } diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp index 0cfcb2a6f..bb4ca313a 100644 --- a/src/gui/widgets/dropdown.cpp +++ b/src/gui/widgets/dropdown.cpp @@ -250,7 +250,7 @@ void DropDown::draw(gcn::Graphics* graphics) } else { - DRAW_IMAGE(static_cast<Graphics*>(graphics), + static_cast<Graphics*>(graphics)->drawImage2( 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) { - DRAW_IMAGE(static_cast<Graphics*>(graphics), image, + static_cast<Graphics*>(graphics)->drawImage2(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 9775b0fb0..1662bdbb4 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); - DRAW_IMAGE(g, image, itemX, itemY); + g->drawImage2(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 3c7d1a842..f80f80874 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) { - DRAW_IMAGE(g, image, x, y); + g->drawImage2(image, x, y); x += emoteWidth; if (x + emoteWidth > width) { diff --git a/src/gui/widgets/extendedlistbox.cpp b/src/gui/widgets/extendedlistbox.cpp index da9c4521e..781f35e79 100644 --- a/src/gui/widgets/extendedlistbox.cpp +++ b/src/gui/widgets/extendedlistbox.cpp @@ -146,7 +146,7 @@ void ExtendedListBox::draw(gcn::Graphics *graphics) const Image *const image = model->getImageAt(row1); if (image) { - DRAW_IMAGE(g, image, mImagePadding, item.y + (height + g->drawImage2(image, mImagePadding, item.y + (height - image->getHeight()) / 2 + mPadding); } } @@ -180,7 +180,7 @@ void ExtendedListBox::draw(gcn::Graphics *graphics) const Image *const image = model->getImageAt(row1); if (image) { - DRAW_IMAGE(g, image, mImagePadding, item.y + (height + g->drawImage2(image, mImagePadding, item.y + (height - image->getHeight()) / 2 + mPadding); } } diff --git a/src/gui/widgets/icon.cpp b/src/gui/widgets/icon.cpp index e4985d68f..95e287ace 100644 --- a/src/gui/widgets/icon.cpp +++ b/src/gui/widgets/icon.cpp @@ -73,7 +73,7 @@ void Icon::draw(gcn::Graphics *g) if (mImage) { Graphics *const graphics = static_cast<Graphics*>(g); - DRAW_IMAGE(graphics, mImage, + graphics->drawImage2(mImage, (mDimension.width - mImage->mBounds.w) / 2, (mDimension.height - mImage->mBounds.h) / 2); } diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index 8ba9707a4..5e5caf234 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -278,15 +278,15 @@ void ItemContainer::draw(gcn::Graphics *graphics) if (mShowMatrix[itemIndex] == mSelectedIndex) { if (mSelImg) - DRAW_IMAGE(g, mSelImg, itemX, itemY); + g->drawImage2(mSelImg, itemX, itemY); } image->setAlpha(1.0F); // ensure the image if fully drawn... - DRAW_IMAGE(g, image, itemX + mPaddingItemX, + g->drawImage2(image, itemX + mPaddingItemX, itemY + mPaddingItemY); if (mProtectedImg && PlayerInfo::isItemProtected( item->getId())) { - DRAW_IMAGE(g, mProtectedImg, + g->drawImage2(mProtectedImg, itemX + mPaddingItemX, itemY + mPaddingItemY); } } diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp index 7271f3943..f969e34d9 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); - DRAW_IMAGE(g, image, itemX, itemY); + g->drawImage2(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); - DRAW_IMAGE(g, image, itemX, itemY); + g->drawImage2(image, itemX, itemY); } } @@ -218,7 +218,7 @@ void ItemShortcutContainer::draw(gcn::Graphics *graphics) if (image) { image->setAlpha(1.0F); - DRAW_IMAGE(g, image, itemX, itemY); + g->drawImage2(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 6ef7439b4..3ae2e73aa 100644 --- a/src/gui/widgets/radiobutton.cpp +++ b/src/gui/widgets/radiobutton.cpp @@ -149,7 +149,7 @@ void RadioButton::drawBox(gcn::Graphics* graphics) if (box) { - DRAW_IMAGE(static_cast<Graphics*>(graphics), + static_cast<Graphics*>(graphics)->drawImage2( box, mImagePadding, (getHeight() - mImageSize) / 2); } } diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp index 3a69ea0c0..41204415d 100644 --- a/src/gui/widgets/scrollarea.cpp +++ b/src/gui/widgets/scrollarea.cpp @@ -429,7 +429,7 @@ void ScrollArea::drawButton(gcn::Graphics *const graphics, if (buttons[dir][state]) { - DRAW_IMAGE(static_cast<Graphics*>(graphics), + static_cast<Graphics*>(graphics)->drawImage2( buttons[dir][state], dim.x, dim.y); } } diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp index 5bf56c842..90f4e3648 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); - DRAW_IMAGE(graphics, icon, mPadding, y + mPadding); + graphics->drawImage2(icon, mPadding, y + mPadding); } } if (mSelected == i) diff --git a/src/gui/widgets/shortcutcontainer.cpp b/src/gui/widgets/shortcutcontainer.cpp index c4a6fe249..17a6c4edf 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 ++) { - DRAW_IMAGE(g, mBackgroundImg, (i % mGridWidth) * mBoxWidth, + g->drawImage2(mBackgroundImg, (i % mGridWidth) * mBoxWidth, (i / mGridWidth) * mBoxHeight); } } diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp index e68482821..b03ba7c2d 100644 --- a/src/gui/widgets/slider.cpp +++ b/src/gui/widgets/slider.cpp @@ -209,7 +209,7 @@ void Slider::draw(gcn::Graphics *graphics) { if (!mHasMouse) { - DRAW_IMAGE(g, buttons[0].grid[HSTART], x, y); + g->drawImage2(buttons[0].grid[HSTART], x, y); const int width = buttons[0].grid[HSTART]->getWidth(); w -= width + buttons[0].grid[HEND]->getWidth(); x += width; @@ -221,18 +221,18 @@ void Slider::draw(gcn::Graphics *graphics) } x += w; - DRAW_IMAGE(g, buttons[0].grid[HEND], x, y); + g->drawImage2(buttons[0].grid[HEND], x, y); const Image *const img = buttons[0].grid[HGRIP]; if (img) { - DRAW_IMAGE(g, img, getMarkerPosition(), + g->drawImage2(img, getMarkerPosition(), (mDimension.height - img->getHeight()) / 2); } } else { - DRAW_IMAGE(g, buttons[1].grid[HSTART], x, y); + g->drawImage2(buttons[1].grid[HSTART], x, y); const int width = buttons[1].grid[HSTART]->getWidth(); w -= width; @@ -248,12 +248,12 @@ void Slider::draw(gcn::Graphics *graphics) x += w; if (buttons[1].grid[HEND]) - DRAW_IMAGE(g, buttons[1].grid[HEND], x, y); + g->drawImage2(buttons[1].grid[HEND], x, y); const Image *const img = buttons[1].grid[HGRIP]; if (img) { - DRAW_IMAGE(g, img, getMarkerPosition(), + g->drawImage2(img, getMarkerPosition(), (mDimension.height - img->getHeight()) / 2); } } diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp index 7d9ba6d0f..f18668b2b 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); - DRAW_IMAGE(g, image, itemX, itemY); + g->drawImage2(image, itemX, itemY); } } diff --git a/src/gui/widgets/tabs/tab.cpp b/src/gui/widgets/tabs/tab.cpp index 3fa27bbe8..de44d5b02 100644 --- a/src/gui/widgets/tabs/tab.cpp +++ b/src/gui/widgets/tabs/tab.cpp @@ -242,7 +242,7 @@ void Tab::draw(gcn::Graphics *graphics) if (skin1) { const int padding = skin1->getPadding(); - DRAW_IMAGE(g, mImage, padding, padding); + g->drawImage2(mImage, padding, padding); } } } diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index 963288a03..a0ef3038a 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -278,18 +278,18 @@ void Window::draw(gcn::Graphics *graphics) const Image *const button = mSkin->getCloseImage( mResizeHandles == CLOSE); if (button) - DRAW_IMAGE(g, button, mCloseRect.x, mCloseRect.y); + g->drawImage2(button, mCloseRect.x, mCloseRect.y); } // Draw Sticky Button if (mStickyButton) { const Image *const button = mSkin->getStickyImage(mSticky); if (button) - DRAW_IMAGE(g, button, mStickyRect.x, mStickyRect.y); + g->drawImage2(button, mStickyRect.x, mStickyRect.y); } if (mGrip) - DRAW_IMAGE(g, mGrip, mGripRect.x, mGripRect.y); + g->drawImage2(mGrip, mGripRect.x, mGripRect.y); } // Draw title diff --git a/src/gui/windows/equipmentwindow.cpp b/src/gui/windows/equipmentwindow.cpp index 9fe03d1cc..6ea49e607 100644 --- a/src/gui/windows/equipmentwindow.cpp +++ b/src/gui/windows/equipmentwindow.cpp @@ -202,13 +202,9 @@ void EquipmentWindow::draw(gcn::Graphics *graphics) if (!box) continue; if (i == mSelected) - { - DRAW_IMAGE(g, mSlotHighlightedBackground, box->x, box->y); - } + g->drawImage2(mSlotHighlightedBackground, box->x, box->y); else - { - DRAW_IMAGE(g, mSlotBackground, box->x, box->y); - } + g->drawImage2(mSlotBackground, box->x, box->y); } } @@ -234,7 +230,7 @@ void EquipmentWindow::draw(gcn::Graphics *graphics) { image->setAlpha(1.0F); // Ensure the image is drawn // with maximum opacity - DRAW_IMAGE(g, image, box->x + mItemPadding, + g->drawImage2(image, box->x + mItemPadding, box->y + mItemPadding); if (i == EQUIP_PROJECTILE_SLOT) { @@ -248,7 +244,7 @@ void EquipmentWindow::draw(gcn::Graphics *graphics) } else if (box->image) { - DRAW_IMAGE(g, box->image, box->x + mItemPadding, + g->drawImage2(box->image, box->x + mItemPadding, box->y + mItemPadding); } } diff --git a/src/gui/windows/minimap.cpp b/src/gui/windows/minimap.cpp index 6db0b5388..22980f7d9 100644 --- a/src/gui/windows/minimap.cpp +++ b/src/gui/windows/minimap.cpp @@ -286,7 +286,7 @@ void Minimap::draw(gcn::Graphics *graphics) mMapOriginY = 0; } - DRAW_IMAGE(graph, mMapImage, mMapOriginX, mMapOriginY); + graph->drawImage2(mMapImage, mMapOriginX, mMapOriginY); } const ActorSprites &actors = actorManager->getAll(); diff --git a/src/gui/windows/outfitwindow.cpp b/src/gui/windows/outfitwindow.cpp index c242f5d85..abd3e966a 100644 --- a/src/gui/windows/outfitwindow.cpp +++ b/src/gui/windows/outfitwindow.cpp @@ -348,7 +348,7 @@ void OutfitWindow::draw(gcn::Graphics *graphics) const Image *const image = item->getImage(); if (image) { - DRAW_IMAGE(g, image, itemX, itemY); + g->drawImage2(image, itemX, itemY); foundItem = true; } } @@ -359,7 +359,7 @@ void OutfitWindow::draw(gcn::Graphics *graphics) mItemColors[mCurrentOutfit][i]); if (image) { - DRAW_IMAGE(g, image, itemX, itemY); + g->drawImage2(image, itemX, itemY); image->decRef(); } } diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp index b21f0c09b..f4526475c 100644 --- a/src/gui/windows/skilldialog.cpp +++ b/src/gui/windows/skilldialog.cpp @@ -134,7 +134,7 @@ class SkillListBox final : public ListBox const SkillData *const data = e->data; const int yPad = y + mPadding; const std::string &description = data->description; - DRAW_IMAGE(graphics, data->icon, mPadding, yPad); + graphics->drawImage2(data->icon, mPadding, yPad); font->drawString(graphics, data->name, mTextPadding, yPad); if (!description.empty()) { |