Closed Bug 1793105 Opened 2 years ago Closed 2 years ago

Update COLRv1 radial gradient rendering as discussed in spec issue

Categories

(Core :: Graphics: Text, defect)

defect

Tracking

()

RESOLVED FIXED
107 Branch
Tracking Status
firefox107 --- fixed

People

(Reporter: jfkthame, Assigned: jfkthame)

References

Details

Attachments

(3 files)

A lengthy discussion about radial gradients in https://github.com/googlefonts/colr-gradients-spec/issues/367 is finally converging on a result.

At issue is what it means for the radii of the circles defining a radial gradient to be negative. This doesn't occur in HTML or CSS gradients, as such values would simply be an error, but in COLRv1 fonts it is possible for variation deltas to make one or both of the radii negative, even though the default values (before variations are applied) must be non-negative because they are unsigned in the font table.

The rendering algorithm described in the spec didn't consider negative radii, but it turns out to handle this just fine, and the resulting behavior makes geometric sense. (Details in the spec issue.) And following discussion and experiments, we have concluded that it's reasonable to implement this using the available shader APIs (which was in doubt for a while), even though they don't directly accept negative geometry.

This implements the adjusted behavior agreed with Dominik in
https://github.com/googlefonts/colr-gradients-spec/issues/367
and email discussion. Dominik is updating Blink to have the
same behavior.

Assignee: nobody → jfkthame
Status: NEW → ASSIGNED

THe last two lines in the testcase fail badly with current trunk code, and are fixed by the patch here.

Pushed by jkew@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/db9c185baf7a
Update COLRv1 radial-gradient handling of negative radii. r=gfx-reviewers,lsalzman
https://hg.mozilla.org/integration/autoland/rev/d1d1d489003c
Add a reftest for COLRv1 radial gradients with variations that involve negative radii. r=gfx-reviewers,lsalzman

A quick followup: Dominik's testing revealed an error in the edge case where there are co-located color stops at an end of the color line, and we end up collapsing to a single "padding" color because the defined range of the color line is outside the visible cone.

I have a simple patch to fix this, which I'll post for review as a followup here, and add an example of this edge-case to the reftest.

Try run in progress to check if fuzz numbers need tweaking... https://treeherder.mozilla.org/jobs?repo=try&revision=aacf7fdf417debb7714bb16eb10abbc2581c4958

Rather than calling TruncateGradientStops, which doesn't handle this case properly (it leaves multiple
color stops because they're at the same offset), we can just delete all but the required color directly.

Added an example of this scenario to the reftest.

Marking bug as leave-open until the followup is reviewed/landed.

Keywords: leave-open
Keywords: leave-open
Pushed by jkew@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/fe373509557f
followup, fix for the edge-case of collapsing the color line to one end, with co-located stops. r=lsalzman
Blocks: 1793611
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 107 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: