| Summary: | createImageBitmap cannot premultiply alpha with ImageData | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Ashley Gullen <ashley> |
| Component: | Canvas | Assignee: | Matt Woodrow <mattwoodrow> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | bfulgham, dino, dpaddock, webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | Safari 15 | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Bug Depends on: | |||
| Bug Blocks: | 182424 | ||
|
Description
Ashley Gullen
2022-02-23 06:00:15 PST
I initially though there might have been a mistake in the optimized code path for premultiplied alpha, but I tried the test case with the slow byte-wise math and the results are identical. Source is unpremultiplied RGBA8, destination for createImageBitmap backing store is premultiplied BGRA8. Colorspace is unchanged. Although the test case talks about [12, 12], the math actually gives you [12, 3]. Inputs to vImagePremultiplyData_RGBA8888 look correct, e.g. the pixel at location 12, 3 in the source buffer is: 00 00 FF 2C The result of premultiplying is: 00 00 2C 2C Which is correct. The RGBA8 is then permuted to BGRA to go into the IOSurface: 00 00 2C 2C Becomes 2C 00 00 2C So the image buffer is properly constructed. I think the issue is when this buffer is used to populate the textImage (WebGLRenderingContextBase::texImageSource) doesn't have the context that the image data is premultiplied; it looks like it rolls the premultiplication out of the buffer before loading into the texture. Pull request: https://github.com/WebKit/WebKit/pull/12834 It doesn't look like WPT has any coverage for createImageBitmap with 'premultiply' set. Pull request: https://github.com/WebKit/WebKit/pull/12891 Committed 263137@main (aa1ea27b114e): <https://commits.webkit.org/263137@main> Reviewed commits have been landed. Closing PR #12891 and removing active labels. |