Closed Bug 1868067 Opened 2 years ago Closed 1 year ago

aa-stroke fails to render half-arcs

Categories

(Core :: Graphics: Canvas2D, defect)

Firefox 122
defect

Tracking

()

RESOLVED FIXED
135 Branch
Tracking Status
firefox-esr115 --- wontfix
firefox-esr128 --- wontfix
firefox133 --- wontfix
firefox134 --- wontfix
firefox135 --- fixed

People

(Reporter: tristan.fraipont, Assigned: jrmuizel)

References

(Regression)

Details

(Keywords: regression)

Attachments

(9 files)

Attached file test-case.html

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:120.0) Gecko/20100101 Firefox/120.0

Steps to reproduce:

Originally reported at https://stackoverflow.com/questions/77584584/line-endings-in-js-canvas-arc-function-bug-in-firefox
Online test case (jsffidle).

Stroke an half arc using a line-width equal to the arc's diameter.

Actual results:

The stroke does overlap in the center of the arc and fails to render the extremities of the arc (see the various attached screenshots, and particularly xor.png).

Expected results:

A clean half circle should have been drawn.

This only happens when using GPU rendering and is caused by this CL. At that time, the bug was a bit different (see attachment initial-bug.png). Since this CL it is in the current state.

The whole strategy of https://bugzilla.mozilla.org/show_bug.cgi?id=1837068 seems very fragile. Even when using smaller line-width, the composition over the antialias will result in visible holes (see holes.png, where I added the red circles in post prod and holes.html).
I even had a temporary aliasing bug when rendering the stroke with some alpha where I could see each lines of the stroke converging to the center of the arc. I unfortunately failed to take a screenshot of that and couldn't repro since then, even during bisect.

Attached image current.png
Attached image xor.png
Attached image initial-bug.png
Attached file holes.html
Attached image holes.png
Flags: needinfo?(lsalzman)

The arc rendering issue is probably a dupe of bug 1867774. The hole rendering issue was first seen in https://bugzilla.mozilla.org/attachment.cgi?id=9341757

See Also: → 1867774

Oh, indeed, bug 1867774 is about the same issue, sorry I missed it.
From which bug comes the hole screenshot though?

As expected, caused by bug 1834079.

Keywords: regression
Regressed by: 1834079

Not sure what severity we should give. Looks fairly serious, and is a recent regression related to some speedometer 3 improvements in rendering path selection.

Blocks: gfx-triage
Flags: needinfo?(jmuizelaar)
Severity: -- → S3
Flags: needinfo?(jmuizelaar)

Windows is unaffected (because of d2d?) but other platforms are affected. jrmuizel has repro'd.

Flags: needinfo?(lsalzman)
Assignee: nobody → jmuizelaar

Can reproduce this in a standalone test case

No longer blocks: gfx-triage
Duplicate of this bug: 1867774

Jeff, any plans on how to fix this?

Flags: needinfo?(jmuizelaar)

Yes, I want to stroke/offset curves during flattening instead of flattening first and then stroking. This will let us have proper tangents and the start and end of the curve instead of the tangents of the flattened curve. The thing that blocks this from being easy to implement is the possibility of self intersection for a particular segment.

If we wanted to mitigate this problem temporarily we could just adjust the flattening tolerance in proportion to the line width.

Flags: needinfo?(jmuizelaar)

This fixes drawing half arcs, reduces the triangle count when flattening
because we don't have joins and thus improves performance.

Pushed by jmuizelaar@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/fc3f01a435d2 Rasterize curves directly with trapezoids instead of flattening. r=lsalzman

Backed out for causing mochitest failures @test_toDataURL_parameters_png.html.

Flags: needinfo?(jmuizelaar)
Pushed by jmuizelaar@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/769b2c148e19 Rasterize curves directly with trapezoids instead of flattening. r=lsalzman

Backed out for causing build bustages

Backout link

Push with failures

Failure log

Pushed by jmuizelaar@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/db48fd7bd3ec Rasterize curves directly with trapezoids instead of flattening. r=lsalzman
Status: UNCONFIRMED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 135 Branch
Duplicate of this bug: 1935418
Regressions: 1937287
Duplicate of this bug: 1874622

Backed out as requested by dev for causing Bug 1937287

Backout link

Status: RESOLVED → REOPENED
Ever confirmed: true
Resolution: FIXED → ---
Target Milestone: 135 Branch → ---
Depends on: 1937287
Pushed by jmuizelaar@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/1da3b580ac68 Rasterize curves directly with trapezoids instead of flattening. r=lsalzman

Backed out for causing build bustages.

Pushed by jmuizelaar@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/398734cfaf84 Rasterize curves directly with trapezoids instead of flattening. r=lsalzman
Status: REOPENED → RESOLVED
Closed: 1 year ago1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 135 Branch
Regressions: 1937751

The patch landed in nightly and beta is affected.
:jrmuizel, is this bug important enough to require an uplift?

  • If yes, please nominate the patch for beta approval. Also, don't forget to request an uplift for the patches in the regressions caused by this fix.
  • If no, please set status-firefox134 to wontfix.

For more information, please visit BugBot documentation.

Flags: needinfo?(jmuizelaar)

We've been shipping this long enough on other platforms and the implementation has enough risk that I'd prefer to let this bake.

Flags: needinfo?(jmuizelaar)
No longer duplicate of this bug: 1935418
No longer depends on: 1937287
See Also: 1867774
No longer regressions: 1937751
See Also: → 1937751
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: