Closed Bug 1769082 Opened 2 years ago Closed 2 years ago

Using the luminosity globalCompositeOperation in combination with other globalCompositeOperations causes rendering errors

Categories

(Core :: Graphics: Canvas2D, defect, P3)

Firefox 100
defect

Tracking

()

RESOLVED FIXED
103 Branch
Tracking Status
firefox-esr102 --- wontfix
firefox100 --- wontfix
firefox101 --- wontfix
firefox102 --- wontfix
firefox103 --- fixed

People

(Reporter: george, Assigned: lsalzman)

References

Details

Attachments

(1 file)

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

Steps to reproduce:

I can reproduce by following these steps:

  1. create a canvas element and insert an image with drawImage
  2. set globalCompositeOperation to "saturation" and fill the canvas with #000
  3. set globalCompositeOperation to "luminosity" and globalAlpha to 0.5 and fill the canvas with #fff

Where the desaturation layer and luminosity layer overlap, a rendering error occurs

This codepen contains a recreatable example https://codepen.io/GBro/pen/gOvwGod?editors=0010

Actual results:

On the Windows version of Firefox, it was rendered correctly.

On the Mac OSX version of Firefox (user agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:100.0) Gecko/20100101 Firefox/100.0), the resultant image has a speckling effect, with black and white spots dotted around the image where the two globalCompositerOperation effects overlap.

Expected results:

The canvas should display a desaturated and brightened version of the original image

Same thing happens on Linux. Difference may be caused by D2D vs Skia.

If you change gfx.canvas.azure.backends to be just skia, does it reproduce on Windows? (Requires restart)

Flags: needinfo?(george)

(In reply to Andrew Osmond [:aosmond] (he/him) from comment #2)

Same thing happens on Linux. Difference may be caused by D2D vs Skia.

If you change gfx.canvas.azure.backends to be just skia, does it reproduce on Windows? (Requires restart)

Yep, same issue occurs for me on Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:101.0) Gecko/20100101 Firefox/101.0 after making that config change

Flags: needinfo?(george)

Bug in Skia or DrawTargetSkia?

Severity: -- → S3
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(lsalzman)
OS: macOS → All
Priority: -- → P3
Hardware: Desktop → All

This bug is in Skia. It reproduces in Chromium if you disable hardware acceleration there. They fixed it in Skia's GPU pipeline, but not in the software pipeline.

Flags: needinfo?(lsalzman)

This applies a fix that is present in Skia's HW luminosity blend mode to its
CPU pipeline so that the luminosity mode no longer divides by zero, thus avoiding
infs and nans.

Assignee: nobody → lsalzman
Status: NEW → ASSIGNED
Pushed by lsalzman@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/f292760857f2
Avoid divide-by-zero in Skia's luminosity blend mode. r=jrmuizel,gfx-reviewers
Flags: needinfo?(lsalzman)
Pushed by lsalzman@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/8d845c981228
Avoid divide-by-zero in Skia's luminosity blend mode. r=jrmuizel,gfx-reviewers
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 103 Branch

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

  • If yes, please nominate the patch for beta approval.
  • If no, please set status-firefox102 to wontfix.

For more information, please visit auto_nag documentation.

Flags: needinfo?(lsalzman)

Comment on attachment 9280894 [details]
Bug 1769082 - Avoid divide-by-zero in Skia's luminosity blend mode. r?jrmuizel

Beta/Release Uplift Approval Request

  • User impact if declined: Visual artifacts when using the luminosity blend mode in CSS or Canvas.
  • Is this code covered by automated tests?: Yes
  • 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): Fix accepted by upstream Skia.
  • String changes made/needed:
  • Is Android affected?: Yes
Flags: needinfo?(lsalzman)
Attachment #9280894 - Flags: approval-mozilla-beta?

Comment on attachment 9280894 [details]
Bug 1769082 - Avoid divide-by-zero in Skia's luminosity blend mode. r?jrmuizel

This is landing too late to take into our last beta, sorry.

Attachment #9280894 - 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

Created:
Updated:
Size: