mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
properly handle close in get_current_point
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
parent
9b204867c0
commit
a281f3553e
1 changed files with 10 additions and 1 deletions
|
@ -708,7 +708,7 @@ impl GenericPathBuilder<RaqoteBackend> for PathBuilder {
|
||||||
PathOp::MoveTo(point) | PathOp::LineTo(point) => Some(Point2D::new(point.x, point.y)),
|
PathOp::MoveTo(point) | PathOp::LineTo(point) => Some(Point2D::new(point.x, point.y)),
|
||||||
PathOp::CubicTo(_, _, point) => Some(Point2D::new(point.x, point.y)),
|
PathOp::CubicTo(_, _, point) => Some(Point2D::new(point.x, point.y)),
|
||||||
PathOp::QuadTo(_, point) => Some(Point2D::new(point.x, point.y)),
|
PathOp::QuadTo(_, point) => Some(Point2D::new(point.x, point.y)),
|
||||||
PathOp::Close => None,
|
PathOp::Close => path.ops.first().and_then(get_first_point),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -731,6 +731,15 @@ impl GenericPathBuilder<RaqoteBackend> for PathBuilder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn get_first_point(op: &PathOp) -> Option<euclid::Point2D<f32, euclid::UnknownUnit>> {
|
||||||
|
match op {
|
||||||
|
PathOp::MoveTo(point) | PathOp::LineTo(point) => Some(Point2D::new(point.x, point.y)),
|
||||||
|
PathOp::CubicTo(point, _, _) => Some(Point2D::new(point.x, point.y)),
|
||||||
|
PathOp::QuadTo(point, _) => Some(Point2D::new(point.x, point.y)),
|
||||||
|
PathOp::Close => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub trait ToRaqoteStyle {
|
pub trait ToRaqoteStyle {
|
||||||
type Target;
|
type Target;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue