Auto merge of #24422 - pylbrecht:raqote, r=jdm

Use raqote for 2D canvas rendering

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

---
<!-- 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 #23431

<!-- Either: -->

<!-- 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/24422)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2019-10-16 09:12:17 -04:00 committed by GitHub
commit bcd8c5e597
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 13 deletions

View file

@ -180,9 +180,11 @@ impl DrawOptions {
impl Path {
pub fn transformed_copy_to_builder(
&self,
_transform: &Transform2D<f32>,
transform: &Transform2D<f32>,
) -> Box<dyn GenericPathBuilder> {
unimplemented!()
Box::new(PathBuilder(Some(raqote::PathBuilder::from(
self.as_raqote().clone().transform(transform),
))))
}
pub fn contains_point(&self, x: f64, y: f64, _path_transform: &Transform2D<f32>) -> bool {
@ -306,7 +308,7 @@ impl GenericDrawTarget for raqote::DrawTarget {
_sigma: f32,
_operator: CompositionOp,
) {
unimplemented!();
warn!("no support for drawing shadows");
}
fn fill(&mut self, path: &Path, pattern: Pattern, draw_options: &DrawOptions) {
self.fill(
@ -355,7 +357,7 @@ impl GenericDrawTarget for raqote::DrawTarget {
self.set_transform(matrix);
}
fn snapshot(&self) -> SourceSurface {
unimplemented!();
SourceSurface::Raqote(self.snapshot_data_owned())
}
fn stroke(
&mut self,
@ -633,11 +635,12 @@ pub trait ToRaqoteGradientStop {
impl ToRaqoteGradientStop for CanvasGradientStop {
fn to_raqote(&self) -> raqote::GradientStop {
let color: u32 = ((self.color.alpha as u32) << 8 * 3 |
(self.color.red as u32) << 8 * 2 |
(self.color.green as u32) << 8 * 1 |
(self.color.blue as u32) << 8 * 0)
.into();
let color = raqote::Color::new(
self.color.alpha,
self.color.red,
self.color.green,
self.color.blue,
);
let position = self.offset as f32;
raqote::GradientStop { position, color }
}