From 330d5996ed477f348f2ae9a5fd48cf215fcc7c60 Mon Sep 17 00:00:00 2001 From: Aliaksandr Kalenik Date: Mon, 1 Jul 2024 15:39:13 +0200 Subject: [PATCH] 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. --- .../Libraries/LibWeb/Painting/DisplayListPlayerSkia.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Userland/Libraries/LibWeb/Painting/DisplayListPlayerSkia.cpp b/Userland/Libraries/LibWeb/Painting/DisplayListPlayerSkia.cpp index ee09ec8216f..ff5438e068a 100644 --- a/Userland/Libraries/LibWeb/Painting/DisplayListPlayerSkia.cpp +++ b/Userland/Libraries/LibWeb/Painting/DisplayListPlayerSkia.cpp @@ -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);