From f20b0b864ef69e055f05c5561581588370386923 Mon Sep 17 00:00:00 2001 From: Sebastien Pouliot Date: Thu, 14 Nov 2024 15:20:34 -0500 Subject: [PATCH] fix: reverse clip and set fillrule to oddeven --- src/Uno.UI.Runtime.Skia.MacOS/MacOSWindowHost.cs | 7 ++++--- .../UnoNativeMac/UnoNativeMac/UNOWindow.m | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Uno.UI.Runtime.Skia.MacOS/MacOSWindowHost.cs b/src/Uno.UI.Runtime.Skia.MacOS/MacOSWindowHost.cs index 6ceb64d78f3e..ee89a9fcf44d 100644 --- a/src/Uno.UI.Runtime.Skia.MacOS/MacOSWindowHost.cs +++ b/src/Uno.UI.Runtime.Skia.MacOS/MacOSWindowHost.cs @@ -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()); } } } diff --git a/src/Uno.UI.Runtime.Skia.MacOS/UnoNativeMac/UnoNativeMac/UNOWindow.m b/src/Uno.UI.Runtime.Skia.MacOS/UnoNativeMac/UnoNativeMac/UNOWindow.m index 6d149720118a..c70bfcee7c97 100644 --- a/src/Uno.UI.Runtime.Skia.MacOS/UnoNativeMac/UnoNativeMac/UNOWindow.m +++ b/src/Uno.UI.Runtime.Skia.MacOS/UnoNativeMac/UnoNativeMac/UNOWindow.m @@ -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; } } }