mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
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:
parent
c94605b13e
commit
326a2e9ab6
14 changed files with 53 additions and 53 deletions
|
@ -447,7 +447,7 @@ impl<'a, B: Backend> CanvasData<'a, B> {
|
|||
pub(crate) fn draw_image(
|
||||
&mut self,
|
||||
image_data: &[u8],
|
||||
image_size: Size2D<u64>,
|
||||
image_size: Size2D<u32>,
|
||||
dest_rect: Rect<f64>,
|
||||
source_rect: Rect<f64>,
|
||||
smoothing_enabled: bool,
|
||||
|
@ -457,7 +457,7 @@ impl<'a, B: Backend> CanvasData<'a, B> {
|
|||
let source_rect = source_rect.ceil();
|
||||
// It discards the extra pixels (if any) that won't be painted
|
||||
let image_data = if Rect::from_size(image_size.to_f64()).contains_rect(&source_rect) {
|
||||
pixels::rgba8_get_rect(image_data, image_size, source_rect.to_u64()).into()
|
||||
pixels::rgba8_get_rect(image_data, image_size, source_rect.to_u32()).into()
|
||||
} else {
|
||||
image_data.into()
|
||||
};
|
||||
|
@ -1221,7 +1221,7 @@ impl<'a, B: Backend> CanvasData<'a, B> {
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-context-2d-putimagedata
|
||||
pub(crate) fn put_image_data(&mut self, mut imagedata: Vec<u8>, rect: Rect<u64>) {
|
||||
pub(crate) fn put_image_data(&mut self, mut imagedata: Vec<u8>, rect: Rect<u32>) {
|
||||
assert_eq!(imagedata.len() % 4, 0);
|
||||
assert_eq!(rect.size.area() as usize, imagedata.len() / 4);
|
||||
pixels::rgba8_byte_swap_and_premultiply_inplace(&mut imagedata);
|
||||
|
@ -1310,8 +1310,8 @@ impl<'a, B: Backend> CanvasData<'a, B> {
|
|||
#[allow(unsafe_code)]
|
||||
pub(crate) fn read_pixels(
|
||||
&self,
|
||||
read_rect: Option<Rect<u64>>,
|
||||
canvas_size: Option<Size2D<u64>>,
|
||||
read_rect: Option<Rect<u32>>,
|
||||
canvas_size: Option<Size2D<u32>>,
|
||||
) -> Snapshot {
|
||||
let canvas_size = canvas_size.unwrap_or(self.drawtarget.get_size().cast());
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue