servo/components/pixels
sagudev a631b42e60
pixels: Ensure expected formats when accesing bytes of snapshot (#37767)
I introduced snapshot in #36119 to pack raw bytes and metadata together,
now we take the next step and require for user to always specify what
kind of byte data they want when calling `as_bytes` or `to_vec`
(basically joining transform and data). There are also valid usages when
one might require just one property of bytes (textures can generally
handle both RGBA and BGRA). There are also valid usages of using just
raw bytes (when cropping). This PR tries to make such usages more
obvious.

This will make it easier to fix stuff around 2d canvas (we do not want
to assume any bytes properties in abstraction).

Testing: Code is covered by WPT tests.

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2025-07-03 15:02:41 +00:00
..
tests imagebitmap: Crop bitmap data with formatting (#37397) 2025-06-16 12:09:04 +00:00
benches.rs Update pixels::unmultiply_inplace to support RB swap and use it in canvas_state (#35313) 2025-02-06 05:02:49 +00:00
Cargo.toml Organize component Cargo.toml dependencies (#36224) 2025-03-30 19:03:54 +00:00
lib.rs pixels: Move Snapshot and related data structures to pixels (#37590) 2025-06-20 14:47:06 +00:00
snapshot.rs pixels: Ensure expected formats when accesing bytes of snapshot (#37767) 2025-07-03 15:02:41 +00:00