1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:37:35 +00:00

LibWeb: Close all subpaths when filling SVG paths

This commit is contained in:
MacDue 2023-06-24 16:49:28 +01:00 committed by Andreas Kling
parent f2881f4662
commit 6b40271b95

View file

@ -86,13 +86,13 @@ void SVGGeometryPaintable::paint(PaintContext& context, PaintPhase phase) const
auto const& original_path = const_cast<SVG::SVGGeometryElement&>(geometry_element).get_path();
Gfx::Path path = original_path.copy_transformed(paint_transform);
// Fills are computed as though all paths are closed (https://svgwg.org/svg2-draft/painting.html#FillProperties)
// Fills are computed as though all subpaths are closed (https://svgwg.org/svg2-draft/painting.html#FillProperties)
auto closed_path = [&] {
// We need to fill the path before applying the stroke, however the filled
// path must be closed, whereas the stroke path may not necessary be closed.
// Copy the path and close it for filling, but use the previous path for stroke
auto copy = path;
copy.close();
copy.close_all_subpaths();
return copy;
};