Introduce snapshot concept of canvas (#36119)

Each canvas context returns snapshot instead of just raw bytes. This
allows as to hold off conversions (BGRA <-> RGBA, (un)premultiply) to
when/if they are actually needed. For example when loading snapshot into
webgl we can load both RGBA and BGRA so no conversion is really needed.

Currently whole thing is designed to be able to be extend on
https://github.com/servo/ipc-channel/pull/356, to make less copies.
Hence some commented out code.


Fixes #35759
There are tests for these changes in WPT

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
sagudev 2025-04-23 09:32:47 +02:00 committed by GitHub
parent b6967fc4c8
commit 73b778e67f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
37 changed files with 724 additions and 251 deletions

View file

@ -38,4 +38,3 @@ stylo = { workspace = true }
stylo_traits = { workspace = true }
surfman = { workspace = true, features = ["sm-x11"] }
webrender_api = { workspace = true }