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

Add SKMatrix.MapPoints/MapVectors, SKPath.AddPoly overloads with Span<SKPoint> #3030

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

alexandrvslv
Copy link
Contributor

Description of Change

When you nead maps several points without heap allocation and with only one pInvoke

cost of pInvoke

p1 = matrix.MapPoint(p1);
p2 = matrix.MapPoint(p2);
p3 = matrix.MapPoint(p3);

cost of allocation

var points = new [] { p1,  p2,  p3 };
matrix.MapPoints(points, points);

decision

Span<SKPoint> points = stackalloc [] { p1,  p2,  p3 };
matrix.MapPoints(points, points);

Miss SKPath.AddPoly tests

API Changes

Added:

  • void SKMatrix.MapPoints(Span<SKPoint> result, ReadOnlySpan<SKPoint> points)
  • void SKMatrix.MapVectors(Span<SKPoint> result, ReadOnlySpan<SKPoint> points)
  • void SKPath.AddPoly (ReadOnlySpan<SKPoint> points, bool close = true)

Behavioral Changes

None.

Required skia PR

None.

PR Checklist

  • Has tests (if omitted, state reason in description)
  • Rebased on top of main at time of PR
  • Merged related skia PRs
  • Changes adhere to coding standard
  • Updated documentation

…<SKPoint>

When you nead maps several points without heap allocation and with only one pInvoke

*Add SKMatrix  tests
Copy link
Contributor

Hey there @alexandrvslv! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@alexandrvslv
Copy link
Contributor Author

@dotnet-policy-service agree

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

Successfully merging this pull request may close these issues.

1 participant