Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upMake offscreen canvas rendering context use offscreen canvas' size #24518
Conversation
…o using canvas size where needed; made canvas definite instead of optional. still need to change sizing in associated classes to use u64 instead of u32 removed size from offscreencanvasrenderingcontext2d.rs; now getting canvas size through referenced canvas Updated pixels::clip to use u64 data types and added trait to canvasrenderingcontext2d.rs to convert u32 sizes to u64 added Size2D<u32> to Size2D<u64> conversion to webglrenderingcontext and converted u32 sizes to u64 where relevant updated get_rect to use u64. beginning to make type changes to canvas.rs Updated canvas, canvas_data, and canvas_paint_thread to use u64 when relevant Added ability to Recreate canvas when OffscreenCanvas::SetWidth() or OffscreenCanvas::SetHeight() are called Fixed formatting; passes ./mach test-tidy🎉
highfive
commented
Oct 21, 2019
|
Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @paulrouget (or someone else) soon. |
highfive
commented
Oct 21, 2019
|
Heads up! This PR modifies the following files:
|
highfive
commented
Oct 21, 2019
|
Looks great! I just have a couple pieces of cleanup to suggest. |
| let image_data = self | ||
| .canvas(canvas_id) | ||
| .read_pixels(source_rect.to_u32(), image_size.to_u32()); | ||
| .read_pixels(source_rect_u64, image_size.to_u64()); |
This comment has been minimized.
This comment has been minimized.
| @@ -1189,3 +1189,26 @@ impl RectToi32 for Rect<f64> { | |||
| ) | |||
| } | |||
| } | |||
|
|
|||
| pub trait Size2DExt { | |||
This comment has been minimized.
This comment has been minimized.
| @@ -207,3 +211,13 @@ impl<'a> CanvasPaintThread<'a> { | |||
| self.canvases.get_mut(&canvas_id).expect("Bogus canvas id") | |||
| } | |||
| } | |||
|
|
|||
| pub trait Size2DExt { | |||
This comment has been minimized.
This comment has been minimized.
| @@ -2123,3 +2136,13 @@ fn adjust_size_sign( | |||
| } | |||
| (origin, size.to_u32()) | |||
| } | |||
|
|
|||
| pub trait Size2DExt { | |||
This comment has been minimized.
This comment has been minimized.
jdm
Oct 21, 2019
Member
Let's define these in one file in components/script/ and import them from there in the other files in this crate.
| } | ||
| } | ||
|
|
||
| pub trait RectExt_ { |
This comment has been minimized.
This comment has been minimized.
jdm
Oct 21, 2019
Member
I filed servo/euclid#374 if you felt like submitting these methods upstream.
This comment has been minimized.
This comment has been minimized.
|
@bors-servo try=wpt |
Make offscreen canvas rendering context use offscreen canvas' size 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. --- - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #24465 - [X] These changes do not require tests because the purpose of this was to tidy up code
|
|
|
|
Looks like we'll want to be a bit more careful about our implementation of to_u64. Let's base it off of the same conversion methods from upstream: https://github.com/servo/euclid/blob/6dcc86f0e5370b5be45a955239131293bd336c66/src/rect.rs#L539-L546 |
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 <!-- Either: --> - [X] There are tests for these changes – 17 were updated to PASS
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
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
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
bblanke commentedOct 21, 2019
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.
./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThese changes fix #24465
These changes do not require tests because the purpose of this was to tidy up code