aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/imagedata.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2019-11-11 14:47:56 -0500
committerGitHub <noreply@github.com>2019-11-11 14:47:56 -0500
commit905f714bb4b2959f1735cc7469969696eac56d47 (patch)
tree39073c7c0990269cd976fe0be6da6156b2992065 /components/script/dom/imagedata.rs
parent06e58212cbca2ff6b24f0ad6e1e1c01237da480d (diff)
parentec2961920b74fbe0345f72e6007c6d42ae852019 (diff)
downloadservo-905f714bb4b2959f1735cc7469969696eac56d47.tar.gz
servo-905f714bb4b2959f1735cc7469969696eac56d47.zip
Auto merge of #24524 - bblanke:consolidate-size-helpers, r=jdm
Make offscreen canvas rendering context use offscreen canvas' size; Consolidate size helpers <!-- Please describe your changes on the following line: --> Addresses issues raised in the review of PR #24518 and includes changes to 17 tests' metadata for those that now PASS. Contains fixes in PR #24518: Updated the offscreen canvas rendering context to use the offscreen canvas' size. This involved upgrading several methods to accept u64 sizes. Additionally, the code in OffscreenCanvas::SetWidth() and OffscreenCanvas::SetHeight() was updated to send CanvasMsg::Recreate to the canvas paint thread. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #24465 and fix #24536 <!-- Either: --> - [X] There are tests for these changes – 17 were updated to PASS
Diffstat (limited to 'components/script/dom/imagedata.rs')
-rw-r--r--components/script/dom/imagedata.rs14
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);
+ }
+}