diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-02-15 22:21:02 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-02-15 22:21:02 +0300 |
commit | ca9fac131283ed536971799bef0d1fff4ef8adc1 (patch) | |
tree | ec70584d20b117c5d2446ef42b898eeacdda9d12 /src/gui/widgets/button.cpp | |
parent | 29f929794c7519b049de0be3af635f05d7e83be6 (diff) | |
download | mv-ca9fac131283ed536971799bef0d1fff4ef8adc1.tar.gz mv-ca9fac131283ed536971799bef0d1fff4ef8adc1.tar.bz2 mv-ca9fac131283ed536971799bef0d1fff4ef8adc1.tar.xz mv-ca9fac131283ed536971799bef0d1fff4ef8adc1.zip |
Remove useless graphics casts.
Diffstat (limited to 'src/gui/widgets/button.cpp')
-rw-r--r-- | src/gui/widgets/button.cpp | 40 |
1 files changed, 19 insertions, 21 deletions
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") } |