mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Implement PathBuilder::get_current_point()
This commit is contained in:
parent
2a0be451ae
commit
ee7f3dbc46
1 changed files with 13 additions and 1 deletions
|
@ -509,7 +509,19 @@ impl GenericPathBuilder for PathBuilder {
|
|||
unimplemented!();
|
||||
}
|
||||
fn get_current_point(&mut self) -> Point2D<f32> {
|
||||
unimplemented!();
|
||||
let path = self.finish();
|
||||
|
||||
for op in path.as_raqote().ops.iter().rev() {
|
||||
match op {
|
||||
PathOp::MoveTo(point) | PathOp::LineTo(point) => {
|
||||
return Point2D::new(point.x, point.y)
|
||||
},
|
||||
PathOp::CubicTo(_, _, point) => return Point2D::new(point.x, point.y),
|
||||
PathOp::QuadTo(_, point) => return Point2D::new(point.x, point.y),
|
||||
_ => {},
|
||||
};
|
||||
}
|
||||
panic!("dead end");
|
||||
}
|
||||
fn line_to(&mut self, point: Point2D<f32>) {
|
||||
self.0.as_mut().unwrap().line_to(point.x, point.y);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue