Bug 55436 - No shadow when stroking a path with a gradient
Summary: No shadow when stroking a path with a gradient
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Canvas (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Helder Correia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-28 18:32 PST by Helder Correia
Modified: 2011-03-01 17:18 PST (History)
5 users (show)

See Also:


Attachments
Patch (129.74 KB, patch)
2011-02-28 18:41 PST, Helder Correia
simon.fraser: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Helder Correia 2011-02-28 18:32:43 PST
This happens in CG and is related to bug 52509, this time to be fixed in GraphicsContext::strokePath(). The gradient needs to be drawn clipped to the stroke on a CGLayer first, then the layer drawn on the GraphicsContext.
Comment 1 Helder Correia 2011-02-28 18:41:50 PST
Created attachment 84170 [details]
Patch
Comment 2 Simon Fraser (smfr) 2011-02-28 22:12:43 PST
Comment on attachment 84170 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=84170&action=review

> Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:616
> +            const FloatRect rect = path.boundingRect();
> +            const float lineWidth = strokeThickness();
> +            const float doubleLineWidth = lineWidth * 2;
> +            const float layerWidth = ceilf(rect.width() + doubleLineWidth);
> +            const float layerHeight = ceilf(rect.height() + doubleLineWidth);

It's not really customary to use const for local variables; just follow the style in the rest of the file.

> Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:636
> +            const float destinationX = roundf(rect.x() - lineWidth);
> +            const float destinationY = roundf(rect.y() - lineWidth);

I don't think there's any point using 'const' for variables that are declared just before you use them.
Comment 3 Helder Correia 2011-03-01 15:30:47 PST
Manually committed r80049: http://trac.webkit.org/changeset/80049
Comment 4 WebKit Review Bot 2011-03-01 16:33:10 PST
http://trac.webkit.org/changeset/80049 might have broken Qt Linux Release
The following tests are not passing:
fast/canvas/canvas-strokePath-gradient-shadow.html
Comment 5 Helder Correia 2011-03-01 17:18:38 PST
(In reply to comment #4)
> http://trac.webkit.org/changeset/80049 might have broken Qt Linux Release
> The following tests are not passing:
> fast/canvas/canvas-strokePath-gradient-shadow.html

The manually committed patch didn't add
fast/canvas/canvas-strokePath-gradient-shadow.html to Qt Skipped by mistake. Fixed in http://trac.webkit.org/changeset/80069