createImageBitmap handles premultiply alpha, resize and ImageData incorrectly
Categories
(Core :: Graphics: Canvas2D, defect)
Tracking
()
Tracking | Status | |
---|---|---|
firefox-esr91 | --- | unaffected |
firefox97 | --- | unaffected |
firefox98 | --- | wontfix |
firefox99 | --- | wontfix |
firefox100 | --- | fixed |
People
(Reporter: ashley, Assigned: angus.sawyer)
References
(Regression)
Details
(Keywords: regression)
Attachments
(1 file)
Steps to reproduce:
Nightly 99.0a1 (2022-02-23) appears to support the resizeWidth and resizeHeight options of createImageBitmap. However when also used with premultiplyAlpha: "premultiply", and passed an ImageData, it produces incorrect pixel data in the ImageBitmap.
Repro URL: https://downloads.scirra.com/labs/bugs/imagebitmapalpha/resize.html
This tests createImageBitmap with Blob, Image, Canvas and ImageData, each time specifying both to premultiply alpha and resize the image larger. It then uses a WebGL context to read back the ImageBitmap pixel data via texture upload.
Actual results:
The first three cases work OK, producing pixel data [0, 0, 40, 40]. The last case with ImageData fails, producing pixel data [0, 0, 254, 254].
I'm not even sure what it's done here: the original pixel data is [0, 0, 255, 44], i.e. semitransparent blue. So it's not that it's skipped premultiplying alpha - somehow the alpha value has actually increased.
Expected results:
The last case with ImageData should produce the same pixel data results as the first three cases - in this test, [0, 0, 40, 40].
Comment 1•3 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::Graphics: WebRender' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.
Comment 2•3 years ago
|
||
Any interest in investigating/fixing this?
Updated•3 years ago
|
Comment 3•3 years ago
|
||
Set release status flags based on info from the regressing bug 1733559
Assignee | ||
Comment 4•3 years ago
|
||
I'll take a look. ImageData takes a different path to everything else.
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Assignee | ||
Comment 5•3 years ago
|
||
Two issues:
The result of scaling & premultiply is order critical, the previous order for ImageData was scale > premultiply, the other image sources were premultiplied by default so didn't expose this issue. Reorder in the ImageData and common code paths (the original order followed the w3c spec order of operations - maybe the spec needs amending).
The ImageData path did not set the premultiplied flag of the resulting ImageBitmap correctly so the image would be premultiplied again in PrepareForDrawTarget.
Updated•3 years ago
|
Updated•3 years ago
|
Comment 6•3 years ago
|
||
There's a r+ patch which didn't land and no activity in this bug for 2 weeks.
:angus.sawyer, could you have a look please?
If you still have some work to do, you can add an action "Plan Changes" in Phabricator.
For more information, please visit auto_nag documentation.
Comment 8•3 years ago
|
||
bugherder |
Updated•3 years ago
|
Comment 9•3 years ago
|
||
The patch landed in nightly and beta is affected.
:angus.sawyer, is this bug important enough to require an uplift?
If not please set status_beta
to wontfix
.
For more information, please visit auto_nag documentation.
Updated•3 years ago
|
Description
•