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

@ -187,7 +187,7 @@ impl<'a> CanvasPaintThread<'a> {
Canvas2dMsg::DrawEmptyImage(image_size, dest_rect, source_rect) => {
self.canvas(canvas_id).draw_image(
&vec![0; image_size.area() as usize * 4],
image_size.to_u64(),
image_size,
dest_rect,
source_rect,
false,
@ -203,10 +203,10 @@ impl<'a> CanvasPaintThread<'a> {
) => {
let image_data = self
.canvas(canvas_id)
.read_pixels(Some(source_rect.to_u64()), Some(image_size.to_u64()));
.read_pixels(Some(source_rect.to_u32()), Some(image_size));
self.canvas(other_canvas_id).draw_image(
image_data.data(),
source_rect.size.to_u64(),
source_rect.size.to_u32(),
dest_rect,
source_rect,
smoothing,
@ -398,7 +398,7 @@ impl Canvas<'_> {
fn draw_image(
&mut self,
data: &[u8],
size: Size2D<u64>,
size: Size2D<u32>,
dest_rect: Rect<f64>,
source_rect: Rect<f64>,
smoothing_enabled: bool,
@ -418,8 +418,8 @@ impl Canvas<'_> {
fn read_pixels(
&mut self,
read_rect: Option<Rect<u64>>,
canvas_size: Option<Size2D<u64>>,
read_rect: Option<Rect<u32>>,
canvas_size: Option<Size2D<u32>>,
) -> snapshot::Snapshot {
match self {
Canvas::Raqote(canvas_data) => canvas_data.read_pixels(read_rect, canvas_size),
@ -612,7 +612,7 @@ impl Canvas<'_> {
}
}
fn put_image_data(&mut self, unwrap: Vec<u8>, rect: Rect<u64>) {
fn put_image_data(&mut self, unwrap: Vec<u8>, rect: Rect<u32>) {
match self {
Canvas::Raqote(canvas_data) => canvas_data.put_image_data(unwrap, rect),
}