Auto merge of #23135 - maharsh312:master, r=jdm

Create CanvasRect for OffscreenCanvas

<!-- Please describe your changes on the following line: -->

Created CanvasRect fot OffscreenCanvas and Updated Testcases

---
<!-- 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
- [ ] `./mach test-tidy` does not report any errors
- [ ] These changes fix #___ (GitHub issue number if applicable)

<!-- Either: -->
- [X] There are tests for these changes OR
- [ ] These changes do not require tests because ___

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23135)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2019-05-13 16:19:57 -04:00 committed by GitHub
commit fdafc833ae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
131 changed files with 145 additions and 551 deletions

View file

@ -176,7 +176,7 @@ pub struct CanvasData<'a> {
impl<'a> CanvasData<'a> {
pub fn new(
size: Size2D<u32>,
size: Size2D<u64>,
webrender_api_sender: webrender_api::RenderApiSender,
antialias: AntialiasMode,
canvas_id: CanvasId,
@ -708,13 +708,13 @@ impl<'a> CanvasData<'a> {
.set_composition_op(op.to_azure_style());
}
pub fn create(size: Size2D<u32>) -> DrawTarget {
pub fn create(size: Size2D<u64>) -> DrawTarget {
// FIXME(nox): Why is the size made of i32 values?
DrawTarget::new(BackendType::Skia, size.to_i32(), SurfaceFormat::B8G8R8A8)
}
pub fn recreate(&mut self, size: Size2D<u32>) {
self.drawtarget = CanvasData::create(size);
self.drawtarget = CanvasData::create(Size2D::new(size.width as u64, size.height as u64));
self.state = CanvasPaintState::new(self.state.draw_options.antialias);
self.saved_states.clear();
// Webrender doesn't let images change size, so we clear the webrender image key.

View file

@ -77,7 +77,7 @@ impl<'a> CanvasPaintThread<'a> {
pub fn create_canvas(
&mut self,
size: Size2D<u32>,
size: Size2D<u64>,
webrender_api_sender: webrender_api::RenderApiSender,
antialias: bool,
) -> CanvasId {