Changeset 80515 in webkit
- Timestamp:
- Mar 7, 2011 5:49:52 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 9 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r80513 r80515 1 2011-03-07 Helder Correia <helder@sencha.com> 2 3 Reviewed by Simon Fraser. 4 5 Shadow is not shown when using strokeRect with a gradient strokeStyle 6 https://bugs.webkit.org/show_bug.cgi?id=52509 7 8 This happens in CG and is related to bug 51869, this time to be fixed 9 in GraphicsContext::strokeRect(const FloatRect& r, float lineWidth). 10 We need to draw the gradient clipped to the stroke on a CGLayer first, 11 and then draw the layer on the GraphicsContext. 12 13 * fast/canvas/canvas-strokeRect-gradient-shadow-expected.txt: Added. 14 * fast/canvas/canvas-strokeRect-gradient-shadow.html: Added. 15 * fast/canvas/script-tests/canvas-strokeRect-gradient-shadow.js: Added. 16 * platform/chromium/test_expectations.txt: Skip new test since it fails. 17 * platform/mac/svg/css/rect-gradient-stroke-shadow-expected.checksum: Added. 18 * platform/mac/svg/css/rect-gradient-stroke-shadow-expected.png: Added. 19 * platform/qt/Skipped: Skip new test since it fails. 20 * platform/qt/svg/css/rect-gradient-stroke-shadow-expected.checksum: Added. 21 * platform/qt/svg/css/rect-gradient-stroke-shadow-expected.png: Added. 22 * svg/css/rect-gradient-stroke-shadow-expected.txt: Added. 23 * svg/css/rect-gradient-stroke-shadow.svg: Added. 24 1 25 2011-03-07 Fumitoshi Ukai <ukai@chromium.org> 2 26 -
trunk/LayoutTests/platform/chromium/test_expectations.txt
r80513 r80515 2614 2614 // New tests added with http://trac.webkit.org/changeset/72472 and further. 2615 2615 // See https://bugs.webkit.org/show_bug.cgi?id=51982 for more info. 2616 BUGWK52509 LINUX WIN : fast/canvas/canvas-strokeRect-gradient-shadow.html = TEXT 2616 2617 BUGCR63921 LINUX WIN : fast/canvas/canvas-fillPath-shadow.html = TEXT 2617 2618 BUGCR63921 CPU LINUX WIN : fast/canvas/canvas-fillPath-gradient-shadow.html = TEXT -
trunk/LayoutTests/platform/qt/Skipped
r80492 r80515 1472 1472 fast/block/positioning/absolute-in-inline-rtl-4.html 1473 1473 fast/canvas/canvas-gradient-addStop-error.html 1474 fast/canvas/canvas-strokeRect-gradient-shadow.html 1474 1475 fast/css/zoom-body-scroll.html 1475 1476 fast/dom/Element/getBoundingClientRect.html -
trunk/Source/WebCore/ChangeLog
r80514 r80515 1 2011-03-07 Helder Correia <helder@sencha.com> 2 3 Reviewed by Simon Fraser. 4 5 Shadow is not shown when using strokeRect with a gradient strokeStyle 6 https://bugs.webkit.org/show_bug.cgi?id=52509 7 8 This happens in CG and is related to bug 51869, this time to be fixed 9 in GraphicsContext::strokeRect(const FloatRect& r, float lineWidth). 10 We need to draw the gradient clipped to the stroke on a CGLayer first, 11 and then draw the layer on the GraphicsContext. 12 13 Tests: fast/canvas/canvas-strokeRect-gradient-shadow.html 14 svg/css/rect-gradient-stroke-shadow.svg 15 16 * platform/graphics/cg/GraphicsContextCG.cpp: 17 (WebCore::GraphicsContext::strokeRect): 18 1 19 2011-03-07 Justin Novosad <junov@chromium.org> 2 20 -
trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
r80049 r80515 988 988 } 989 989 990 void GraphicsContext::strokeRect(const FloatRect& r , float lineWidth)990 void GraphicsContext::strokeRect(const FloatRect& rect, float lineWidth) 991 991 { 992 992 if (paintingDisabled()) … … 996 996 997 997 if (m_state.strokeGradient) { 998 CGContextSaveGState(context); 999 setStrokeThickness(lineWidth); 1000 CGContextAddRect(context, r); 1001 CGContextReplacePathWithStrokedPath(context); 1002 CGContextClip(context); 1003 m_state.strokeGradient->paint(this); 1004 CGContextRestoreGState(context); 998 if (hasShadow()) { 999 const float doubleLineWidth = lineWidth * 2; 1000 const float layerWidth = ceilf(rect.width() + doubleLineWidth); 1001 const float layerHeight = ceilf(rect.height() + doubleLineWidth); 1002 CGLayerRef layer = CGLayerCreateWithContext(context, CGSizeMake(layerWidth, layerHeight), 0); 1003 1004 CGContextRef layerContext = CGLayerGetContext(layer); 1005 m_state.strokeThickness = lineWidth; 1006 CGContextSetLineWidth(layerContext, lineWidth); 1007 1008 // Compensate for the line width, otherwise the layer's top-left corner would be 1009 // aligned with the rect's top-left corner. This would result in leaving pixels out of 1010 // the layer on the left and top sides. 1011 const float translationX = lineWidth - rect.x(); 1012 const float translationY = lineWidth - rect.y(); 1013 CGContextTranslateCTM(layerContext, translationX, translationY); 1014 1015 CGContextAddRect(layerContext, rect); 1016 CGContextReplacePathWithStrokedPath(layerContext); 1017 CGContextClip(layerContext); 1018 CGContextConcatCTM(layerContext, m_state.strokeGradient->gradientSpaceTransform()); 1019 m_state.strokeGradient->paint(layerContext); 1020 1021 const float destinationX = roundf(rect.x() - lineWidth); 1022 const float destinationY = roundf(rect.y() - lineWidth); 1023 CGContextDrawLayerAtPoint(context, CGPointMake(destinationX, destinationY), layer); 1024 CGLayerRelease(layer); 1025 } else { 1026 CGContextSaveGState(context); 1027 setStrokeThickness(lineWidth); 1028 CGContextAddRect(context, rect); 1029 CGContextReplacePathWithStrokedPath(context); 1030 CGContextClip(context); 1031 CGContextConcatCTM(context, m_state.strokeGradient->gradientSpaceTransform()); 1032 m_state.strokeGradient->paint(this); 1033 CGContextRestoreGState(context); 1034 } 1005 1035 return; 1006 1036 } … … 1008 1038 if (m_state.strokePattern) 1009 1039 applyStrokePattern(); 1010 CGContextStrokeRectWithWidth(context, r , lineWidth);1040 CGContextStrokeRectWithWidth(context, rect, lineWidth); 1011 1041 } 1012 1042
Note: See TracChangeset
for help on using the changeset viewer.