Closed Bug 1793611 Opened 2 years ago Closed 2 years ago

COLRv1 radial gradient with zero-length color line and extend-mode:pad renders incorrectly

Categories

(Core :: Graphics: Text, defect)

defect

Tracking

()

RESOLVED FIXED
107 Branch
Tracking Status
firefox107 --- fixed

People

(Reporter: jfkthame, Assigned: jfkthame)

References

Details

Attachments

(1 file)

Followup to bug 1793105: one more edge-case that isn't handled correctly, even after the patch there, is the case of a "degenerate" color line where all stops are at the same offset.

In the case of repeat modes, such a gradient renders nothing (per spec), because we can't fill space by repeating a zero-length segment no matter how hard we try. But in the case of pad mode, it should simply render the first and last colors, with a hard transition between them.

This currently fails if the stop offset is outside the [0..1] interval, because we bail out of trying to normalize the offsets, and the shader clamps the stop position, so the transition happens in the wrong place. With the color line being zero-length, our code to "project" circle positions based on the normalized color line can't work.

To fix this, we can append an extra "artificial" stop as a copy of the last color stop, but with an increased offset (in pad mode only); this will be subsumed by the pad-extension anyhow, but provides a non-zero-length color line so that we can project the defining circles as needed.

Includes reftest; there's fuzz at the color transitions, when compared to a CSS-backgrounds simulation,
but in the case of "real" failure there'd be many more pixels of mismatch, and max-difference would be 255.

Pushed by jkew@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/47f7bd51fc85
Handle degenerate (0-length) color line in extend-pad mode for radial gradients. r=lsalzman
Pushed by jkew@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/73b75a01d153
Handle degenerate (0-length) color line in extend-pad mode for radial gradients. r=lsalzman
Flags: needinfo?(jfkthame)
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 107 Branch
Regressions: 1794065
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: