diff options
Diffstat (limited to 'components/script/dom/imagedata.rs')
-rw-r--r-- | components/script/dom/imagedata.rs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/components/script/dom/imagedata.rs b/components/script/dom/imagedata.rs index d89e5e36d1b..b09984e267f 100644 --- a/components/script/dom/imagedata.rs +++ b/components/script/dom/imagedata.rs @@ -169,8 +169,8 @@ impl ImageData { } #[allow(unsafe_code)] - pub unsafe fn get_rect(&self, rect: Rect<u32>) -> Cow<[u8]> { - pixels::rgba8_get_rect(self.as_slice(), self.get_size(), rect) + pub unsafe fn get_rect(&self, rect: Rect<u64>) -> Cow<[u8]> { + pixels::rgba8_get_rect(self.as_slice(), self.get_size().to_u64(), rect) } pub fn get_size(&self) -> Size2D<u32> { @@ -194,3 +194,13 @@ impl ImageDataMethods for ImageData { NonNull::new(self.data.get()).expect("got a null pointer") } } + +pub trait Size2DExt { + fn to_u64(&self) -> Size2D<u64>; +} + +impl Size2DExt for Size2D<u32> { + fn to_u64(&self) -> Size2D<u64> { + return Size2D::new(self.width as u64, self.height as u64); + } +} |