Browse Source

Prevented ColourGradient from having multiple colour stops at 0

tags/2021-05-28
jules 9 years ago
parent
commit
708e357e3c
1 changed files with 7 additions and 1 deletions
  1. +7
    -1
      modules/juce_graphics/colour/juce_ColourGradient.cpp

+ 7
- 1
modules/juce_graphics/colour/juce_ColourGradient.cpp View File

@@ -70,7 +70,13 @@ int ColourGradient::addColour (const double proportionAlongGradient, Colour colo
// must be within the two end-points
jassert (proportionAlongGradient >= 0 && proportionAlongGradient <= 1.0);
const double pos = jlimit (0.0, 1.0, proportionAlongGradient);
if (proportionAlongGradient <= 0)
{
colours.set (0, ColourPoint (0.0, colour));
return 0;
}
const double pos = jmin (1.0, proportionAlongGradient);
int i;
for (i = 0; i < colours.size(); ++i)


Loading…
Cancel
Save