summaryrefslogtreecommitdiff
path: root/src/gui/palette.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-03-31 16:54:22 +0300
committerAndrei Karas <akaras@inbox.ru>2012-04-01 03:56:16 +0300
commit761682b6254a3d43e65ff45e07683c61afa6f1e4 (patch)
tree2ee462840f3aadb1e96bfa5c6784ec2cc0d2861a /src/gui/palette.cpp
parenta39f63cdfa5ce15b22f294a8bb1db3a036ce462d (diff)
downloadmv-761682b6254a3d43e65ff45e07683c61afa6f1e4.tar.gz
mv-761682b6254a3d43e65ff45e07683c61afa6f1e4.tar.bz2
mv-761682b6254a3d43e65ff45e07683c61afa6f1e4.tar.xz
mv-761682b6254a3d43e65ff45e07683c61afa6f1e4.zip
Last part of fixes.
Diffstat (limited to 'src/gui/palette.cpp')
-rw-r--r--src/gui/palette.cpp47
1 files changed, 22 insertions, 25 deletions
diff --git a/src/gui/palette.cpp b/src/gui/palette.cpp
index 3b36fa6ce..b48522faa 100644
--- a/src/gui/palette.cpp
+++ b/src/gui/palette.cpp
@@ -122,21 +122,21 @@ void Palette::advanceGradient()
else
colIndex = mGradVector[i]->gradientIndex;
- if (mGradVector[i]->grad == PULSE)
+ ColorElem *elem = mGradVector[i];
+ gcn::Color &color = elem->color;
+
+ if (elem->grad == PULSE)
{
colVal = static_cast<int>(255.0 *
sin(M_PI * colIndex / numOfColors));
- const gcn::Color &col = mGradVector[i]->testColor;
+ const gcn::Color &col = elem->testColor;
- mGradVector[i]->color.r =
- ((colVal * col.r) / 255) % (col.r + 1);
- mGradVector[i]->color.g =
- ((colVal * col.g) / 255) % (col.g + 1);
- mGradVector[i]->color.b =
- ((colVal * col.b) / 255) % (col.b + 1);
+ color.r = ((colVal * col.r) / 255) % (col.r + 1);
+ color.g = ((colVal * col.g) / 255) % (col.g + 1);
+ color.b = ((colVal * col.b) / 255) % (col.b + 1);
}
- if (mGradVector[i]->grad == SPECTRUM)
+ if (elem->grad == SPECTRUM)
{
if (colIndex % 2)
{ // falling curve
@@ -165,17 +165,14 @@ void Palette::advanceGradient()
}
}
- mGradVector[i]->color.r =
- (colIndex == 0 || colIndex == 5) ? 255 :
- (colIndex == 1 || colIndex == 4) ? colVal : 0;
- mGradVector[i]->color.g =
- (colIndex == 1 || colIndex == 2) ? 255 :
- (colIndex == 0 || colIndex == 3) ? colVal : 0;
- mGradVector[i]->color.b =
- (colIndex == 3 || colIndex == 4) ? 255 :
- (colIndex == 2 || colIndex == 5) ? colVal : 0;
+ color.r = (colIndex == 0 || colIndex == 5) ? 255 :
+ (colIndex == 1 || colIndex == 4) ? colVal : 0;
+ color.g = (colIndex == 1 || colIndex == 2) ? 255 :
+ (colIndex == 0 || colIndex == 3) ? colVal : 0;
+ color.b = (colIndex == 3 || colIndex == 4) ? 255 :
+ (colIndex == 2 || colIndex == 5) ? colVal : 0;
}
- else if (mGradVector[i]->grad == RAINBOW)
+ else if (elem->grad == RAINBOW)
{
const gcn::Color &startCol = RAINBOW_COLORS[colIndex];
const gcn::Color &destCol =
@@ -188,14 +185,14 @@ void Palette::advanceGradient()
destColVal = 1 - startColVal;
- mGradVector[i]->color.r = static_cast<int>(startColVal
- * startCol.r + destColVal * destCol.r);
+ color.r = static_cast<int>(startColVal
+ * startCol.r + destColVal * destCol.r);
- mGradVector[i]->color.g = static_cast<int>(startColVal
- * startCol.g + destColVal * destCol.g);
+ color.g = static_cast<int>(startColVal
+ * startCol.g + destColVal * destCol.g);
- mGradVector[i]->color.b = static_cast<int>(startColVal
- * startCol.b + destColVal * destCol.b);
+ color.b = static_cast<int>(startColVal
+ * startCol.b + destColVal * destCol.b);
}
}