Change canvas/context/snapshot size from u64 -> u32 (#36827)

Replaces uses of `euclid::default::Size2D<u64>` with
`euclid::default::Size2D<u32>` for the canvas/context/snapshot.

This PR includes changes to the following components:
 - canvas
 - pixels
 - script
 - script_bindings
 - shared/canvas
 - shared/snapshot

Testing: https://github.com/hashcatHitman/servo/actions/runs/15426115391
(as of 892edc0048)

Fixes: #36706

---------

Signed-off-by: hashcatHitman <155700084+hashcatHitman@users.noreply.github.com>
This commit is contained in:
Sam K 2025-06-07 14:37:21 +00:00 committed by GitHub
parent 87de9fdf8c
commit a625420b23
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 69 additions and 69 deletions

View file

@ -87,7 +87,7 @@ pub type IpcSnapshot = Snapshot<IpcSharedMemory>;
/// <https://gpuweb.github.io/gpuweb/#abstract-opdef-get-a-copy-of-the-image-contents-of-a-context>
#[derive(Clone, Debug, Deserialize, MallocSizeOf, Serialize)]
pub struct Snapshot<T = Data> {
size: Size2D<u64>,
size: Size2D<u32>,
/// internal data (can be any format it will be converted on use if needed)
data: T,
/// RGBA/BGRA (reflect internal data)
@ -97,7 +97,7 @@ pub struct Snapshot<T = Data> {
}
impl<T> Snapshot<T> {
pub const fn size(&self) -> Size2D<u64> {
pub const fn size(&self) -> Size2D<u32> {
self.size
}
@ -131,7 +131,7 @@ impl Snapshot<Data> {
}
/// Returns snapshot with provided size that is black transparent alpha
pub fn cleared(size: Size2D<u64>) -> Self {
pub fn cleared(size: Size2D<u32>) -> Self {
Self {
size,
data: Data::Owned(vec![0; size.area() as usize * 4]),
@ -143,7 +143,7 @@ impl Snapshot<Data> {
}
pub fn from_vec(
size: Size2D<u64>,
size: Size2D<u32>,
format: PixelFormat,
alpha_mode: AlphaMode,
data: Vec<u8>,
@ -157,7 +157,7 @@ impl Snapshot<Data> {
}
pub fn from_shared_memory(
size: Size2D<u64>,
size: Size2D<u32>,
format: PixelFormat,
alpha_mode: AlphaMode,
ism: IpcSharedMemory,
@ -177,7 +177,7 @@ impl Snapshot<Data> {
/// This is safe if data is owned by this process only
/// (ownership is transferred on send)
pub unsafe fn from_shared_memory(
size: Size2D<u64>,
size: Size2D<u32>,
format: PixelFormat,
alpha_mode: AlphaMode,
ism: IpcSharedMemory,