mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-06 16:19:23 +00:00
LibWeb+LibGfx: Keep path properties when cloning and implement fill-rule
This commit is contained in:
parent
a7e83c38ee
commit
3467076dbc
Notes:
github-actions[bot]
2024-10-31 10:49:33 +00:00
Author: https://github.com/Gingeh
Commit: 3467076dbc
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1996
Reviewed-by: https://github.com/AtkinsSJ ✅
9 changed files with 40 additions and 20 deletions
|
@ -176,6 +176,7 @@ String Ellipse::to_string() const
|
|||
Gfx::Path Polygon::to_path(CSSPixelRect reference_box, Layout::Node const& node) const
|
||||
{
|
||||
Gfx::Path path;
|
||||
path.set_fill_type(fill_rule);
|
||||
bool first = true;
|
||||
for (auto const& point : points) {
|
||||
Gfx::FloatPoint resolved_point {
|
||||
|
@ -196,12 +197,15 @@ String Polygon::to_string() const
|
|||
{
|
||||
StringBuilder builder;
|
||||
builder.append("polygon("sv);
|
||||
bool first = true;
|
||||
switch (fill_rule) {
|
||||
case Gfx::WindingRule::Nonzero:
|
||||
builder.append("nonzero"sv);
|
||||
break;
|
||||
case Gfx::WindingRule::EvenOdd:
|
||||
builder.append("evenodd"sv);
|
||||
}
|
||||
for (auto const& point : points) {
|
||||
if (!first)
|
||||
builder.append(',');
|
||||
builder.appendff("{} {}", point.x, point.y);
|
||||
first = false;
|
||||
builder.appendff(", {} {}", point.x, point.y);
|
||||
}
|
||||
builder.append(')');
|
||||
return MUST(builder.to_string());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue