Closed Bug 1818820 Opened 1 year ago Closed 1 year ago

Canvas 2D with Copy + Rotate(0) +Clip fails on Window 10

Categories

(Core :: Graphics: Canvas2D, defect)

Firefox 110
defect

Tracking

()

VERIFIED FIXED
112 Branch
Tracking Status
firefox-esr102 --- unaffected
firefox110 --- wontfix
firefox111 --- verified
firefox112 --- verified

People

(Reporter: raffy, Assigned: jrmuizel)

References

(Regression)

Details

(Keywords: regression)

Attachments

(3 files)

Attached image Examples.png

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

Steps to reproduce:

function test(rot) {
let canvas = document.createElement('canvas');
canvas.style.border = '1px solid #000';
canvas.width = canvas.height = 200;
let ctx = canvas.getContext('2d');
ctx.globalCompositeOperation = 'copy';
ctx.translate(100, 100);
ctx.rotate(rot);
ctx.rect(-50, -50, 100, 100);
ctx.clip();
ctx.fillStyle = '#f00';
ctx.resetTransform();
ctx.fillRect(0, 0, canvas.width, canvas.height);
return canvas;
}

// works correctly
test(0.0001)
test(0.2)

// bugged
test(0)
test(Math.PI/2)
test(Math.PI)

Actual results:

When using composition "copy" with rotation at right angles, the clip region is ignored.

Expected results:

The clip region should be expected in all cases.

Component: Untriaged → Graphics: Canvas2D
Product: Firefox → Core
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: regression
Regressed by: 1804952
Attached file cas.html

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

:jrmuizel, since you are the author of the regressor, bug 1804952, could you take a look? Also, could you set the severity field?

For more information, please visit auto_nag documentation.

Flags: needinfo?(jmuizelaar)

I think this is exposing an existing bug in the D2D backend.

I think the bug may have been caused by https://hg.mozilla.org/mozilla-central/rev/538d248fa252

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

This ensures that we have our clips pushed when we expect them to.

Pushed by jmuizelaar@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/b7b8c57a5cba
Fix drawing of some blend modes with non-complex clips. r=bas

Comment on attachment 9320840 [details]
Bug 1818820. Fix drawing of some blend modes with non-complex clips.

Beta/Release Uplift Approval Request

  • User impact if declined: Sometimes we ignore the clip in canvas
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: No
  • 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): The common paths in canvas are quite well tested so if this introduces a problem it's likely to be rare.
  • String changes made/needed:
  • Is Android affected?: No
Attachment #9320840 - Flags: approval-mozilla-beta?
Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 112 Branch
Duplicate of this bug: 1819304

Comment on attachment 9320840 [details]
Bug 1818820. Fix drawing of some blend modes with non-complex clips.

Approved for 111.0 RC1

Attachment #9320840 - Flags: approval-mozilla-beta? → approval-mozilla-beta+

Impressive work Mozilla team. Thanks for the quick fix!

I apologize for the poorly formatted report and lack of one-click demo. It was my first bug report and I didn't know I could use markdown or provide an inline attachment.

Flags: qe-verify+

Reproduced the issue on Win10x64 using 110.0a1(20230105213109).
Verified as fixed on Win10x64/Ubuntu20.04/Mac10.13 using 112.0a1(20230306094520) and 111.0(20230306162820).

Status: RESOLVED → VERIFIED
Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: