Open Bug 1446550 Opened 6 years ago Updated 2 years ago

overlay of canvasses with alpha results in color overshoot

Categories

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

58 Branch
defect

Tracking

()

People

(Reporter: derijcke.erik, Unassigned)

Details

(Whiteboard: [gfx-noted])

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.124 Safari/537.36

Steps to reproduce:

Render content with alpha channel in offscreen webgl canvas (using a yuv2rgb+yuv2a shader), then render this canvas into different on-screen canvasses (with context2d)


Actual results:

Background colors seem to 'overshoot' into the canvas, effectively changing the canvas colors entirely (ie a white background makes a green canvas with 50% alpha turn solid purple)

Attached:
An image with canvas opacity set to 1.0 using css, demonstrates the issue nicely, when setting the canvas opacity to 0.5 using css makes the colors not overshoot.



Expected results:

Alpha should be correctly applied, colors should not overshoot.
Can you provide a testcase that demonstrates the issue?
Flags: needinfo?(derijcke.erik)
https://github.com/udevbe/greenfield/tree/ff_bug/browser/public/bug

All required resources to reproduce are in the bug folder. Simply open the index.html and be greeted with purple rain.
Flags: needinfo?(derijcke.erik)
Confirmed on my local linux machine (nvidia proprietary drivers).

Also interesting to note that webrender just completely drops the tiled background on the ground altogether (which looks better but is still incorrect).
Status: UNCONFIRMED → NEW
Ever confirmed: true
Whiteboard: [gfx-noted]
Maybe the WebGL -> Canvas2D drawImage path fails to clamp color values to valid premultiplied alpha.
It's worth checking whether initializing the WebGL context with { premultipliedAlpha: false } makes this behave correctly.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: