Closed Bug 1937929 Opened 1 year ago Closed 1 year ago

Arc with setLineDash sometimes draws thick, solid line

Categories

(Core :: Graphics: Canvas2D, defect)

Firefox 133
defect

Tracking

()

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

People

(Reporter: joelspadin, Assigned: lsalzman)

References

(Regression)

Details

(Keywords: regression)

Attachments

(3 files)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:133.0) Gecko/20100101 Firefox/133.0

Steps to reproduce:

When ctx.setLineDash() is followed by ctx.arc(), and when using specific values of radius and line width, the arc draws incorrectly. It is significantly thicker than requested, and the values given to setLineDash() affect what is drawn in seemingly unpredictable ways.

See this reproduction: https://jsbin.com/levibaseyi/2/edit?js,output

This reproduction code is based on the Konva library, where I first discovered the issue (https://github.com/konvajs/konva/issues/1864). I found this through a bug report on an application that uses Konva (https://github.com/joelspadin/xivplan/issues/35).

Actual results:

Firefox draws an arc with a much thicker line than requested, and which has a dash pattern that does not match the requested sizes.

Expected results:

Firefox draws a circle with a thin, dashed line.

The Bugbug bot thinks this bug should belong to the 'Core::Graphics: Canvas2D' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Graphics: Canvas2D
Product: Firefox → Core

Can repro. Repros only on gpu-canvas (works correctly with skia-canvas and d2d-canvas).

Bisection: https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=382081ff53ef2dd62a058d17e7022ca0a6bf929a&tochange=05b607c3bbe6ca02e9133ecb969e033fd3d7959e

Suspect: Bug 1829026

Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(lsalzman)
Keywords: regression
Regressed by: 1829026

Set release status flags based on info from the regressing bug 1829026

When drawing arcs or similar constructs that may have a path transform to implement
scaling, this scaling may inadvertently alter stroke options such as line width or
dashes. We need to ensure that we don't apply this scaling from the path transform
to stroke options.

Flags: needinfo?(lsalzman)
Assignee: nobody → lsalzman
Status: NEW → ASSIGNED
Pushed by lsalzman@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/f26c61376e9b Avoid applying path transform to stroke options. r=ahale
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 135 Branch

Might be a good dot release ride-along candidate.

Comment on attachment 9444484 [details]
Bug 1937929 - Avoid applying path transform to stroke options.

Beta/Release Uplift Approval Request

  • User impact if declined/Reason for urgency: Buggy arc rendering in Accelerated Canvas2D.
  • Is this code covered by automated tests?: Unknown
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Just a simple one line bug workaround.
  • String changes made/needed:
  • Is Android affected?: Yes
Attachment #9444484 - Flags: approval-mozilla-beta?

Comment on attachment 9444484 [details]
Bug 1937929 - Avoid applying path transform to stroke options.

Approved for 134 RC1.

Attachment #9444484 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: