From 01e2e53160fd2fe6704f6a0a4a1dfce3ca90a7c9 Mon Sep 17 00:00:00 2001 From: jules Date: Wed, 27 Apr 2016 16:12:37 +0100 Subject: [PATCH] Added an assertion to catch some unexpected behaviour in the CoreGraphics gradient renderer --- modules/juce_graphics/native/juce_mac_CoreGraphicsContext.mm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/juce_graphics/native/juce_mac_CoreGraphicsContext.mm b/modules/juce_graphics/native/juce_mac_CoreGraphicsContext.mm index 3e806498c3..584e6e7945 100644 --- a/modules/juce_graphics/native/juce_mac_CoreGraphicsContext.mm +++ b/modules/juce_graphics/native/juce_mac_CoreGraphicsContext.mm @@ -707,6 +707,10 @@ static CGGradientRef createGradient (const ColourGradient& g, CGColorSpaceRef co *comps++ = (CGFloat) colour.getFloatBlue(); *comps++ = (CGFloat) colour.getFloatAlpha(); locations[i] = (CGFloat) g.getColourPosition (i); + + // There's a bug (?) in the way the CG renderer works where it seems + // to go wrong if you have two colour stops both at position 0.. + jassert (i == 0 || locations[i] != 0); } return CGGradientCreateWithColorComponents (colourSpace, components, locations, (size_t) numColours);