[Webkit-unassigned] [Bug 202739] [GTK] Implement conic gradient

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Oct 9 03:58:56 PDT 2019


https://bugs.webkit.org/show_bug.cgi?id=202739

--- Comment #2 from Diego Pino <dpino at igalia.com> ---
This patch implements painting of a conic-gradient in WebKitGTK.

Cairo lacks a direct primitive, such as `cairo_pattern_create_linear` or `cairo_pattern_create_radial`, to paint a conic gradient. However, it's possible to paint a conic gradient using a mesh gradient (`cairo_pattern_create_mesh`), since mesh gradients can adopt any shape.

To paint a conic gradient using a mesh gradient, what I do is to paint a circle sector for each stop color in the gradient. Each circle sector is defined as a patch (`cairo_mesh_pattern_begin_patch`). A sector is defined by a line from the center and a bezier line until the end of the color stop offset, then back to the center. After that, I give each of the four corners defined the gradient colors of the sector. For the mathematics of bezier lines and how to use them as arcs, check out: https://pomax.github.io/bezierinfo/#circles_cubic.

To make the gradient occupy the whole rect where it's defined, I needed the width of the rect, which I think it's not available at the time the gradient is computed. That lead me to tweak the code that initializes a ConicGradient with data for the radius of the circumference (computed out of the width of the rect). I think this change is not correct. Ideally I'd prefer to figure out the width of the rect in the platform dependent code.

There are several layout tests that are failing. In many of these failures the difference regarding the reference image is a very thin line. I think what it's happening is that the border line between sectors is getting over painted. Possibly there's a mistake on how a sector is painted. I looked into it but I haven't figured it out yet.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20191009/013bf1b2/attachment.html>


More information about the webkit-unassigned mailing list