Bug 39706 - SKShapeNode.FromPoints(ref CGPoint, nuint) should be a CGPoint[]
Summary: SKShapeNode.FromPoints(ref CGPoint, nuint) should be a CGPoint[]
Status: RESOLVED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: XI 9.8 (tvOS / C7)
Hardware: PC Mac OS
: High enhancement
Target Milestone: Untriaged
Assignee: Alex Soto [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2016-03-17 02:30 UTC by Larry O'Brien
Modified: 2016-03-18 20:42 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Larry O'Brien 2016-03-17 02:30:17 UTC
It should probably be a constructor that takes an array of points but at the very least, it should take an array of points.

As it is today, it's essentially a C-style pointer-based function:

var pts = new [] {
	new CGPoint(0, 0),
	new CGPoint(320, 568)
};

var line0 = SKShapeNode.FromPoints(ref pts[0], 2);

>> <SKShapeNode> name:'(null)' accumulatedFrame:{{-1.176, -0.66299999}, {322.35199, 569.32501}}

var line1 = SKShapeNode.FromPoints(ref pts[0], 5);
>> <SKShapeNode> name:'(null)' accumulatedFrame:{{0, -1.35}, {inf, 570.70001}}
Comment 1 Rolf Bjarne Kvinge [MSFT] 2016-03-17 11:07:02 UTC
Same for SKShapeNode.FromSplinePoints.
Comment 2 Sebastien Pouliot 2016-03-17 13:02:47 UTC
Ouch, that's really not cute :(

We should use the array and remove the, potentially dangerous, `numPoints` argument (using the array's length).

and it's still time to hide this bad API from tvOS (XAMCORE_3_0)...

@Alex can you fix this properly (and add test on master) ? we'll decide if we backport and/or hide on cycle7 shortly.
Comment 3 Alex Soto [MSFT] 2016-03-18 20:42:59 UTC
Fixed in maccore/master @ 5b2753b4fd6505528fe7fc4c16da1f6cdab144c2