From 761682b6254a3d43e65ff45e07683c61afa6f1e4 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 31 Mar 2012 16:54:22 +0300 Subject: Last part of fixes. --- src/gui/palette.cpp | 47 ++++++++++++++++++++++------------------------- 1 file changed, 22 insertions(+), 25 deletions(-) (limited to 'src/gui/palette.cpp') 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(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(startColVal - * startCol.r + destColVal * destCol.r); + color.r = static_cast(startColVal + * startCol.r + destColVal * destCol.r); - mGradVector[i]->color.g = static_cast(startColVal - * startCol.g + destColVal * destCol.g); + color.g = static_cast(startColVal + * startCol.g + destColVal * destCol.g); - mGradVector[i]->color.b = static_cast(startColVal - * startCol.b + destColVal * destCol.b); + color.b = static_cast(startColVal + * startCol.b + destColVal * destCol.b); } } -- cgit v1.2.3-70-g09d2