[Webkit-unassigned] [Bug 23957] SVG text gradients and patterns on chromium/skia don't work

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Feb 19 14:43:08 PST 2009


------- Comment #8 from senorblanco at chromium.org  2009-02-19 14:43 PDT -------
Thanks for your comments, Brett.

(In reply to comment #7)
> Is it possible to encode the gradient in the SkPaint before you call the Skia
> paint function? This is the type of thing that the SkPaint should be for, and
> how its used for all other shading effects. This may make most of the other
> changes unnecessary.

Yes, the gradient could be set in the SkPaint before the call (normally, this
would be done for us by GraphicsContext[Skia]::fillPath(), but we call
SkCanvas::drawPath() directly, not sure why), but I'd just have to retrieve the
shader again in order to scale and offset the matrix.  This is actually the
part of the fix I'm least happy with:  the problem is that the gradient is
transformed with the canvas for each character.  If you can help me come up
with an alternative, I'd appreciate it.  Another test that shows the same
problem is at:


(Notice that each character has its own gradient.)  And in fact, my patch
doesn't fix this test, since it uses custom SVG fonts which apparently have a
different drawing path.  There may be some higher-level fix that will fix all
these problems.  Perhaps a flag in the skia gradients which marks them as
"absolute", rather than transformed with the canvas.  It would help to know how
this works in CoreGraphics, since judging by the tests, it does work there.  

Another fix I tried was to stop translating the canvas entirely, and offset
each glyph as it's drawn, but I still needed to scale the matrix in order to
accommodate the whole text string.  It also required making a copy of each
glyph, and I wasn't sure of the performance implications of that (although the
culling code does the same thing later on).

> I believe PassRefPtr takes the reference from the source and will pass it to
> the caller. The way you're using it is wrong, since the source is supposed to
> keep the reference. I think this should just return a Gradient* and the caller
> should AddRef if he wants to keep a reference.
> If we have to keep the Gradient* to paintSkiaText, it should just be a
> Gradient* since you're not transferring ownership.

Will fix.

Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

More information about the webkit-unassigned mailing list