Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to Span<T> or ReadOnlySpan<T> #2616

Open
4 of 35 tasks
Tracked by #2615
mattleibow opened this issue Sep 18, 2023 · 0 comments
Open
4 of 35 tasks
Tracked by #2615

Switch to Span<T> or ReadOnlySpan<T> #2616

mattleibow opened this issue Sep 18, 2023 · 0 comments

Comments

@mattleibow
Copy link
Contributor

mattleibow commented Sep 18, 2023

Description

Part of #2615

The SkiaSharp codebase is quite old and existed before the introduction of spans. (See more https://learn.microsoft.com/en-us/dotnet/standard/memory-and-spans/memory-t-usage-guidelines)

Current files in the core binding using arrays:

  • Definitions.cs
  • GRGlInterface.cs
  • GRVkExtensions.cs
  • SKBitmap.cs
  • SKCanvas.cs
  • SKCodec.cs
  • SKColorFilter.cs
  • SKColorSpace.cs
  • SKColorSpaceStructs.cs
  • SKData.cs
  • SKFont.cs
  • SKFontManager.cs
  • SKFrontBufferedManagedStream.cs
  • SKFrontBufferedStream.cs
  • SKImage.cs
  • SKManagedStream.cs
  • SKManagedWStream.cs
  • SKMaskFilter.cs
  • SKMatrix.cs
  • SKMatrix44.cs
  • SKObject.cs
  • SKPMColor.cs
  • SKPaint.cs
  • SKPath.cs
  • SKPathEffect.cs
  • SKRoundRect.cs
    • Start using spans instead of arrays #2617
    • public SKPoint[] Radii { get; } still exists as it is a convenience and this is accessible using non-arrays by querying each corner individually (which is what this property does)
  • SKRuntimeEffect.cs
  • SKShader.cs
  • SKStream.cs
  • SKString.cs
  • SKTextBlob.cs
  • SKTypeface.cs
  • SKVertices.cs
  • SkiaApi.generated.cs
  • Util.cs

NOTE: not all usages are bad. There are cases where returning an array is acceptable because we have span alternatives, or the data is best contained in an array.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant