mirror of
https://github.com/servo/servo.git
synced 2025-08-04 05:00:08 +01:00
Use raqote's implementation of Path::contains_point()
This commit is contained in:
parent
7c81d20869
commit
47a6129332
2 changed files with 3 additions and 9 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -3712,7 +3712,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "raqote"
|
name = "raqote"
|
||||||
version = "0.6.2-alpha.0"
|
version = "0.6.2-alpha.0"
|
||||||
source = "git+https://github.com/jrmuizel/raqote#b3675e6cc1ac1d854605918f6613b64636d5e47b"
|
source = "git+https://github.com/jrmuizel/raqote#b1437ce88d27d376520485a1f8d60c5a480be5c1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"font-kit 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"font-kit 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|
|
@ -185,14 +185,8 @@ impl Path {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn contains_point(&self, x: f64, y: f64, _path_transform: &Transform2D<f32>) -> bool {
|
pub fn contains_point(&self, x: f64, y: f64, _path_transform: &Transform2D<f32>) -> bool {
|
||||||
self.as_raqote().ops.iter().any(|op| match op {
|
let path = self.as_raqote();
|
||||||
PathOp::MoveTo(point) | PathOp::LineTo(point) => {
|
path.contains_point(0.1, path.winding, x as f32, y as f32)
|
||||||
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,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn copy_to_builder(&self) -> Box<dyn GenericPathBuilder> {
|
pub fn copy_to_builder(&self) -> Box<dyn GenericPathBuilder> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue