Skip to content

Commit 1222399

Browse files
authored
Optimize SKRoundRectCache Clear Method for .NET 6+ (#17605)
This changes optimizes the `Clear` method in `SKRoundRectCache`. For .NET 6 and higher versions, a faster clearing technique is utilized, enhancing performance.
1 parent f977d22 commit 1222399

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Skia/Avalonia.Skia/SKRoundRectCache.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,13 @@ public void ReturnReset(SKRoundRect rect)
9191
base.Clear();
9292

9393
// Clear out the cache of SKPoint arrays.
94+
#if NET6_0_OR_GREATER
95+
_radiiCache.Clear();
96+
#else
9497
while (_radiiCache.TryTake(out var item))
9598
{
9699
}
100+
#endif
97101
}
98102
}
99103
}

0 commit comments

Comments
 (0)