From 207e560f8d9cae2e46255a4efd11956cb1973943 Mon Sep 17 00:00:00 2001 From: Jeremy Powell Date: Mon, 17 Jun 2024 10:09:12 +1200 Subject: [PATCH] Fix SKPaint.Clone Clone should operate on SkCompatPaint --- binding/SkiaSharp/SKPaint.cs | 2 +- tests/Tests/SkiaSharp/SKPaintTest.cs | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/binding/SkiaSharp/SKPaint.cs b/binding/SkiaSharp/SKPaint.cs index 1e8d1be424..58039258b7 100644 --- a/binding/SkiaSharp/SKPaint.cs +++ b/binding/SkiaSharp/SKPaint.cs @@ -277,7 +277,7 @@ public float GetFontMetrics (out SKFontMetrics metrics) => // Clone public SKPaint Clone () => - GetObject (SkiaApi.sk_paint_clone (Handle))!; + GetObject (SkiaApi.sk_compatpaint_clone (Handle))!; // MeasureText diff --git a/tests/Tests/SkiaSharp/SKPaintTest.cs b/tests/Tests/SkiaSharp/SKPaintTest.cs index 48b7540fb1..acf0a25a5e 100644 --- a/tests/Tests/SkiaSharp/SKPaintTest.cs +++ b/tests/Tests/SkiaSharp/SKPaintTest.cs @@ -720,5 +720,13 @@ public void CanSetTypefacesWithoutCrashing(string fontfile) Assert.Same(typeface, paint.Typeface); } + + [SkippableFact] + public void Clone() + { + using var paint = new SKPaint(); + using var clonedPaint = paint.Clone(); + using var clonedPaint2 = paint.Clone(); + } } }