summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-05-25 02:14:18 +0300
committerAndrei Karas <akaras@inbox.ru>2015-05-25 02:20:24 +0300
commita603cf32c1491e1a943d77b76e0f2362babcd7b8 (patch)
tree8841385c90b85b84b9589c633f0f569291d6cb1c
parente3682e2cdcb59c36792f6f9c39569e0af01088f0 (diff)
downloadmv-a603cf32c1491e1a943d77b76e0f2362babcd7b8.tar.gz
mv-a603cf32c1491e1a943d77b76e0f2362babcd7b8.tar.bz2
mv-a603cf32c1491e1a943d77b76e0f2362babcd7b8.tar.xz
mv-a603cf32c1491e1a943d77b76e0f2362babcd7b8.zip
Remove color2 from graphics.
-rw-r--r--src/gui/widgets/avatarlistbox.cpp3
-rw-r--r--src/gui/widgets/button.cpp36
-rw-r--r--src/gui/widgets/label.cpp1
-rw-r--r--src/gui/widgets/spellshortcutcontainer.cpp2
-rw-r--r--src/render/graphics.cpp3
-rw-r--r--src/render/graphics.h16
-rw-r--r--src/render/modernopenglgraphics.cpp7
-rw-r--r--src/render/modernopenglgraphics.h3
-rw-r--r--src/render/openglgraphicsdef1.hpp9
9 files changed, 21 insertions, 59 deletions
diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp
index d93787d18..b497bc8a4 100644
--- a/src/gui/widgets/avatarlistbox.cpp
+++ b/src/gui/widgets/avatarlistbox.cpp
@@ -121,7 +121,6 @@ void AvatarListBox::draw(Graphics *graphics)
const std::string &name = localPlayer->getName();
// Draw the list elements
- graphics->setColorAll(mForegroundColor, mForegroundColor2);
ImageCollection vertexes;
const bool useCaching = isBatchDrawRenders(openGLMode);
@@ -161,8 +160,6 @@ void AvatarListBox::draw(Graphics *graphics)
graphics->drawTileCollection(&vertexes);
}
- graphics->setColorAll(mForegroundColor, mForegroundColor2);
-
for (int i = 0, y = 0;
i < model->getNumberOfElements();
++i, y += fontHeight)
diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp
index dab8dc2d9..13c93ed1a 100644
--- a/src/gui/widgets/button.cpp
+++ b/src/gui/widgets/button.cpp
@@ -510,21 +510,6 @@ void Button::draw(Graphics *graphics)
const int padding = skin->getPadding();
const int spacing = mSpacing[mode];
- switch (mode)
- {
- case BUTTON_DISABLED:
- graphics->setColorAll(mDisabledColor, mDisabledColor2);
- break;
- case BUTTON_PRESSED:
- graphics->setColorAll(mPressedColor, mPressedColor2);
- break;
- case BUTTON_HIGHLIGHTED:
- graphics->setColorAll(mHighlightedColor, mHighlightedColor2);
- break;
- default:
- graphics->setColorAll(mEnabledColor, mEnabledColor2);
- break;
- }
if (recalc)
mTextChanged = true;
@@ -636,8 +621,25 @@ void Button::draw(Graphics *graphics)
mTextChunk.textFont = font;
mTextChunk.deleteImage();
mTextChunk.text = mCaption;
- mTextChunk.color = graphics->getColor();
- mTextChunk.color2 = graphics->getColor2();
+ switch (mode)
+ {
+ case BUTTON_DISABLED:
+ mTextChunk.color = mDisabledColor;
+ mTextChunk.color2 = mDisabledColor2;
+ break;
+ case BUTTON_PRESSED:
+ mTextChunk.color = mPressedColor;
+ mTextChunk.color2 = mPressedColor2;
+ break;
+ case BUTTON_HIGHLIGHTED:
+ mTextChunk.color = mHighlightedColor;
+ mTextChunk.color2 = mHighlightedColor2;
+ break;
+ default:
+ mTextChunk.color = mEnabledColor;
+ mTextChunk.color2 = mEnabledColor2;
+ break;
+ }
font->generate(mTextChunk);
mTextChanged = false;
}
diff --git a/src/gui/widgets/label.cpp b/src/gui/widgets/label.cpp
index a5cabc365..2addac309 100644
--- a/src/gui/widgets/label.cpp
+++ b/src/gui/widgets/label.cpp
@@ -169,7 +169,6 @@ void Label::draw(Graphics* graphics)
break;
}
- graphics->setColorAll(mForegroundColor, mForegroundColor2);
if (mTextChanged)
{
mTextChunk.textFont = font;
diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp
index ca2059ad5..672858412 100644
--- a/src/gui/widgets/spellshortcutcontainer.cpp
+++ b/src/gui/widgets/spellshortcutcontainer.cpp
@@ -77,7 +77,7 @@ void SpellShortcutContainer::draw(Graphics *graphics)
Font *const font = getFont();
const int selectedId = spellShortcut->getSelectedItem();
- graphics->setColorAll(mForegroundColor, mForegroundColor2);
+ graphics->setColor(mForegroundColor);
drawBackground(graphics);
// +++ in future need reorder images and string drawing.
diff --git a/src/render/graphics.cpp b/src/render/graphics.cpp
index e40a4eb7d..9ea8c7cad 100644
--- a/src/render/graphics.cpp
+++ b/src/render/graphics.cpp
@@ -124,8 +124,7 @@ Graphics::Graphics() :
mStartFreeMem(0),
mSync(false),
mScale(1),
- mColor(),
- mColor2()
+ mColor()
{
mRect.x = 0;
mRect.y = 0;
diff --git a/src/render/graphics.h b/src/render/graphics.h
index d6860d621..d6f74d854 100644
--- a/src/render/graphics.h
+++ b/src/render/graphics.h
@@ -303,27 +303,12 @@ class Graphics notfinal
virtual void setColor(const Color &color)
{
mColor = color;
- mColor2 = color;
- mAlpha = (color.a != 255);
- }
-
- void setColor2(const Color &color)
- { mColor2 = color; }
-
- virtual void setColorAll(const Color &color,
- const Color &color2)
- {
- mColor = color;
- mColor2 = color2;
mAlpha = (color.a != 255);
}
const Color &getColor() const
{ return mColor; }
- const Color &getColor2() const
- { return mColor2; }
-
#ifdef DEBUG_DRAW_CALLS
virtual unsigned int getDrawCalls() const
{ return 0; }
@@ -536,7 +521,6 @@ class Graphics notfinal
bool mSync;
int mScale;
Color mColor;
- Color mColor2;
};
extern Graphics *mainGraphics;
diff --git a/src/render/modernopenglgraphics.cpp b/src/render/modernopenglgraphics.cpp
index 04393eab6..9e0644138 100644
--- a/src/render/modernopenglgraphics.cpp
+++ b/src/render/modernopenglgraphics.cpp
@@ -236,13 +236,6 @@ bool ModernOpenGLGraphics::setVideoMode(const int w, const int h,
void ModernOpenGLGraphics::setColor(const Color &color)
{
- setColorAll(color, color);
-}
-
-void ModernOpenGLGraphics::setColorAll(const Color &color,
- const Color &color2)
-{
- mColor2 = color2;
mColorAlpha = (color.a != 255);
if (mColor != color)
{
diff --git a/src/render/modernopenglgraphics.h b/src/render/modernopenglgraphics.h
index 6604e3361..0577f5db2 100644
--- a/src/render/modernopenglgraphics.h
+++ b/src/render/modernopenglgraphics.h
@@ -58,9 +58,6 @@ class ModernOpenGLGraphics final : public Graphics
void setColor(const Color &color) override final;
- void setColorAll(const Color &color,
- const Color &color2) override final;
-
void screenResized() override final;
void finalize(ImageCollection *const col) override final;
diff --git a/src/render/openglgraphicsdef1.hpp b/src/render/openglgraphicsdef1.hpp
index 368f09f49..0a1ed7ba2 100644
--- a/src/render/openglgraphicsdef1.hpp
+++ b/src/render/openglgraphicsdef1.hpp
@@ -24,14 +24,5 @@ public:
void setColor(const Color &color) override final
{
mColor = color;
- mColor2 = color;
- mColorAlpha = (color.a != 255);
- }
-
- void setColorAll(const Color &color,
- const Color &color2) override final
- {
- mColor = color;
- mColor2 = color2;
mColorAlpha = (color.a != 255);
}