Open kekekeks opened 4 years ago
I'd like this as well, especially for path iterators. This seems really expensive when it's applied to every path verb:
public unsafe SKPathVerb Next(Span<SKPoint> points)
{
if (points == (Span<SKPoint>) (SKPoint[]) null)
throw new ArgumentNullException(nameof (points));
if (points.Length != 4)
throw new ArgumentException("Must be an array of four elements.", nameof (points));
fixed (SKPoint* points1 = &points.GetPinnableReference())
return SkiaApi.sk_path_rawiter_next(this.Handle, points1);
}
SkObject initialization and housekeeping is quite costly in both CPU and allocations. On hot code paths it's desirable to just deal with raw
IntPtr
's and Skia C API and manage those manually.Performance benefits far outweigh the loss of object-oriented API and backwards compatibility with previous SkiaSharp versions.
Since
SkObject
already exposesHandle
property the only change that is needed is to makeSkiaApi
class to be public rather than internal.