Repository navigation
[CoreGraphics] Add missing API added in Xcode 10 beta 1. - #4547
Conversation
| extern static bool CGPDFArrayApplyBlock (/* CGPDFArrayRef */ IntPtr array, /* CGPDFArrayApplierBlock */ ref BlockLiteral block, /* void* */ IntPtr info); | ||
|
|
||
| [iOS (12, 0)][Mac (10, 14)][TV (12, 0)][Watch (5, 0)] | ||
| [BindingImpl (BindingImplOptions.Optimizable)] |
There was a problem hiding this comment.
Only semi-unrelated to PR but it seems we could/should ensure/test BindingImplOptions.Optimizable works (when BindingImplOptions.GeneratedCode is not set) inside one of our test suite (MTouch?). Otherwise we risk finding out it's not optimizable at build time (and that coverage will vary depending if the linker keeps, or not, that manually bound method).
There was a problem hiding this comment.
I'm not sure what you're suggesting: I wrote fairly extensive tests when I implemented block optimizations. monotouch-test is also built & executed with all optimizations turned on (in both debug & release mode).
There was a problem hiding this comment.
I'm worried about the non-generated (manual) code, like this one, that the linker can remove (if unused) when running monotouch-test (as @chamons note there's no tests for this API so the linker will remove it). Once removed nothing checks if that manual code is (or not) optimizable right ? (I might be forgetting a different test that covers it)
There was a problem hiding this comment.
I've just added tests for this.
| delegate bool ApplyBlockHandlerDelegate (IntPtr block, nint index, IntPtr value, IntPtr info); | ||
| static readonly ApplyBlockHandlerDelegate applyblock_handler = ApplyBlockHandler; | ||
|
|
||
| [MonoPInvokeCallback (typeof (ApplyBlockHandlerDelegate))] |
There was a problem hiding this comment.
I don't recall if really needed but normally the attribute is under a
#if !MONOMAC
|
|
||
| [iOS (12, 0)][Mac (10, 14)][TV (12, 0)][Watch (5, 0)] | ||
| [BindingImpl (BindingImplOptions.Optimizable)] | ||
| public bool ApplyBlock (ApplyBlockCallback callback, IntPtr info = default (IntPtr)) |
There was a problem hiding this comment.
having an IntPtr makes it harder to pass state to the callback, than an System.Object
There was a problem hiding this comment.
That's a good point, we could wrap an object with a GCHandle.
|
Build success |
…since the CGPDFArray.Count property returns nint.
This makes the following code work:
for (var i = 0; i < array.Count; i++)
array.GetInt (i, ...)
Since the fact that the method is implemented using a block is not relevant for managed code. This also makes the method named like an equivalent method in CGPDFDictionary.
…o parameter instead of IntPtr. This makes it nicer for managed code.
…ctual CGPDFObject type.
…e iterated object to the actual CGPDFObject type. This method was previously only available in Classic, so I just reintroduced it with a few changes to make the API nicer (which isn't a breaking change since we're not building Classic anymore).
|
Build failure Test results3 tests failed, 61 tests passed. Failed tests
|
|
Build success |
No description provided.