mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
CoreGraphicsContext: Fix issue where clipping a gradient on a layer-backed view could cause rendering glitches
This commit is contained in:
parent
b56f386b6b
commit
8ed3618e12
2 changed files with 6 additions and 37 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -497,26 +497,14 @@ void CoreGraphicsContext::fillPath (const Path& path, const AffineTransform& tra
|
|||
{
|
||||
ScopedCGContextState scopedState (context.get());
|
||||
|
||||
if (state->fillType.isColour())
|
||||
{
|
||||
flip();
|
||||
applyTransform (transform);
|
||||
createPath (path);
|
||||
|
||||
if (path.isUsingNonZeroWinding())
|
||||
CGContextFillPath (context.get());
|
||||
else
|
||||
CGContextEOFillPath (context.get());
|
||||
}
|
||||
else
|
||||
{
|
||||
setContextClipToPath (path, transform);
|
||||
|
||||
if (state->fillType.isGradient())
|
||||
if (state->fillType.isColour())
|
||||
CGContextFillRect (context.get(), CGContextGetClipBoundingBox (context.get()));
|
||||
else if (state->fillType.isGradient())
|
||||
drawGradient();
|
||||
else
|
||||
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());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue