Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use raqote for 2D canvas rendering #24422

Merged
merged 4 commits into from Oct 16, 2019
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Some generated files are not rendered by default. Learn more.

@@ -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 }
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.