Skip to content

Commit

Permalink
Use raqote's implementation of Path::contains_point()
Browse files Browse the repository at this point in the history
  • Loading branch information
pylbrecht committed Sep 1, 2019
1 parent 7c81d20 commit 47a6129
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 2 additions & 8 deletions components/canvas/raqote_backend.rs
Expand Up @@ -185,14 +185,8 @@ impl Path {
}

pub fn contains_point(&self, x: f64, y: f64, _path_transform: &Transform2D<f32>) -> bool {
self.as_raqote().ops.iter().any(|op| match op {
PathOp::MoveTo(point) | PathOp::LineTo(point) => {
point.x as f64 == x && point.y as f64 == y
},
PathOp::QuadTo(_, point) => point.x as f64 == x && point.y as f64 == y,
PathOp::CubicTo(_, _, point) => point.x as f64 == x && point.y as f64 == y,
_ => false,
})
let path = self.as_raqote();
path.contains_point(0.1, path.winding, x as f32, y as f32)
}

pub fn copy_to_builder(&self) -> Box<dyn GenericPathBuilder> {
Expand Down

0 comments on commit 47a6129

Please sign in to comment.