Skip to content

Commit

Permalink
Implement PathBuilder::get_current_point()
Browse files Browse the repository at this point in the history
  • Loading branch information
pylbrecht committed Aug 25, 2019
1 parent 2a0be45 commit ee7f3db
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion components/canvas/raqote_backend.rs
Expand Up @@ -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);
Expand Down

0 comments on commit ee7f3db

Please sign in to comment.