LibWeb: Fix Skia painter to close paths more correctly

Start point was incorrectly passed into `close_subpath_if_needed()` as
end point, which led to all subpaths being closed.
This commit is contained in:
Aliaksandr Kalenik 2024-07-01 15:39:13 +02:00 committed by Alexander Kalenik
parent 2248ea1ae3
commit 330d5996ed
Notes: sideshowbarker 2024-07-17 22:09:47 +09:00

View file

@ -143,11 +143,10 @@ static SkPath to_skia_path(Gfx::Path const& path)
};
for (auto const& segment : path) {
auto point = segment.point();
subpath_last_point = point;
switch (segment.command()) {
case Gfx::PathSegment::Command::MoveTo: {
if (subpath_start_point.has_value())
close_subpath_if_needed(subpath_start_point.value());
if (subpath_start_point.has_value() && subpath_last_point.has_value())
close_subpath_if_needed(subpath_last_point.value());
subpath_start_point = point;
path_builder.moveTo({ point.x(), point.y() });
break;
@ -178,6 +177,7 @@ static SkPath to_skia_path(Gfx::Path const& path)
default:
VERIFY_NOT_REACHED();
}
subpath_last_point = point;
}
close_subpath_if_needed(subpath_last_point);