diff options
Diffstat (limited to 'Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp')
-rw-r--r-- | Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp | 47 |
1 files changed, 36 insertions, 11 deletions
diff --git a/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp b/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp index acd912f..eddf735 100644 --- a/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp +++ b/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp @@ -546,21 +546,46 @@ void GraphicsContext::fillPath(const Path& path) CGContextRef context = platformContext(); - CGContextBeginPath(context); - CGContextAddPath(context, path.platformPath()); - if (m_state.fillGradient) { - CGContextSaveGState(context); - if (fillRule() == RULE_EVENODD) - CGContextEOClip(context); - else - CGContextClip(context); - CGContextConcatCTM(context, m_state.fillGradient->gradientSpaceTransform()); - m_state.fillGradient->paint(this); - CGContextRestoreGState(context); + if (hasShadow()) { + FloatRect rect = path.boundingRect(); + CGLayerRef layer = CGLayerCreateWithContext(context, CGSizeMake(rect.width(), rect.height()), 0); + CGContextRef layerContext = CGLayerGetContext(layer); + + CGContextTranslateCTM(layerContext, -rect.x(), -rect.y()); + CGContextBeginPath(layerContext); + CGContextAddPath(layerContext, path.platformPath()); + CGContextConcatCTM(layerContext, m_state.fillGradient->gradientSpaceTransform()); + + if (fillRule() == RULE_EVENODD) + CGContextEOClip(layerContext); + else + CGContextClip(layerContext); + + m_state.fillGradient->paint(layerContext); + CGContextDrawLayerAtPoint(context, CGPointMake(rect.left(), rect.top()), layer); + CGLayerRelease(layer); + } else { + CGContextBeginPath(context); + CGContextAddPath(context, path.platformPath()); + CGContextSaveGState(context); + CGContextConcatCTM(context, m_state.fillGradient->gradientSpaceTransform()); + + if (fillRule() == RULE_EVENODD) + CGContextEOClip(context); + else + CGContextClip(context); + + m_state.fillGradient->paint(this); + CGContextRestoreGState(context); + } + return; } + CGContextBeginPath(context); + CGContextAddPath(context, path.platformPath()); + if (m_state.fillPattern) applyFillPattern(); fillPathWithFillRule(context, fillRule()); |