Merge pull request #6651 from penpot/superalex-path-fixes

🐛 Path fixes
This commit is contained in:
Elena Torró 2025-06-10 12:11:25 +02:00 committed by GitHub
commit f02dd9f8dc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 39 additions and 10 deletions

View file

@ -135,6 +135,9 @@ pub fn render(render_state: &mut RenderState, shape: &Shape, fill: &Fill, antial
.surfaces
.draw_path_to(SurfaceId::Fills, shape, paint);
}
(_, Type::Group(_)) => {
// Groups can have fills but they propagate them to their children
}
(_, _) => {
unreachable!("This shape should not have fills")
}

View file

@ -187,9 +187,11 @@ fn handle_stroke_caps(
scale: f32,
antialias: bool,
) {
let points_count = path.count_points();
let mut points = vec![Point::default(); points_count];
let c_points = path.get_points(&mut points);
let mut points = vec![Point::default(); path.count_points()];
path.get_points(&mut points);
// Curves can have duplicated points, so let's remove consecutive duplicated points
points.dedup();
let c_points = points.len();
// Closed shapes don't have caps
if c_points >= 2 && is_open {
@ -213,7 +215,7 @@ fn handle_stroke_caps(
stroke.width,
&mut paint_stroke,
last_point,
&points[points_count - 2],
&points[c_points - 2],
);
}
}