Initial move of canvas/context/snapshot size from u64 -> u32

Changed the two instances of `euclid::default::Size2D<u64>` in
`servo/components/script/canvas_context.rs` and
`servo/components/shared/snapshot/lib.rs` that were outlined as the bare minimum
in "Make canvas/context/snapshot size be u32 everywhere" to
`euclid::default::Size2D<u32>`. Every other change made in this commit is
either:
 - of similar nature, and is the minimum that would allow compilation
 - resolving lints triggered by the former

More might be needed to complete the issue, but I feel like this is a good
starting point.

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

Signed-off-by: hashcatHitman <155700084+hashcatHitman@users.noreply.github.com>
This commit is contained in:
hashcatHitman 2025-05-03 15:41:45 -04:00
parent c94605b13e
commit 326a2e9ab6
No known key found for this signature in database
14 changed files with 53 additions and 53 deletions

View file

@ -383,7 +383,7 @@ impl CanvasState {
}
}
pub(crate) fn get_rect(&self, canvas_size: Size2D<u64>, rect: Rect<u64>) -> Vec<u8> {
pub(crate) fn get_rect(&self, canvas_size: Size2D<u32>, rect: Rect<u32>) -> Vec<u8> {
assert!(self.origin_is_clean());
assert!(Rect::from_size(canvas_size).contains_rect(&rect));
@ -1486,7 +1486,7 @@ impl CanvasState {
#[allow(clippy::too_many_arguments)]
pub(crate) fn get_image_data(
&self,
canvas_size: Size2D<u64>,
canvas_size: Size2D<u32>,
global: &GlobalScope,
sx: i32,
sy: i32,
@ -1506,7 +1506,7 @@ impl CanvasState {
}
let (origin, size) = adjust_size_sign(Point2D::new(sx, sy), Size2D::new(sw, sh));
let read_rect = match pixels::clip(origin, size.to_u64(), canvas_size) {
let read_rect = match pixels::clip(origin, size.to_u32(), canvas_size) {
Some(rect) => rect,
None => {
// All the pixels are outside the canvas surface.
@ -1526,7 +1526,7 @@ impl CanvasState {
// https://html.spec.whatwg.org/multipage/#dom-context-2d-putimagedata
pub(crate) fn put_image_data(
&self,
canvas_size: Size2D<u64>,
canvas_size: Size2D<u32>,
imagedata: &ImageData,
dx: i32,
dy: i32,
@ -1547,7 +1547,7 @@ impl CanvasState {
#[allow(unsafe_code, clippy::too_many_arguments)]
pub(crate) fn put_image_data_(
&self,
canvas_size: Size2D<u64>,
canvas_size: Size2D<u32>,
imagedata: &ImageData,
dx: i32,
dy: i32,
@ -1579,7 +1579,7 @@ impl CanvasState {
Point2D::new(dirty_x, dirty_y),
Size2D::new(dirty_width, dirty_height),
);
let src_rect = match pixels::clip(src_origin, src_size.to_u64(), imagedata_size.to_u64()) {
let src_rect = match pixels::clip(src_origin, src_size.to_u32(), imagedata_size.to_u32()) {
Some(rect) => rect,
None => return,
};