diff --git a/modules/juce_graphics/native/juce_CoreGraphicsContext_mac.h b/modules/juce_graphics/native/juce_CoreGraphicsContext_mac.h index 73c5c51221..07ee759aca 100644 --- a/modules/juce_graphics/native/juce_CoreGraphicsContext_mac.h +++ b/modules/juce_graphics/native/juce_CoreGraphicsContext_mac.h @@ -143,7 +143,6 @@ private: void setContextClipToPath (const Path&, const AffineTransform&); void drawGradient(); - void createPath (const Path&) const; void createPath (const Path&, const AffineTransform&) const; void flip() const; void applyTransform (const AffineTransform&) const; diff --git a/modules/juce_graphics/native/juce_CoreGraphicsContext_mac.mm b/modules/juce_graphics/native/juce_CoreGraphicsContext_mac.mm index e74f35fa52..fb67176cf2 100644 --- a/modules/juce_graphics/native/juce_CoreGraphicsContext_mac.mm +++ b/modules/juce_graphics/native/juce_CoreGraphicsContext_mac.mm @@ -497,26 +497,14 @@ void CoreGraphicsContext::fillPath (const Path& path, const AffineTransform& tra { ScopedCGContextState scopedState (context.get()); + setContextClipToPath (path, transform); + if (state->fillType.isColour()) - { - flip(); - applyTransform (transform); - createPath (path); - - if (path.isUsingNonZeroWinding()) - CGContextFillPath (context.get()); - else - CGContextEOFillPath (context.get()); - } + CGContextFillRect (context.get(), CGContextGetClipBoundingBox (context.get())); + else if (state->fillType.isGradient()) + drawGradient(); else - { - setContextClipToPath (path, transform); - - if (state->fillType.isGradient()) - drawGradient(); - else - drawImage (state->fillType.image, state->fillType.transform, true); - } + drawImage (state->fillType.image, state->fillType.transform, true); } void CoreGraphicsContext::drawImage (const Image& sourceImage, const AffineTransform& transform) @@ -770,24 +758,6 @@ void CoreGraphicsContext::drawGradient() kCGGradientDrawsBeforeStartLocation | kCGGradientDrawsAfterEndLocation); } -void CoreGraphicsContext::createPath (const Path& path) const -{ - CGContextBeginPath (context.get()); - - for (Path::Iterator i (path); i.next();) - { - switch (i.elementType) - { - case Path::Iterator::startNewSubPath: CGContextMoveToPoint (context.get(), i.x1, i.y1); break; - case Path::Iterator::lineTo: CGContextAddLineToPoint (context.get(), i.x1, i.y1); break; - case Path::Iterator::quadraticTo: CGContextAddQuadCurveToPoint (context.get(), i.x1, i.y1, i.x2, i.y2); break; - case Path::Iterator::cubicTo: CGContextAddCurveToPoint (context.get(), i.x1, i.y1, i.x2, i.y2, i.x3, i.y3); break; - case Path::Iterator::closePath: CGContextClosePath (context.get()); break; - default: jassertfalse; break; - } - } -} - void CoreGraphicsContext::createPath (const Path& path, const AffineTransform& transform) const { CGContextBeginPath (context.get());