Changeset 80049 in webkit
- Timestamp:
- Mar 1, 2011 3:24:33 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 7 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r80044 r80049 1 2011-03-01 Helder Correia <helder@sencha.com> 2 3 Reviewed by Simon Fraser. 4 5 No shadow when stroking a path with a gradient 6 https://bugs.webkit.org/show_bug.cgi?id=55436 7 8 This happens in CG and is related to bug 52509, this time to be fixed 9 in GraphicsContext::strokePath(). The gradient needs to be drawn 10 clipped to the stroke on a CGLayer first, then the layer drawn on the 11 GraphicsContext. 12 13 * fast/canvas/canvas-strokePath-gradient-shadow-expected.txt: Added. 14 * fast/canvas/canvas-strokePath-gradient-shadow.html: Added. 15 * fast/canvas/script-tests/canvas-strokePath-gradient-shadow.js: Added. 16 * platform/chromium/test_expectations.txt: Skip new test since it fails. 17 * platform/mac/svg/css/path-gradient-stroke-shadow-expected.checksum: Added. 18 * platform/mac/svg/css/path-gradient-stroke-shadow-expected.png: Added. 19 * platform/mac/svg/css/path-gradient-stroke-shadow-expected.txt: Added. 20 * platform/qt/Skipped: Skip new test since it fails. 21 * platform/qt/svg/css/path-gradient-stroke-shadow-expected.checksum: Added. 22 * platform/qt/svg/css/path-gradient-stroke-shadow-expected.png: Added. 23 * platform/qt/svg/css/path-gradient-stroke-shadow-expected.txt: Added. 24 * svg/css/path-gradient-stroke-shadow.svg: Added. 25 1 26 2011-03-01 Tony Gentilcore <tonyg@chromium.org> 2 27 -
trunk/Source/WebCore/ChangeLog
r80047 r80049 1 2011-03-01 Helder Correia <helder@sencha.com> 2 3 Reviewed by Simon Fraser. 4 5 No shadow when stroking a path with a gradient 6 https://bugs.webkit.org/show_bug.cgi?id=55436 7 8 This happens in CG and is related to bug 52509, this time to be fixed 9 in GraphicsContext::strokePath(). The gradient needs to be drawn 10 clipped to the stroke on a CGLayer first, then the layer drawn on the 11 GraphicsContext. 12 13 Tests: fast/canvas/canvas-strokePath-gradient-shadow.html 14 svg/css/path-gradient-stroke-shadow.svg 15 16 * platform/graphics/cg/GraphicsContextCG.cpp: 17 (WebCore::GraphicsContext::strokePath): 18 1 19 2011-03-01 David Hyatt <hyatt@apple.com> 2 20 -
trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
r78846 r80049 609 609 610 610 if (m_state.strokeGradient) { 611 CGContextSaveGState(context); 612 CGContextReplacePathWithStrokedPath(context); 613 CGContextClip(context); 614 CGContextConcatCTM(context, m_state.strokeGradient->gradientSpaceTransform()); 615 m_state.strokeGradient->paint(this); 616 CGContextRestoreGState(context); 611 if (hasShadow()) { 612 FloatRect rect = path.boundingRect(); 613 float lineWidth = strokeThickness(); 614 float doubleLineWidth = lineWidth * 2; 615 float layerWidth = ceilf(rect.width() + doubleLineWidth); 616 float layerHeight = ceilf(rect.height() + doubleLineWidth); 617 618 CGLayerRef layer = CGLayerCreateWithContext(context, CGSizeMake(layerWidth, layerHeight), 0); 619 CGContextRef layerContext = CGLayerGetContext(layer); 620 CGContextSetLineWidth(layerContext, lineWidth); 621 622 // Compensate for the line width, otherwise the layer's top-left corner would be 623 // aligned with the rect's top-left corner. This would result in leaving pixels out of 624 // the layer on the left and top sides. 625 float translationX = lineWidth - rect.x(); 626 float translationY = lineWidth - rect.y(); 627 CGContextTranslateCTM(layerContext, translationX, translationY); 628 629 CGContextAddPath(layerContext, path.platformPath()); 630 CGContextReplacePathWithStrokedPath(layerContext); 631 CGContextClip(layerContext); 632 CGContextConcatCTM(layerContext, m_state.strokeGradient->gradientSpaceTransform()); 633 m_state.strokeGradient->paint(layerContext); 634 635 float destinationX = roundf(rect.x() - lineWidth); 636 float destinationY = roundf(rect.y() - lineWidth); 637 CGContextDrawLayerAtPoint(context, CGPointMake(destinationX, destinationY), layer); 638 CGLayerRelease(layer); 639 } else { 640 CGContextSaveGState(context); 641 CGContextReplacePathWithStrokedPath(context); 642 CGContextClip(context); 643 CGContextConcatCTM(context, m_state.strokeGradient->gradientSpaceTransform()); 644 m_state.strokeGradient->paint(this); 645 CGContextRestoreGState(context); 646 } 617 647 return; 618 648 }
Note: See TracChangeset
for help on using the changeset viewer.