Skip to content

Commit

Permalink
fix: reverse clip and set fillrule to oddeven
Browse files Browse the repository at this point in the history
  • Loading branch information
spouliot committed Nov 14, 2024
1 parent bd3d611 commit f20b0b8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Uno.UI.Runtime.Skia.MacOS/MacOSWindowHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,10 @@ private void Draw(double nativeWidth, double nativeHeight, SKSurface surface)
var path = SkiaRenderHelper.RenderRootVisualAndReturnPath(width, height, rootVisual, surface);
if (path is { })
{
var svg = path.ToSvgPathData();
// remove first path since it cover the whole area
NativeUno.uno_window_clip_svg(_nativeWindow.Handle, svg.Substring(svg.IndexOf('Z') + 1));
using var negativePath = new SKPath();
negativePath.AddRect(new SKRect(0, 0, width, height));
using var diffPath = negativePath.Op(path, SKPathOp.Difference);
NativeUno.uno_window_clip_svg(_nativeWindow.Handle, diffPath.ToSvgPathData());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,7 @@ void uno_window_clip_svg(UNOWindow* window, const char* svg)
}
mask.fillColor = NSColor.blueColor.CGColor; // anything but clearColor
mask.path = path;
mask.fillRule = kCAFillRuleEvenOdd;
}
}
}
Expand Down

0 comments on commit f20b0b8

Please sign in to comment.