1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Prevented ColourGradient from having multiple colour stops at 0

This commit is contained in:
jules 2016-04-28 09:47:09 +01:00
parent d32c64d590
commit 708e357e3c

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)