diff options
Diffstat (limited to 'src/gui/palette.cpp')
-rw-r--r-- | src/gui/palette.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/gui/palette.cpp b/src/gui/palette.cpp index f0f97b6f1..36fde8761 100644 --- a/src/gui/palette.cpp +++ b/src/gui/palette.cpp @@ -41,7 +41,7 @@ const Color Palette::BLACK = Color(0, 0, 0, 255); Palette::Palettes Palette::mInstances; -const Color Palette::RAINBOW_COLORS[7] = +const Color Palette::RAINBOW_COLORS[] = { Color(255, 0, 0, 255), Color(255, 153, 0, 255), @@ -52,8 +52,6 @@ const Color Palette::RAINBOW_COLORS[7] = Color(153, 0, 153, 255) }; -const int Palette::RAINBOW_COLOR_COUNT = 7; - Palette::Palette(const int size) : mRainbowTime(tick_time), mColors(Colors(size)), @@ -111,7 +109,7 @@ void Palette::advanceGradient() const int numOfColors = (elem->grad == GradientType::SPECTRUM ? 6 : grad == GradientType::PULSE ? 127 : - RAINBOW_COLOR_COUNT); + NUM_ELEMENTS(RAINBOW_COLORS)); elem->gradientIndex = (elem->gradientIndex + advance) % (delay * numOfColors); @@ -177,8 +175,9 @@ void Palette::advanceGradient() else if (elem->grad == GradientType::RAINBOW) { const Color &startCol = RAINBOW_COLORS[colIndex]; - const Color &destCol - = RAINBOW_COLORS[(colIndex + 1) % numOfColors]; + const int destIndex + = (colIndex + 1) % NUM_ELEMENTS(RAINBOW_COLORS); + const Color &destCol = RAINBOW_COLORS[destIndex]; double startColVal; double destColVal; |