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

Merged
merged 2 commits into from
Oct 28, 2024

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

@mattleibow
Copy link
Contributor

/azp run

Copy link

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

@mattleibow
Copy link
Contributor

/azp run

Copy link

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

@mattleibow mattleibow merged commit 44d6780 into mono:main Oct 28, 2024
2 checks passed
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.

2 participants