diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2019-11-11 14:47:56 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-11 14:47:56 -0500 |
commit | 905f714bb4b2959f1735cc7469969696eac56d47 (patch) | |
tree | 39073c7c0990269cd976fe0be6da6156b2992065 /components/script/dom/webglrenderingcontext.rs | |
parent | 06e58212cbca2ff6b24f0ad6e1e1c01237da480d (diff) | |
parent | ec2961920b74fbe0345f72e6007c6d42ae852019 (diff) | |
download | servo-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/webglrenderingcontext.rs')
-rw-r--r-- | components/script/dom/webglrenderingcontext.rs | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs index 228ccd491b9..c843ab578d1 100644 --- a/components/script/dom/webglrenderingcontext.rs +++ b/components/script/dom/webglrenderingcontext.rs @@ -2963,11 +2963,16 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { let src_origin = Point2D::new(x, y); let src_size = Size2D::new(width as u32, height as u32); let fb_size = Size2D::new(fb_width as u32, fb_height as u32); - let src_rect = match pixels::clip(src_origin, src_size, fb_size) { + let src_rect = match pixels::clip(src_origin, src_size.to_u64(), fb_size.to_u64()) { Some(rect) => rect, None => return, }; + // Note: we're casting a Rect<u64> back into a Rect<u32> here, but it's okay because + // it used u32 data types to begin with. It just got converted to Rect<u64> in + // pixels::clip + let src_rect = src_rect.to_u32(); + let mut dest_offset = 0; if x < 0 { dest_offset += -x * bytes_per_pixel; @@ -4485,3 +4490,13 @@ impl WebGLMessageSender { self.wake_after_send(|| self.sender.send_dom_to_texture(command)) } } + +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); + } +} |