summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-02-15 22:21:02 +0300
committerAndrei Karas <akaras@inbox.ru>2014-02-15 22:21:02 +0300
commitca9fac131283ed536971799bef0d1fff4ef8adc1 (patch)
treeec70584d20b117c5d2446ef42b898eeacdda9d12 /src/gui/widgets
parent29f929794c7519b049de0be3af635f05d7e83be6 (diff)
downloadmanaplus-ca9fac131283ed536971799bef0d1fff4ef8adc1.tar.gz
manaplus-ca9fac131283ed536971799bef0d1fff4ef8adc1.tar.bz2
manaplus-ca9fac131283ed536971799bef0d1fff4ef8adc1.tar.xz
manaplus-ca9fac131283ed536971799bef0d1fff4ef8adc1.zip
Remove useless graphics casts.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/avatarlistbox.cpp4
-rw-r--r--src/gui/widgets/browserbox.cpp5
-rw-r--r--src/gui/widgets/button.cpp40
-rw-r--r--src/gui/widgets/checkbox.cpp9
-rw-r--r--src/gui/widgets/colorpage.cpp7
-rw-r--r--src/gui/widgets/desktop.cpp17
-rw-r--r--src/gui/widgets/dropdown.cpp16
-rw-r--r--src/gui/widgets/dropshortcutcontainer.cpp11
-rw-r--r--src/gui/widgets/emotepage.cpp7
-rw-r--r--src/gui/widgets/emoteshortcutcontainer.cpp10
-rw-r--r--src/gui/widgets/extendedlistbox.cpp15
-rw-r--r--src/gui/widgets/icon.cpp3
-rw-r--r--src/gui/widgets/itemcontainer.cpp17
-rw-r--r--src/gui/widgets/itemshortcutcontainer.cpp28
-rw-r--r--src/gui/widgets/label.cpp3
-rw-r--r--src/gui/widgets/listbox.cpp9
-rw-r--r--src/gui/widgets/playerbox.cpp12
-rw-r--r--src/gui/widgets/popup.cpp9
-rw-r--r--src/gui/widgets/progressbar.cpp2
-rw-r--r--src/gui/widgets/progressindicator.cpp2
-rw-r--r--src/gui/widgets/radiobutton.cpp9
-rw-r--r--src/gui/widgets/scrollarea.cpp145
-rw-r--r--src/gui/widgets/shoplistbox.cpp3
-rw-r--r--src/gui/widgets/slider.cpp50
-rw-r--r--src/gui/widgets/spellshortcutcontainer.cpp11
-rw-r--r--src/gui/widgets/tabs/tab.cpp25
-rw-r--r--src/gui/widgets/textbox.cpp3
-rw-r--r--src/gui/widgets/textfield.cpp10
-rw-r--r--src/gui/widgets/textpreview.cpp17
-rw-r--r--src/gui/widgets/window.cpp48
30 files changed, 289 insertions, 258 deletions
diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp
index e6f03493f..9a1aa40ab 100644
--- a/src/gui/widgets/avatarlistbox.cpp
+++ b/src/gui/widgets/avatarlistbox.cpp
@@ -90,7 +90,7 @@ AvatarListBox::~AvatarListBox()
}
}
-void AvatarListBox::draw(Graphics *gcnGraphics)
+void AvatarListBox::draw(Graphics *graphics)
{
BLOCK_START("AvatarListBox::draw")
if (!mListModel || !player_node)
@@ -102,10 +102,8 @@ void AvatarListBox::draw(Graphics *gcnGraphics)
AvatarListModel *const model = static_cast<AvatarListModel *const>(
mListModel);
updateAlpha();
- Graphics *const graphics = static_cast<Graphics *const>(gcnGraphics);
gcn::Font *const font = getFont();
-
const int fontHeight = getFont()->getHeight();
const gcn::Widget *const parent = mParent;
const std::string name = player_node->getName();
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp
index e0fbf3d17..024dde9c8 100644
--- a/src/gui/widgets/browserbox.cpp
+++ b/src/gui/widgets/browserbox.cpp
@@ -453,7 +453,6 @@ void BrowserBox::draw(Graphics *graphics)
const gcn::ClipRectangle *const cr = graphics->getCurrentClipArea();
if (!cr)
return;
- Graphics *const graphics2 = static_cast<Graphics *const>(graphics);
mYStart = cr->y - cr->yOffset;
const int yEnd = mYStart + cr->height;
if (mYStart < 0)
@@ -503,7 +502,7 @@ void BrowserBox::draw(Graphics *graphics)
break;
if (!part.mType)
{
- graphics2->setColorAll(part.mColor, part.mColor2);
+ graphics->setColorAll(part.mColor, part.mColor2);
if (part.mBold)
boldFont->drawString(graphics, part.mText, part.mX, part.mY);
else
@@ -511,7 +510,7 @@ void BrowserBox::draw(Graphics *graphics)
}
else if (part.mImage)
{
- graphics2->drawImage2(part.mImage, part.mX, part.mY);
+ graphics->drawImage2(part.mImage, part.mX, part.mY);
}
}
diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp
index 8954ecf8e..6d326116d 100644
--- a/src/gui/widgets/button.cpp
+++ b/src/gui/widgets/button.cpp
@@ -373,8 +373,6 @@ void Button::draw(Graphics *graphics)
updateAlpha();
- Graphics *const g2 = static_cast<Graphics *const>(graphics);
-
bool recalc = false;
if (mRedraw)
{
@@ -384,7 +382,7 @@ void Button::draw(Graphics *graphics)
{
// because we don't know where parent windows was moved,
// need recalc vertexes
- gcn::ClipRectangle &rect = g2->getTopClip();
+ gcn::ClipRectangle &rect = graphics->getTopClip();
if (rect.xOffset != mXOffset || rect.yOffset != mYOffset)
{
recalc = true;
@@ -396,7 +394,7 @@ void Button::draw(Graphics *graphics)
recalc = true;
mMode = mode;
}
- else if (g2->getRedraw())
+ else if (graphics->getRedraw())
{
recalc = true;
}
@@ -408,16 +406,16 @@ void Button::draw(Graphics *graphics)
switch (mode)
{
case BUTTON_DISABLED:
- g2->setColorAll(mDisabledColor, mDisabledColor2);
+ graphics->setColorAll(mDisabledColor, mDisabledColor2);
break;
case BUTTON_PRESSED:
- g2->setColorAll(mPressedColor, mPressedColor2);
+ graphics->setColorAll(mPressedColor, mPressedColor2);
break;
case BUTTON_HIGHLIGHTED:
- g2->setColorAll(mHighlightedColor, mHighlightedColor2);
+ graphics->setColorAll(mHighlightedColor, mHighlightedColor2);
break;
default:
- g2->setColorAll(mEnabledColor, mEnabledColor2);
+ graphics->setColorAll(mEnabledColor, mEnabledColor2);
break;
}
@@ -481,39 +479,39 @@ void Button::draw(Graphics *graphics)
mRedraw = false;
mMode = mode;
mVertexes2->clear();
- g2->calcWindow(mVertexes2, 0, 0, width, height,
+ graphics->calcWindow(mVertexes2,
+ 0, 0,
+ width, height,
skin->getBorder());
if (mImages)
{
if (isPressed())
{
- g2->calcTileCollection(mVertexes2, mImages[mode],
+ graphics->calcTileCollection(mVertexes2,
+ mImages[mode],
imageX + 1, imageY + 1);
}
else
{
- g2->calcTileCollection(mVertexes2,
- mImages[mode], imageX, imageY);
+ graphics->calcTileCollection(mVertexes2,
+ mImages[mode],
+ imageX, imageY);
}
}
}
- g2->drawTileCollection(mVertexes2);
+ graphics->drawTileCollection(mVertexes2);
}
else
{
- g2->drawImageRect(0, 0, width, height, skin->getBorder());
+ graphics->drawImageRect(0, 0, width, height, skin->getBorder());
if (mImages)
{
if (isPressed())
- {
- g2->drawImage2(mImages[mode], imageX + 1, imageY + 1);
- }
+ graphics->drawImage2(mImages[mode], imageX + 1, imageY + 1);
else
- {
- g2->drawImage2(mImages[mode], imageX, imageY);
- }
+ graphics->drawImage2(mImages[mode], imageX, imageY);
}
}
@@ -522,7 +520,7 @@ void Button::draw(Graphics *graphics)
textX ++;
textY ++;
}
- font->drawString(g2, mCaption, textX, textY);
+ font->drawString(graphics, mCaption, textX, textY);
BLOCK_END("Button::draw")
}
diff --git a/src/gui/widgets/checkbox.cpp b/src/gui/widgets/checkbox.cpp
index e72296516..2f11dc2ce 100644
--- a/src/gui/widgets/checkbox.cpp
+++ b/src/gui/widgets/checkbox.cpp
@@ -100,9 +100,7 @@ void CheckBox::draw(Graphics *const graphics)
drawBox(graphics);
gcn::Font *const font = getFont();
- static_cast<Graphics *const>(graphics)->setColorAll(
- mForegroundColor, mForegroundColor2);
-
+ graphics->setColorAll(mForegroundColor, mForegroundColor2);
font->drawString(graphics, mCaption, mPadding + mImageSize + mSpacing,
mPadding);
BLOCK_END("CheckBox::draw")
@@ -167,8 +165,9 @@ void CheckBox::drawBox(Graphics *const graphics)
if (box)
{
- static_cast<Graphics*>(graphics)->drawImage2(
- box, mImagePadding, (getHeight() - mImageSize) / 2);
+ graphics->drawImage2(box,
+ mImagePadding,
+ (getHeight() - mImageSize) / 2);
}
}
diff --git a/src/gui/widgets/colorpage.cpp b/src/gui/widgets/colorpage.cpp
index 1d85874df..a9cf4f71e 100644
--- a/src/gui/widgets/colorpage.cpp
+++ b/src/gui/widgets/colorpage.cpp
@@ -53,7 +53,6 @@ void ColorPage::draw(Graphics *graphics)
const ColorModel *const model = static_cast<ColorModel* const>(
mListModel);
- Graphics *const g = static_cast<Graphics *const>(graphics);
mHighlightColor.a = static_cast<int>(mAlpha * 255.0F);
graphics->setColor(mHighlightColor);
@@ -70,20 +69,20 @@ void ColorPage::draw(Graphics *graphics)
mDimension.width - 2 * mPadding, rowHeight));
const ColorPair *const colors = model->getColorAt(mSelected);
- g->setColorAll(*colors->color1, *colors->color2);
+ graphics->setColorAll(*colors->color1, *colors->color2);
const std::string str = mListModel->getElementAt(mSelected);
font->drawString(graphics, str, (width - font->getWidth(str)) / 2,
mSelected * rowHeight + mPadding);
}
- g->setColorAll(mForegroundColor, mForegroundColor2);
+ graphics->setColorAll(mForegroundColor, mForegroundColor2);
const int sz = mListModel->getNumberOfElements();
for (int i = 0, y = mPadding; i < sz; ++i, y += rowHeight)
{
if (i != mSelected)
{
const ColorPair *const colors = model->getColorAt(i);
- g->setColorAll(*colors->color1, *colors->color2);
+ graphics->setColorAll(*colors->color1, *colors->color2);
const std::string str = mListModel->getElementAt(i);
font->drawString(graphics, str, (width - font->getWidth(str)) / 2,
y);
diff --git a/src/gui/widgets/desktop.cpp b/src/gui/widgets/desktop.cpp
index 4a4a73b53..b46fe3289 100644
--- a/src/gui/widgets/desktop.cpp
+++ b/src/gui/widgets/desktop.cpp
@@ -106,7 +106,6 @@ void Desktop::widgetResized(const gcn::Event &event A_UNUSED)
void Desktop::draw(Graphics *graphics)
{
BLOCK_START("Desktop::draw")
- Graphics *const g = static_cast<Graphics *const>(graphics);
const gcn::Rectangle &rect = mDimension;
const int width = rect.width;
@@ -118,30 +117,30 @@ void Desktop::draw(Graphics *graphics)
if (width > wallpWidth || height > wallpHeight)
{
- g->setColor(mBackgroundGrayColor);
- g->fillRectangle(gcn::Rectangle(0, 0, width, height));
+ graphics->setColor(mBackgroundGrayColor);
+ graphics->fillRectangle(gcn::Rectangle(0, 0, width, height));
}
if (imageHelper->useOpenGL() == RENDER_SOFTWARE)
{
- g->drawImage2(mWallpaper,
+ graphics->drawImage2(mWallpaper,
(width - wallpWidth) / 2,
(height - wallpHeight) / 2);
}
else
{
- g->drawRescaledImage(mWallpaper, 0, 0, width, height);
+ graphics->drawRescaledImage(mWallpaper, 0, 0, width, height);
}
}
else
{
- g->setColor(mBackgroundGrayColor);
- g->fillRectangle(gcn::Rectangle(0, 0, width, height));
+ graphics->setColor(mBackgroundGrayColor);
+ graphics->fillRectangle(gcn::Rectangle(0, 0, width, height));
}
// Draw a thin border under the application version...
- g->setColor(mBackgroundColor);
- g->fillRectangle(gcn::Rectangle(mVersionLabel->getDimension()));
+ graphics->setColor(mBackgroundColor);
+ graphics->fillRectangle(gcn::Rectangle(mVersionLabel->getDimension()));
Container::draw(graphics);
BLOCK_END("Desktop::draw")
diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp
index 354c88423..7aa53e83f 100644
--- a/src/gui/widgets/dropdown.cpp
+++ b/src/gui/widgets/dropdown.cpp
@@ -235,8 +235,7 @@ void DropDown::draw(Graphics* graphics)
if (model && mPopup->getSelected() >= 0)
{
gcn::Font *const font = getFont();
- static_cast<Graphics *const>(graphics)->setColorAll(
- mForegroundColor, mForegroundColor2);
+ graphics->setColorAll(mForegroundColor, mForegroundColor2);
if (mExtended)
{
const int sel = mPopup->getSelected();
@@ -250,9 +249,9 @@ void DropDown::draw(Graphics* graphics)
}
else
{
- static_cast<Graphics*>(graphics)->drawImage2(
- image, mImagePadding, (mDimension.height
- - image->getHeight()) / 2 + mPadding);
+ graphics->drawImage2(image,
+ mImagePadding,
+ (mDimension.height - image->getHeight()) / 2 + mPadding);
font->drawString(graphics, model->getElementAt(sel),
image->getWidth() + mImagePadding + mSpacing, mPadding);
}
@@ -291,8 +290,9 @@ void DropDown::drawFrame(Graphics *graphics)
BLOCK_START("DropDown::drawFrame")
const int bs2 = getFrameSize();
const gcn::Rectangle &rect = mDimension;
- static_cast<Graphics*>(graphics)->drawImageRect(
- 0, 0, rect.width + bs2, rect.height + bs2, skinRect);
+ graphics->drawImageRect(0, 0,
+ rect.width + bs2, rect.height + bs2,
+ skinRect);
BLOCK_END("DropDown::drawFrame")
}
@@ -303,7 +303,7 @@ void DropDown::drawButton(Graphics *graphics)
Image *image = buttons[mDroppedDown][mPushed];
if (image)
{
- static_cast<Graphics*>(graphics)->drawImage2(image,
+ 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 892a74638..9b37682fe 100644
--- a/src/gui/widgets/dropshortcutcontainer.cpp
+++ b/src/gui/widgets/dropshortcutcontainer.cpp
@@ -107,8 +107,7 @@ void DropShortcutContainer::draw(Graphics *graphics)
mBackgroundImg->setAlpha(mAlpha);
}
- Graphics *const g = static_cast<Graphics*>(graphics);
- drawBackground(g);
+ drawBackground(graphics);
const Inventory *const inv = PlayerInfo::getInventory();
if (!inv)
@@ -144,12 +143,12 @@ void DropShortcutContainer::draw(Graphics *graphics)
caption = "Eq.";
image->setAlpha(1.0F);
- g->drawImage2(image, itemX, itemY);
+ graphics->drawImage2(image, itemX, itemY);
if (item->isEquipped())
- g->setColorAll(mEquipedColor, mEquipedColor2);
+ graphics->setColorAll(mEquipedColor, mEquipedColor2);
else
- g->setColorAll(mUnEquipedColor, mUnEquipedColor2);
- font->drawString(g, caption,
+ graphics->setColorAll(mUnEquipedColor, mUnEquipedColor2);
+ font->drawString(graphics, caption,
itemX + (mBoxWidth - font->getWidth(caption)) / 2,
itemY + mBoxHeight - 14);
}
diff --git a/src/gui/widgets/emotepage.cpp b/src/gui/widgets/emotepage.cpp
index 869ae5d08..6101c20ae 100644
--- a/src/gui/widgets/emotepage.cpp
+++ b/src/gui/widgets/emotepage.cpp
@@ -68,7 +68,6 @@ void EmotePage::draw(Graphics *graphics)
const std::vector<Image*> &images = mEmotes->getImages();
- Graphics *const g = static_cast<Graphics*>(graphics);
const unsigned int width = mDimension.width;
unsigned int x = 0;
unsigned int y = 0;
@@ -84,7 +83,7 @@ void EmotePage::draw(Graphics *graphics)
const Image *const image = *it;
if (image)
{
- g->calcTileCollection(mVertexes, image, x, y);
+ graphics->calcTileCollection(mVertexes, image, x, y);
x += emoteWidth;
if (x + emoteWidth > width)
{
@@ -94,7 +93,7 @@ void EmotePage::draw(Graphics *graphics)
}
}
}
- g->drawTileCollection(mVertexes);
+ graphics->drawTileCollection(mVertexes);
}
else
{
@@ -103,7 +102,7 @@ void EmotePage::draw(Graphics *graphics)
const Image *const image = *it;
if (image)
{
- g->drawImage2(image, x, y);
+ graphics->drawImage2(image, x, y);
x += emoteWidth;
if (x + emoteWidth > width)
{
diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp
index bdb5c3163..dc25d9e5c 100644
--- a/src/gui/widgets/emoteshortcutcontainer.cpp
+++ b/src/gui/widgets/emoteshortcutcontainer.cpp
@@ -112,11 +112,10 @@ void EmoteShortcutContainer::draw(Graphics *graphics)
mAlpha = client->getGuiAlpha();
}
- Graphics *const g = static_cast<Graphics *const>(graphics);
gcn::Font *const font = getFont();
- drawBackground(g);
+ drawBackground(graphics);
- g->setColorAll(mForegroundColor, mForegroundColor2);
+ graphics->setColorAll(mForegroundColor, mForegroundColor2);
for (unsigned i = 0; i < mMaxItems; i++)
{
const int emoteX = (i % mGridWidth) * mBoxWidth;
@@ -126,7 +125,7 @@ void EmoteShortcutContainer::draw(Graphics *graphics)
const std::string key = inputManager.getKeyValueString(
Input::KEY_EMOTE_1 + i);
- font->drawString(g, key, emoteX + 2, emoteY + 2);
+ font->drawString(graphics, key, emoteX + 2, emoteY + 2);
}
unsigned sz = static_cast<unsigned>(mEmoteImg.size());
if (sz > mMaxItems)
@@ -139,7 +138,8 @@ void EmoteShortcutContainer::draw(Graphics *graphics)
const AnimatedSprite *const sprite = emoteImg->sprite;
if (sprite)
{
- sprite->draw(g, (i % mGridWidth) * mBoxWidth + 2,
+ sprite->draw(graphics,
+ (i % mGridWidth) * mBoxWidth + 2,
(i / mGridWidth) * mBoxHeight + 10);
}
}
diff --git a/src/gui/widgets/extendedlistbox.cpp b/src/gui/widgets/extendedlistbox.cpp
index 66065295c..f06e89e55 100644
--- a/src/gui/widgets/extendedlistbox.cpp
+++ b/src/gui/widgets/extendedlistbox.cpp
@@ -56,7 +56,6 @@ void ExtendedListBox::draw(Graphics *graphics)
BLOCK_START("ExtendedListBox::draw")
ExtendedListModel *const model = static_cast<ExtendedListModel* const>(
mListModel);
- Graphics *const g = static_cast<Graphics *const>(graphics);
updateAlpha();
gcn::Font *const font = getFont();
@@ -147,13 +146,14 @@ void ExtendedListBox::draw(Graphics *graphics)
const Image *const image = model->getImageAt(row1);
if (image)
{
- g->drawImage2(image, mImagePadding, item.y + (height
- - image->getHeight()) / 2 + mPadding);
+ graphics->drawImage2(image,
+ mImagePadding,
+ item.y + (height - image->getHeight()) / 2 + mPadding);
}
}
}
- g->setColorAll(mForegroundColor, mForegroundColor2);
+ graphics->setColorAll(mForegroundColor, mForegroundColor2);
for (int f = 0; f < itemsSz; ++f)
{
@@ -181,13 +181,14 @@ void ExtendedListBox::draw(Graphics *graphics)
const Image *const image = model->getImageAt(row1);
if (image)
{
- g->drawImage2(image, mImagePadding, item.y + (height
- - image->getHeight()) / 2 + mPadding);
+ graphics->drawImage2(image,
+ mImagePadding,
+ item.y + (height - image->getHeight()) / 2 + mPadding);
}
}
}
- g->setColorAll(mForegroundSelectedColor, mForegroundSelectedColor2);
+ graphics->setColorAll(mForegroundSelectedColor, mForegroundSelectedColor2);
for (int f = 0; f < selSz; ++f)
{
diff --git a/src/gui/widgets/icon.cpp b/src/gui/widgets/icon.cpp
index e9b7cd525..66313d397 100644
--- a/src/gui/widgets/icon.cpp
+++ b/src/gui/widgets/icon.cpp
@@ -67,12 +67,11 @@ void Icon::setImage(Image *const image)
}
}
-void Icon::draw(Graphics *g)
+void Icon::draw(Graphics *graphics)
{
BLOCK_START("Icon::draw")
if (mImage)
{
- Graphics *const graphics = static_cast<Graphics*>(g);
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 eedbc1bd0..0913dcae3 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -251,7 +251,6 @@ void ItemContainer::draw(Graphics *graphics)
return;
BLOCK_START("ItemContainer::draw")
- Graphics *const g = static_cast<Graphics *const>(graphics);
gcn::Font *const font = getFont();
for (int j = 0; j < mGridRows; j++)
@@ -278,16 +277,18 @@ void ItemContainer::draw(Graphics *graphics)
if (mShowMatrix[itemIndex] == mSelectedIndex)
{
if (mSelImg)
- g->drawImage2(mSelImg, itemX, itemY);
+ graphics->drawImage2(mSelImg, itemX, itemY);
}
image->setAlpha(1.0F); // ensure the image if fully drawn...
- g->drawImage2(image, itemX + mPaddingItemX,
+ graphics->drawImage2(image,
+ itemX + mPaddingItemX,
itemY + mPaddingItemY);
if (mProtectedImg && PlayerInfo::isItemProtected(
item->getId()))
{
- g->drawImage2(mProtectedImg,
- itemX + mPaddingItemX, itemY + mPaddingItemY);
+ graphics->drawImage2(mProtectedImg,
+ itemX + mPaddingItemX,
+ itemY + mPaddingItemY);
}
}
}
@@ -324,11 +325,11 @@ void ItemContainer::draw(Graphics *graphics)
}
if (item->isEquipped())
- g->setColorAll(mEquipedColor, mEquipedColor2);
+ graphics->setColorAll(mEquipedColor, mEquipedColor2);
else
- g->setColorAll(mUnEquipedColor, mUnEquipedColor2);
+ graphics->setColorAll(mUnEquipedColor, mUnEquipedColor2);
- font->drawString(g, caption,
+ font->drawString(graphics, caption,
itemX + (mBoxWidth - font->getWidth(caption)) / 2,
itemY + mEquippedTextPadding);
}
diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp
index 78b9c0e62..2438050d9 100644
--- a/src/gui/widgets/itemshortcutcontainer.cpp
+++ b/src/gui/widgets/itemshortcutcontainer.cpp
@@ -129,9 +129,8 @@ void ItemShortcutContainer::draw(Graphics *graphics)
mAlpha = client->getGuiAlpha();
}
- Graphics *const g = static_cast<Graphics*>(graphics);
gcn::Font *const font = getFont();
- drawBackground(g);
+ drawBackground(graphics);
const Inventory *const inv = PlayerInfo::getInventory();
if (!inv)
@@ -149,8 +148,8 @@ void ItemShortcutContainer::draw(Graphics *graphics)
// Draw item keyboard shortcut.
const std::string key = inputManager.getKeyValueString(
Input::KEY_SHORTCUT_1 + i);
- g->setColorAll(mForegroundColor, mForegroundColor);
- font->drawString(g, key, itemX + 2, itemY + 2);
+ graphics->setColorAll(mForegroundColor, mForegroundColor);
+ font->drawString(graphics, key, itemX + 2, itemY + 2);
const int itemId = selShortcut->getItem(i);
const unsigned char itemColor = selShortcut->getItemColor(i);
@@ -175,12 +174,17 @@ void ItemShortcutContainer::draw(Graphics *graphics)
caption = "Eq.";
image->setAlpha(1.0F);
- g->drawImage2(image, itemX, itemY);
+ graphics->drawImage2(image, itemX, itemY);
if (item->isEquipped())
- g->setColorAll(mEquipedColor, mEquipedColor2);
+ {
+ graphics->setColorAll(mEquipedColor, mEquipedColor2);
+ }
else
- g->setColorAll(mUnEquipedColor, mUnEquipedColor2);
- font->drawString(g, caption,
+ {
+ graphics->setColorAll(mUnEquipedColor,
+ mUnEquipedColor2);
+ }
+ font->drawString(graphics, caption,
itemX + (mBoxWidth - font->getWidth(caption)) / 2,
itemY + mBoxHeight - 14);
}
@@ -199,11 +203,11 @@ void ItemShortcutContainer::draw(Graphics *graphics)
if (image)
{
image->setAlpha(1.0F);
- g->drawImage2(image, itemX, itemY);
+ graphics->drawImage2(image, itemX, itemY);
}
}
- font->drawString(g, spell->getSymbol(),
+ font->drawString(graphics, spell->getSymbol(),
itemX + 2, itemY + mBoxHeight / 2);
}
}
@@ -218,10 +222,10 @@ void ItemShortcutContainer::draw(Graphics *graphics)
if (image)
{
image->setAlpha(1.0F);
- g->drawImage2(image, itemX, itemY);
+ graphics->drawImage2(image, itemX, itemY);
}
- font->drawString(g, skill->data->shortName, itemX + 2,
+ font->drawString(graphics, skill->data->shortName, itemX + 2,
itemY + mBoxHeight / 2);
}
}
diff --git a/src/gui/widgets/label.cpp b/src/gui/widgets/label.cpp
index 89ba17cd6..b2b709052 100644
--- a/src/gui/widgets/label.cpp
+++ b/src/gui/widgets/label.cpp
@@ -101,8 +101,7 @@ void Label::draw(Graphics* graphics)
break;
}
- static_cast<Graphics*>(graphics)->setColorAll(
- mForegroundColor, mForegroundColor2);
+ graphics->setColorAll(mForegroundColor, mForegroundColor2);
font->drawString(graphics, mCaption, textX, textY);
BLOCK_END("Label::draw")
}
diff --git a/src/gui/widgets/listbox.cpp b/src/gui/widgets/listbox.cpp
index 0a7956476..e71907f37 100644
--- a/src/gui/widgets/listbox.cpp
+++ b/src/gui/widgets/listbox.cpp
@@ -106,7 +106,6 @@ void ListBox::draw(Graphics *graphics)
BLOCK_START("ListBox::draw")
updateAlpha();
- Graphics *const g = static_cast<Graphics*>(graphics);
mHighlightColor.a = static_cast<int>(mAlpha * 255.0F);
graphics->setColor(mHighlightColor);
@@ -123,7 +122,7 @@ void ListBox::draw(Graphics *graphics)
rowHeight * mSelected + mPadding,
mDimension.width - 2 * mPadding, rowHeight));
- g->setColorAll(mForegroundSelectedColor,
+ graphics->setColorAll(mForegroundSelectedColor,
mForegroundSelectedColor2);
const std::string str = mListModel->getElementAt(mSelected);
font->drawString(graphics, str,
@@ -131,7 +130,7 @@ void ListBox::draw(Graphics *graphics)
mSelected * rowHeight + mPadding + mItemPadding);
}
// Draw the list elements
- g->setColorAll(mForegroundColor, mForegroundColor2);
+ graphics->setColorAll(mForegroundColor, mForegroundColor2);
const int sz = mListModel->getNumberOfElements();
for (int i = 0, y = mPadding + mItemPadding;
i < sz; ++i, y += rowHeight)
@@ -153,14 +152,14 @@ void ListBox::draw(Graphics *graphics)
rowHeight * mSelected + mPadding,
mDimension.width - 2 * mPadding, rowHeight));
- g->setColorAll(mForegroundSelectedColor,
+ graphics->setColorAll(mForegroundSelectedColor,
mForegroundSelectedColor2);
const std::string str = mListModel->getElementAt(mSelected);
font->drawString(graphics, str, mPadding,
mSelected * rowHeight + mPadding + mItemPadding);
}
// Draw the list elements
- g->setColorAll(mForegroundColor, mForegroundColor2);
+ graphics->setColorAll(mForegroundColor, mForegroundColor2);
const int sz = mListModel->getNumberOfElements();
for (int i = 0, y = mPadding + mItemPadding; i < sz;
++i, y += rowHeight)
diff --git a/src/gui/widgets/playerbox.cpp b/src/gui/widgets/playerbox.cpp
index 260f80099..0639fe1b0 100644
--- a/src/gui/widgets/playerbox.cpp
+++ b/src/gui/widgets/playerbox.cpp
@@ -115,7 +115,7 @@ void PlayerBox::draw(Graphics *graphics)
const int bs = mFrameSize;
const int x = mDimension.width / 2 + bs + mOffsetX;
const int y = mDimension.height - bs + mOffsetY;
- mBeing->drawSpriteAt(static_cast<Graphics*>(graphics), x, y);
+ mBeing->drawSpriteAt(graphics, x, y);
}
if (client->getGuiAlpha() != mAlpha)
@@ -140,15 +140,9 @@ void PlayerBox::drawFrame(Graphics *graphics)
const int h = mDimension.height + bs;
if (!mSelected)
- {
- static_cast<Graphics*>(graphics)->drawImageRect(
- 0, 0, w, h, mBackground);
- }
+ graphics->drawImageRect(0, 0, w, h, mBackground);
else
- {
- static_cast<Graphics*>(graphics)->drawImageRect(
- 0, 0, w, h, mSelectedBackground);
- }
+ graphics->drawImageRect(0, 0, w, h, mSelectedBackground);
}
BLOCK_END("PlayerBox::drawFrame")
}
diff --git a/src/gui/widgets/popup.cpp b/src/gui/widgets/popup.cpp
index 56d5d0d0c..c1319737e 100644
--- a/src/gui/widgets/popup.cpp
+++ b/src/gui/widgets/popup.cpp
@@ -97,7 +97,6 @@ void Popup::setWindowContainer(WindowContainer *const wc)
void Popup::draw(Graphics *graphics)
{
BLOCK_START("Popup::draw")
- Graphics *const g = static_cast<Graphics*>(graphics);
if (mSkin)
{
@@ -107,16 +106,18 @@ void Popup::draw(Graphics *graphics)
{
mRedraw = false;
mVertexes->clear();
- g->calcWindow(mVertexes, 0, 0,
+ graphics->calcWindow(mVertexes,
+ 0, 0,
mDimension.width, mDimension.height,
mSkin->getBorder());
}
- g->drawTileCollection(mVertexes);
+ graphics->drawTileCollection(mVertexes);
}
else
{
- g->drawImageRect(0, 0, mDimension.width, mDimension.height,
+ graphics->drawImageRect(0, 0,
+ mDimension.width, mDimension.height,
mSkin->getBorder());
}
}
diff --git a/src/gui/widgets/progressbar.cpp b/src/gui/widgets/progressbar.cpp
index 28c87f4ec..242b6ba6e 100644
--- a/src/gui/widgets/progressbar.cpp
+++ b/src/gui/widgets/progressbar.cpp
@@ -151,7 +151,7 @@ void ProgressBar::draw(Graphics *graphics)
BLOCK_START("ProgressBar::draw")
updateAlpha();
mBackgroundColor.a = static_cast<int>(mAlpha * 255);
- render(static_cast<Graphics*>(graphics));
+ render(graphics);
BLOCK_END("ProgressBar::draw")
}
diff --git a/src/gui/widgets/progressindicator.cpp b/src/gui/widgets/progressindicator.cpp
index 358518132..b3f5b0e54 100644
--- a/src/gui/widgets/progressindicator.cpp
+++ b/src/gui/widgets/progressindicator.cpp
@@ -73,7 +73,7 @@ void ProgressIndicator::draw(Graphics *graphics)
// Draw the indicator centered on the widget
const int x = (mDimension.width - 32) / 2;
const int y = (mDimension.height - 32) / 2;
- mIndicator->draw(static_cast<Graphics*>(graphics), x, y);
+ mIndicator->draw(graphics, x, y);
}
BLOCK_END("ProgressIndicator::draw")
}
diff --git a/src/gui/widgets/radiobutton.cpp b/src/gui/widgets/radiobutton.cpp
index 4a47a4b4e..092841dcf 100644
--- a/src/gui/widgets/radiobutton.cpp
+++ b/src/gui/widgets/radiobutton.cpp
@@ -149,8 +149,9 @@ void RadioButton::drawBox(Graphics* graphics)
if (box)
{
- static_cast<Graphics*>(graphics)->drawImage2(
- box, mImagePadding, (getHeight() - mImageSize) / 2);
+ graphics->drawImage2(box,
+ mImagePadding,
+ (getHeight() - mImageSize) / 2);
}
}
@@ -160,9 +161,7 @@ void RadioButton::draw(Graphics* graphics)
drawBox(graphics);
gcn::Font *const font = getFont();
- static_cast<Graphics *const>(graphics)->setColorAll(
- mForegroundColor, mForegroundColor2);
-
+ graphics->setColorAll(mForegroundColor, mForegroundColor2);
font->drawString(graphics, mCaption, mPadding + mImageSize + mSpacing,
mPadding);
BLOCK_END("RadioButton::draw")
diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp
index 89e75f4d7..26add84c1 100644
--- a/src/gui/widgets/scrollarea.cpp
+++ b/src/gui/widgets/scrollarea.cpp
@@ -282,8 +282,7 @@ void ScrollArea::draw(Graphics *graphics)
calcHMarker(graphics);
}
}
- static_cast<Graphics *const>(graphics)->drawTileCollection(
- mVertexes);
+ graphics->drawTileCollection(mVertexes);
}
else
{
@@ -315,11 +314,10 @@ void ScrollArea::draw(Graphics *graphics)
if (mRedraw)
{
- Graphics *g = static_cast<Graphics *const>(graphics);
- const bool redraw = g->getRedraw();
- g->setRedraw(true);
+ const bool redraw = graphics->getRedraw();
+ graphics->setRedraw(true);
drawChildren(graphics);
- g->setRedraw(redraw);
+ graphics->setRedraw(redraw);
}
else
{
@@ -335,8 +333,7 @@ void ScrollArea::updateCalcFlag(Graphics *const graphics)
{
// because we don't know where parent windows was moved,
// need recalc vertexes
- const gcn::ClipRectangle &rect = static_cast<Graphics*>(
- graphics)->getTopClip();
+ const gcn::ClipRectangle &rect = graphics->getTopClip();
if (rect.xOffset != mXOffset || rect.yOffset != mYOffset)
{
mRedraw = true;
@@ -349,7 +346,7 @@ void ScrollArea::updateCalcFlag(Graphics *const graphics)
mDrawWidth = rect.width;
mDrawHeight = rect.height;
}
- else if (static_cast<Graphics*>(graphics)->getRedraw())
+ else if (graphics->getRedraw())
{
mRedraw = true;
}
@@ -372,15 +369,18 @@ void ScrollArea::drawFrame(Graphics *graphics)
if (mRedraw)
{
mVertexes2->clear();
- static_cast<Graphics*>(graphics)->calcWindow(
- mVertexes2, 0, 0, w, h, background);
+ graphics->calcWindow(mVertexes2,
+ 0, 0,
+ w, h,
+ background);
}
- static_cast<Graphics*>(graphics)->drawTileCollection(mVertexes2);
+ graphics->drawTileCollection(mVertexes2);
}
else
{
- static_cast<Graphics*>(graphics)->drawImageRect(
- 0, 0, w, h, background);
+ graphics->drawImageRect(0, 0,
+ w, h,
+ background);
}
}
BLOCK_END("ScrollArea::drawFrame")
@@ -424,10 +424,7 @@ void ScrollArea::drawButton(Graphics *const graphics,
}
if (buttons[dir][state])
- {
- static_cast<Graphics*>(graphics)->drawImage2(
- buttons[dir][state], dim.x, dim.y);
- }
+ graphics->drawImage2(buttons[dir][state], dim.x, dim.y);
}
void ScrollArea::calcButton(Graphics *const graphics,
@@ -471,21 +468,21 @@ void ScrollArea::calcButton(Graphics *const graphics,
void ScrollArea::drawVBar(Graphics *const graphics)
{
const gcn::Rectangle &dim = getVerticalBarDimension();
- Graphics *const g = static_cast<Graphics*>(graphics);
if (vBackground.grid[4])
{
- g->drawPattern(vBackground.grid[4],
+ graphics->drawPattern(vBackground.grid[4],
dim.x, dim.y, dim.width, dim.height);
}
if (vBackground.grid[1])
{
- g->drawPattern(vBackground.grid[1],
- dim.x, dim.y, dim.width, vBackground.grid[1]->getHeight());
+ graphics->drawPattern(vBackground.grid[1],
+ dim.x, dim.y,
+ dim.width, vBackground.grid[1]->getHeight());
}
if (vBackground.grid[7])
{
- g->drawPattern(vBackground.grid[7],
+ graphics->drawPattern(vBackground.grid[7],
dim.x, dim.height - vBackground.grid[7]->getHeight() + dim.y,
dim.width, vBackground.grid[7]->getHeight());
}
@@ -494,21 +491,25 @@ void ScrollArea::drawVBar(Graphics *const graphics)
void ScrollArea::calcVBar(Graphics *const graphics)
{
const gcn::Rectangle &dim = getVerticalBarDimension();
- Graphics *const g = static_cast<Graphics *const>(graphics);
if (vBackground.grid[4])
{
- g->calcPattern(mVertexes, vBackground.grid[4],
- dim.x, dim.y, dim.width, dim.height);
+ graphics->calcPattern(mVertexes,
+ vBackground.grid[4],
+ dim.x, dim.y,
+ dim.width, dim.height);
}
if (vBackground.grid[1])
{
- g->calcPattern(mVertexes, vBackground.grid[1],
- dim.x, dim.y, dim.width, vBackground.grid[1]->getHeight());
+ graphics->calcPattern(mVertexes,
+ vBackground.grid[1],
+ dim.x, dim.y,
+ dim.width, vBackground.grid[1]->getHeight());
}
if (vBackground.grid[7])
{
- g->calcPattern(mVertexes, vBackground.grid[7],
+ graphics->calcPattern(mVertexes,
+ vBackground.grid[7],
dim.x, dim.height - vBackground.grid[7]->getHeight() + dim.y,
dim.width, vBackground.grid[7]->getHeight());
}
@@ -517,50 +518,59 @@ void ScrollArea::calcVBar(Graphics *const graphics)
void ScrollArea::drawHBar(Graphics *const graphics)
{
const gcn::Rectangle &dim = getHorizontalBarDimension();
- Graphics *const g = static_cast<Graphics*>(graphics);
if (hBackground.grid[4])
{
- g->drawPattern(hBackground.grid[4],
- dim.x, dim.y, dim.width, dim.height);
+ graphics->drawPattern(hBackground.grid[4],
+ dim.x, dim.y,
+ dim.width, dim.height);
}
if (hBackground.grid[3])
{
- g->drawPattern(hBackground.grid[3],
- dim.x, dim.y, hBackground.grid[3]->getWidth(), dim.height);
+ graphics->drawPattern(hBackground.grid[3],
+ dim.x, dim.y,
+ hBackground.grid[3]->getWidth(), dim.height);
}
if (hBackground.grid[5])
{
- g->drawPattern(hBackground.grid[5],
- dim.x + dim.width - hBackground.grid[5]->getWidth(), dim.y,
- hBackground.grid[5]->getWidth(), dim.height);
+ graphics->drawPattern(hBackground.grid[5],
+ dim.x + dim.width - hBackground.grid[5]->getWidth(),
+ dim.y,
+ hBackground.grid[5]->getWidth(),
+ dim.height);
}
}
void ScrollArea::calcHBar(Graphics *const graphics)
{
const gcn::Rectangle &dim = getHorizontalBarDimension();
- Graphics *const g = static_cast<Graphics*>(graphics);
if (hBackground.grid[4])
{
- g->calcPattern(mVertexes, hBackground.grid[4],
- dim.x, dim.y, dim.width, dim.height);
+ graphics->calcPattern(mVertexes,
+ hBackground.grid[4],
+ dim.x, dim.y,
+ dim.width, dim.height);
}
if (hBackground.grid[3])
{
- g->calcPattern(mVertexes, hBackground.grid[3],
- dim.x, dim.y, hBackground.grid[3]->getWidth(), dim.height);
+ graphics->calcPattern(mVertexes,
+ hBackground.grid[3],
+ dim.x, dim.y,
+ hBackground.grid[3]->getWidth(), dim.height);
}
if (hBackground.grid[5])
{
- g->calcPattern(mVertexes, hBackground.grid[5],
- dim.x + dim.width - hBackground.grid[5]->getWidth(), dim.y,
- hBackground.grid[5]->getWidth(), dim.height);
+ graphics->calcPattern(mVertexes,
+ hBackground.grid[5],
+ dim.x + dim.width - hBackground.grid[5]->getWidth(),
+ dim.y,
+ hBackground.grid[5]->getWidth(),
+ dim.height);
}
}
@@ -570,13 +580,15 @@ void ScrollArea::drawVMarker(Graphics *const graphics)
if ((mHasMouse) && (mX > (mDimension.width - mScrollbarWidth)))
{
- static_cast<Graphics*>(graphics)->
- drawImageRect(dim.x, dim.y, dim.width, dim.height, vMarkerHi);
+ graphics->drawImageRect(dim.x, dim.y,
+ dim.width, dim.height,
+ vMarkerHi);
}
else
{
- static_cast<Graphics*>(graphics)->
- drawImageRect(dim.x, dim.y, dim.width, dim.height, vMarker);
+ graphics->drawImageRect(dim.x, dim.y,
+ dim.width, dim.height,
+ vMarker);
}
}
@@ -586,13 +598,17 @@ void ScrollArea::calcVMarker(Graphics *const graphics)
if ((mHasMouse) && (mX > (mDimension.width - mScrollbarWidth)))
{
- static_cast<Graphics*>(graphics)->calcWindow(
- mVertexes, dim.x, dim.y, dim.width, dim.height, vMarkerHi);
+ graphics->calcWindow(mVertexes,
+ dim.x, dim.y,
+ dim.width, dim.height,
+ vMarkerHi);
}
else
{
- static_cast<Graphics*>(graphics)->calcWindow(
- mVertexes, dim.x, dim.y, dim.width, dim.height, vMarker);
+ graphics->calcWindow(mVertexes,
+ dim.x, dim.y,
+ dim.width, dim.height,
+ vMarker);
}
}
@@ -602,13 +618,16 @@ void ScrollArea::drawHMarker(Graphics *const graphics)
if ((mHasMouse) && (mY > (mDimension.height - mScrollbarWidth)))
{
- static_cast<Graphics*>(graphics)->
- drawImageRect(dim.x, dim.y, dim.width, dim.height, vMarkerHi);
+ graphics->drawImageRect(dim.x, dim.y,
+ dim.width, dim.height,
+ vMarkerHi);
}
else
{
- static_cast<Graphics*>(graphics)->
- drawImageRect(dim.x, dim.y, dim.width, dim.height, vMarker);
+ graphics->drawImageRect(
+ dim.x, dim.y,
+ dim.width, dim.height,
+ vMarker);
}
}
@@ -618,13 +637,17 @@ void ScrollArea::calcHMarker(Graphics *const graphics)
if ((mHasMouse) && (mY > (mDimension.height - mScrollbarWidth)))
{
- static_cast<Graphics*>(graphics)->calcWindow(
- mVertexes, dim.x, dim.y, dim.width, dim.height, vMarkerHi);
+ graphics->calcWindow(mVertexes,
+ dim.x, dim.y,
+ dim.width, dim.height,
+ vMarkerHi);
}
else
{
- static_cast<Graphics*>(graphics)->calcWindow(
- mVertexes, dim.x, dim.y, dim.width, dim.height, vMarker);
+ graphics->calcWindow(mVertexes,
+ dim.x, dim.y,
+ dim.width, dim.height,
+ vMarker);
}
}
diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp
index 644023c43..8f45abeb3 100644
--- a/src/gui/widgets/shoplistbox.cpp
+++ b/src/gui/widgets/shoplistbox.cpp
@@ -82,7 +82,7 @@ void ShopListBox::setPlayersMoney(const int money)
mPlayerMoney = money;
}
-void ShopListBox::draw(Graphics *gcnGraphics)
+void ShopListBox::draw(Graphics *graphics)
{
BLOCK_START("ShopListBox::draw")
if (!mListModel || !mShopItems)
@@ -95,7 +95,6 @@ void ShopListBox::draw(Graphics *gcnGraphics)
mAlpha = client->getGuiAlpha();
const int alpha = static_cast<int>(mAlpha * 255.0F);
- Graphics *graphics = static_cast<Graphics*>(gcnGraphics);
gcn::Font *const font = getFont();
const int sz = mListModel->getNumberOfElements();
diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp
index 1427bb6eb..8eb27824d 100644
--- a/src/gui/widgets/slider.cpp
+++ b/src/gui/widgets/slider.cpp
@@ -133,19 +133,18 @@ void Slider::draw(Graphics *graphics)
int x = 0;
const int y = mHasMouse ? (h - buttons[1].grid[HSTART]->getHeight()) / 2 :
(h - buttons[0].grid[HSTART]->getHeight()) / 2;
- Graphics *const g = static_cast<Graphics*>(graphics);
updateAlpha();
if (isBatchDrawRenders(openGLMode))
{
- if (mRedraw || g->getRedraw())
+ if (mRedraw || graphics->getRedraw())
{
mRedraw = false;
mVertexes->clear();
if (!mHasMouse)
{
- g->calcTileCollection(mVertexes,
+ graphics->calcTileCollection(mVertexes,
buttons[0].grid[HSTART], x, y);
const int width = buttons[0].grid[HSTART]->getWidth();
@@ -155,24 +154,31 @@ void Slider::draw(Graphics *graphics)
if (buttons[0].grid[HMID])
{
const Image *const hMid = buttons[0].grid[HMID];
- g->calcPattern(mVertexes, hMid, x, y,
+ graphics->calcPattern(mVertexes,
+ hMid,
+ x, y,
w, hMid->getHeight());
}
x += w;
- g->calcTileCollection(mVertexes, buttons[0].grid[HEND], x, y);
+ graphics->calcTileCollection(mVertexes,
+ buttons[0].grid[HEND],
+ x, y);
const Image *const img = buttons[0].grid[HGRIP];
if (img)
{
- g->calcTileCollection(mVertexes, img, getMarkerPosition(),
+ graphics->calcTileCollection(mVertexes,
+ img,
+ getMarkerPosition(),
(mDimension.height - img->getHeight()) / 2);
}
}
else
{
- g->calcTileCollection(mVertexes,
- buttons[1].grid[HSTART], x, y);
+ graphics->calcTileCollection(mVertexes,
+ buttons[1].grid[HSTART],
+ x, y);
const int width = buttons[1].grid[HSTART]->getWidth();
w -= width;
@@ -183,32 +189,36 @@ void Slider::draw(Graphics *graphics)
if (buttons[1].grid[HMID])
{
const Image *const hMid = buttons[1].grid[HMID];
- g->calcPattern(mVertexes, hMid, x, y,
+ graphics->calcPattern(mVertexes,
+ hMid,
+ x, y,
w, hMid->getHeight());
}
x += w;
if (buttons[1].grid[HEND])
{
- g->calcTileCollection(mVertexes,
+ graphics->calcTileCollection(mVertexes,
buttons[1].grid[HEND], x, y);
}
const Image *const img = buttons[1].grid[HGRIP];
if (img)
{
- g->calcTileCollection(mVertexes, img, getMarkerPosition(),
+ graphics->calcTileCollection(mVertexes,
+ img,
+ getMarkerPosition(),
(mDimension.height - img->getHeight()) / 2);
}
}
}
- g->drawTileCollection(mVertexes);
+ graphics->drawTileCollection(mVertexes);
}
else
{
if (!mHasMouse)
{
- g->drawImage2(buttons[0].grid[HSTART], x, y);
+ graphics->drawImage2(buttons[0].grid[HSTART], x, y);
const int width = buttons[0].grid[HSTART]->getWidth();
w -= width + buttons[0].grid[HEND]->getWidth();
x += width;
@@ -216,22 +226,22 @@ void Slider::draw(Graphics *graphics)
if (buttons[0].grid[HMID])
{
const Image *const hMid = buttons[0].grid[HMID];
- g->drawPattern(hMid, x, y, w, hMid->getHeight());
+ graphics->drawPattern(hMid, x, y, w, hMid->getHeight());
}
x += w;
- g->drawImage2(buttons[0].grid[HEND], x, y);
+ graphics->drawImage2(buttons[0].grid[HEND], x, y);
const Image *const img = buttons[0].grid[HGRIP];
if (img)
{
- g->drawImage2(img, getMarkerPosition(),
+ graphics->drawImage2(img, getMarkerPosition(),
(mDimension.height - img->getHeight()) / 2);
}
}
else
{
- g->drawImage2(buttons[1].grid[HSTART], x, y);
+ graphics->drawImage2(buttons[1].grid[HSTART], x, y);
const int width = buttons[1].grid[HSTART]->getWidth();
w -= width;
@@ -242,17 +252,17 @@ void Slider::draw(Graphics *graphics)
if (buttons[1].grid[HMID])
{
const Image *const hMid = buttons[1].grid[HMID];
- g->drawPattern(hMid, x, y, w, hMid->getHeight());
+ graphics->drawPattern(hMid, x, y, w, hMid->getHeight());
}
x += w;
if (buttons[1].grid[HEND])
- g->drawImage2(buttons[1].grid[HEND], x, y);
+ graphics->drawImage2(buttons[1].grid[HEND], x, y);
const Image *const img = buttons[1].grid[HGRIP];
if (img)
{
- g->drawImage2(img, getMarkerPosition(),
+ graphics->drawImage2(img, getMarkerPosition(),
(mDimension.height - img->getHeight()) / 2);
}
}
diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp
index 7c59676b9..696b0fbb4 100644
--- a/src/gui/widgets/spellshortcutcontainer.cpp
+++ b/src/gui/widgets/spellshortcutcontainer.cpp
@@ -103,12 +103,11 @@ void SpellShortcutContainer::draw(Graphics *graphics)
mBackgroundImg->setAlpha(mAlpha);
}
- Graphics *const g = static_cast<Graphics *const>(graphics);
gcn::Font *const font = getFont();
const int selectedId = spellShortcut->getSelectedItem();
- g->setColorAll(mForegroundColor, mForegroundColor2);
- drawBackground(g);
+ graphics->setColorAll(mForegroundColor, mForegroundColor2);
+ drawBackground(graphics);
for (unsigned i = 0; i < mMaxItems; i++)
{
@@ -118,7 +117,7 @@ void SpellShortcutContainer::draw(Graphics *graphics)
const int itemId = getItemByIndex(i);
if (selectedId >= 0 && itemId == selectedId)
{
- g->drawRectangle(gcn::Rectangle(itemX + 1, itemY + 1,
+ graphics->drawRectangle(gcn::Rectangle(itemX + 1, itemY + 1,
mBoxWidth - 1, mBoxHeight - 1));
}
@@ -135,11 +134,11 @@ void SpellShortcutContainer::draw(Graphics *graphics)
if (image)
{
image->setAlpha(1.0F);
- g->drawImage2(image, itemX, itemY);
+ graphics->drawImage2(image, itemX, itemY);
}
}
- font->drawString(g, spell->getSymbol(),
+ font->drawString(graphics, spell->getSymbol(),
itemX + 2, itemY + mBoxHeight / 2);
}
}
diff --git a/src/gui/widgets/tabs/tab.cpp b/src/gui/widgets/tabs/tab.cpp
index d0561cadf..bba1ef7b6 100644
--- a/src/gui/widgets/tabs/tab.cpp
+++ b/src/gui/widgets/tabs/tab.cpp
@@ -204,19 +204,19 @@ void Tab::draw(Graphics *graphics)
updateAlpha();
- Graphics *const g = static_cast<Graphics*>(graphics);
-
// draw tab
if (isBatchDrawRenders(openGLMode))
{
const ImageRect &rect = skin->getBorder();
- if (mRedraw || mode != mMode || g->getRedraw())
+ if (mRedraw || mode != mMode || graphics->getRedraw())
{
mMode = mode;
mRedraw = false;
mVertexes->clear();
- g->calcWindow(mVertexes, 0, 0,
- mDimension.width, mDimension.height, rect);
+ graphics->calcWindow(mVertexes,
+ 0, 0,
+ mDimension.width, mDimension.height,
+ rect);
if (mImage)
{
@@ -224,25 +224,28 @@ void Tab::draw(Graphics *graphics)
if (skin1)
{
const int padding = skin1->getPadding();
- g->calcTileCollection(mVertexes, mImage,
- padding, padding);
+ graphics->calcTileCollection(mVertexes,
+ mImage,
+ padding,
+ padding);
}
}
}
- g->drawTileCollection(mVertexes);
+ graphics->drawTileCollection(mVertexes);
}
else
{
- g->drawImageRect(0, 0,
- mDimension.width, mDimension.height, skin->getBorder());
+ graphics->drawImageRect(0, 0,
+ mDimension.width, mDimension.height,
+ skin->getBorder());
if (mImage)
{
const Skin *const skin1 = tabImg[TAB_STANDARD];
if (skin1)
{
const int padding = skin1->getPadding();
- g->drawImage2(mImage, padding, padding);
+ graphics->drawImage2(mImage, padding, padding);
}
}
}
diff --git a/src/gui/widgets/textbox.cpp b/src/gui/widgets/textbox.cpp
index 8aaca4211..6bd301b32 100644
--- a/src/gui/widgets/textbox.cpp
+++ b/src/gui/widgets/textbox.cpp
@@ -367,8 +367,7 @@ void TextBox::draw(Graphics* graphics)
mCaretRow * font->getHeight());
}
- static_cast<Graphics*>(graphics)->setColorAll(
- mForegroundColor, mForegroundColor2);
+ graphics->setColorAll(mForegroundColor, mForegroundColor2);
const int fontHeight = font->getHeight();
for (size_t i = 0, sz = mTextRows.size(); i < sz; i++)
diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp
index b1d188f22..fdcd84089 100644
--- a/src/gui/widgets/textfield.cpp
+++ b/src/gui/widgets/textfield.cpp
@@ -149,8 +149,7 @@ void TextField::draw(Graphics *graphics)
font->getWidth(mText.substr(0, mCaretPosition)) - mXScroll);
}
- static_cast<Graphics*>(graphics)->setColorAll(
- mForegroundColor, mForegroundColor2);
+ graphics->setColorAll(mForegroundColor, mForegroundColor2);
font->drawString(graphics, mText, mPadding - mXScroll, mPadding);
BLOCK_END("TextField::draw")
}
@@ -159,8 +158,11 @@ void TextField::drawFrame(Graphics *graphics)
{
BLOCK_START("TextField::drawFrame")
const int bs = 2 * mFrameSize;
- static_cast<Graphics*>(graphics)->drawImageRect(0, 0,
- mDimension.width + bs, mDimension.height + bs, skin);
+ graphics->drawImageRect(0,
+ 0,
+ mDimension.width + bs,
+ mDimension.height + bs,
+ skin);
BLOCK_END("TextField::drawFrame")
}
diff --git a/src/gui/widgets/textpreview.cpp b/src/gui/widgets/textpreview.cpp
index 5cfb2abb5..5ef553b3c 100644
--- a/src/gui/widgets/textpreview.cpp
+++ b/src/gui/widgets/textpreview.cpp
@@ -84,18 +84,17 @@ void TextPreview::draw(Graphics* graphics)
BLOCK_START("TextPreview::draw")
if (client->getGuiAlpha() != mAlpha)
mAlpha = client->getGuiAlpha();
- Graphics *const g = static_cast<Graphics*>(graphics);
const int intAlpha = static_cast<int>(mAlpha * 255.0F);
const int alpha = mTextAlpha ? intAlpha : 255;
if (mOpaque)
{
- g->setColor(gcn::Color(static_cast<int>(mBGColor->r),
+ graphics->setColor(gcn::Color(static_cast<int>(mBGColor->r),
static_cast<int>(mBGColor->g),
static_cast<int>(mBGColor->b),
static_cast<int>(mAlpha * 255.0F)));
- g->fillRectangle(gcn::Rectangle(0, 0,
+ graphics->fillRectangle(gcn::Rectangle(0, 0,
mDimension.width, mDimension.height));
}
@@ -108,20 +107,20 @@ void TextPreview::draw(Graphics* graphics)
+ 2 * ((mOutline || mShadow) ? 1 :0);
const int y = font->getHeight() + 1
+ 2 * ((mOutline || mShadow) ? 1 : 0);
- g->setColor(gcn::Color(static_cast<int>(mTextBGColor->r),
+ graphics->setColor(gcn::Color(static_cast<int>(mTextBGColor->r),
static_cast<int>(mTextBGColor->g),
static_cast<int>(mTextBGColor->b),
intAlpha));
- g->fillRectangle(gcn::Rectangle(mPadding, mPadding, x, y));
+ graphics->fillRectangle(gcn::Rectangle(mPadding, mPadding, x, y));
}
}
- g->setColorAll(gcn::Color(mTextColor->r, mTextColor->g, mTextColor->b,
- alpha), gcn::Color(mTextColor2->r, mTextColor2->g, mTextColor2->b,
- alpha));
+ graphics->setColorAll(gcn::Color(mTextColor->r,
+ mTextColor->g, mTextColor->b, alpha),
+ gcn::Color(mTextColor2->r, mTextColor2->g, mTextColor2->b, alpha));
if (mOutline && mTextColor != mTextColor2)
- g->setColor2(Theme::getThemeColor(Theme::OUTLINE));
+ graphics->setColor2(Theme::getThemeColor(Theme::OUTLINE));
mFont->drawString(graphics, mText, mPadding + 1, mPadding + 1);
BLOCK_END("TextPreview::draw")
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index 26ca0a29f..54ec3c859 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -209,7 +209,6 @@ void Window::draw(Graphics *graphics)
return;
BLOCK_START("Window::draw")
- Graphics *const g = static_cast<Graphics*>(graphics);
bool update = false;
if (isBatchDrawRenders(openGLMode))
@@ -225,8 +224,11 @@ void Window::draw(Graphics *graphics)
mRedraw = false;
update = true;
mVertexes->clear();
- g->calcWindow(mVertexes, 0, 0, mDimension.width,
- mDimension.height, mSkin->getBorder());
+ graphics->calcWindow(mVertexes,
+ 0, 0,
+ mDimension.width,
+ mDimension.height,
+ mSkin->getBorder());
// Draw Close Button
if (mCloseWindowButton)
@@ -235,8 +237,10 @@ void Window::draw(Graphics *graphics)
mResizeHandles == CLOSE);
if (button)
{
- g->calcTileCollection(mVertexes, button,
- mCloseRect.x, mCloseRect.y);
+ graphics->calcTileCollection(mVertexes,
+ button,
+ mCloseRect.x,
+ mCloseRect.y);
}
}
// Draw Sticky Button
@@ -245,27 +249,33 @@ void Window::draw(Graphics *graphics)
const Image *const button = mSkin->getStickyImage(mSticky);
if (button)
{
- g->calcTileCollection(mVertexes, button,
- mStickyRect.x, mStickyRect.y);
+ graphics->calcTileCollection(mVertexes,
+ button,
+ mStickyRect.x,
+ mStickyRect.y);
}
}
if (mGrip)
{
- g->calcTileCollection(mVertexes, mGrip,
- mGripRect.x, mGripRect.y);
+ graphics->calcTileCollection(mVertexes,
+ mGrip,
+ mGripRect.x,
+ mGripRect.y);
}
}
else
{
mLastRedraw = false;
}
- g->drawTileCollection(mVertexes);
+ graphics->drawTileCollection(mVertexes);
}
else
{
- g->drawImageRect(0, 0, mDimension.width,
- mDimension.height, mSkin->getBorder());
+ graphics->drawImageRect(0, 0,
+ mDimension.width,
+ mDimension.height,
+ mSkin->getBorder());
// Draw Close Button
if (mCloseWindowButton)
@@ -273,24 +283,24 @@ void Window::draw(Graphics *graphics)
const Image *const button = mSkin->getCloseImage(
mResizeHandles == CLOSE);
if (button)
- g->drawImage2(button, mCloseRect.x, mCloseRect.y);
+ graphics->drawImage2(button, mCloseRect.x, mCloseRect.y);
}
// Draw Sticky Button
if (mStickyButton)
{
const Image *const button = mSkin->getStickyImage(mSticky);
if (button)
- g->drawImage2(button, mStickyRect.x, mStickyRect.y);
+ graphics->drawImage2(button, mStickyRect.x, mStickyRect.y);
}
if (mGrip)
- g->drawImage2(mGrip, mGripRect.x, mGripRect.y);
+ graphics->drawImage2(mGrip, mGripRect.x, mGripRect.y);
}
// Draw title
if (mShowTitle)
{
- g->setColorAll(mForegroundColor, mForegroundColor2);
+ graphics->setColorAll(mForegroundColor, mForegroundColor2);
int x;
switch (mCaptionAlign)
{
@@ -305,14 +315,14 @@ void Window::draw(Graphics *graphics)
x = mCaptionOffsetX - mCaptionFont->getWidth(mCaption);
break;
}
- mCaptionFont->drawString(g, mCaption, x, mCaptionOffsetY);
+ mCaptionFont->drawString(graphics, mCaption, x, mCaptionOffsetY);
}
if (update)
{
- g->setRedraw(update);
+ graphics->setRedraw(update);
drawChildren(graphics);
- g->setRedraw(false);
+ graphics->setRedraw(false);
}
else
{