-
Notifications
You must be signed in to change notification settings - Fork 515
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
[ImageIO] Update to Xcode 9 #2353
Changes from 1 commit
51964a4
3b95a18
2bacb0c
257d779
4cc16ec
e8ab921
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -502,8 +502,9 @@ public bool CopyImageSource (CGImageSource image, CGImageDestinationOptions opti | |
|
||
public void AddAuxiliaryDataInfo (CGImageDestination dest, CGImageAuxiliaryDataType auxiliaryImageDataType, CGImageAuxiliaryDataInfo auxiliaryDataInfo) | ||
{ | ||
var dict = auxiliaryDataInfo == null ? null : auxiliaryDataInfo.ToDictionary (); | ||
CGImageDestinationAddAuxiliaryDataInfo (dest.Handle, auxiliaryImageDataType.GetConstant ().Handle, dict == null ? IntPtr.Zero : dict.Handle); | ||
using (var dict = auxiliaryDataInfo?.ToDictionary ()) { | ||
CGImageDestinationAddAuxiliaryDataInfo (NativeObjectHelper.GetHandle (dest), auxiliaryImageDataType.GetConstant ().Handle, dict == null ? IntPtr.Zero : dict.Handle); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
it's shorter and also cover the case where a constant might be |
||
} | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -383,35 +383,36 @@ public CGImageSourceStatus GetStatus (int index) | |
|
||
public CGImageAuxiliaryDataInfo CopyAuxiliaryDataInfo (CGImageSource imageSource, nuint index, CGImageAuxiliaryDataType auxiliaryImageDataType) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same (copy availability attributes) |
||
{ | ||
var ptr = CGImageSourceCopyAuxiliaryDataInfoAtIndex (imageSource.Handle, index, auxiliaryImageDataType.GetConstant ().Handle); | ||
var ptr = CGImageSourceCopyAuxiliaryDataInfoAtIndex (imageSource?.Handle ?? IntPtr.Zero, index, auxiliaryImageDataType.GetConstant ().Handle); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
if (ptr == IntPtr.Zero) | ||
return null; | ||
|
||
var dictionary = new NSDictionary (ptr); | ||
|
||
var info = new CGImageAuxiliaryDataInfo (); | ||
|
||
bool success; | ||
using (var dictionary = Runtime.GetNSObject<NSDictionary> (ptr)) { | ||
bool success; | ||
|
||
NSData data; | ||
success = dictionary.TryGetValue <NSData> (CGImageAuxiliaryDataInfo.Data, out data); | ||
NSData data; | ||
success = dictionary.TryGetValue<NSData> (CGImageAuxiliaryDataInfo.Data, out data); | ||
|
||
if (success) | ||
info.DepthData = data; | ||
if (success) | ||
info.DepthData = data; | ||
|
||
NSDictionary dict; | ||
success = dictionary.TryGetValue<NSDictionary> (CGImageAuxiliaryDataInfo.DataDescription, out dict); | ||
NSDictionary dict; | ||
success = dictionary.TryGetValue<NSDictionary> (CGImageAuxiliaryDataInfo.DataDescription, out dict); | ||
|
||
if (success) | ||
info.DepthDataDescription = dict; | ||
if (success) | ||
info.DepthDataDescription = dict; | ||
|
||
CGImageMetadata metadata; | ||
success = dictionary.TryGetValue<CGImageMetadata> (CGImageAuxiliaryDataInfo.kMetadata, out metadata); | ||
CGImageMetadata metadata; | ||
success = dictionary.TryGetValue<CGImageMetadata> (CGImageAuxiliaryDataInfo.kMetadata, out metadata); | ||
|
||
if (success) | ||
info.Metadata = metadata; | ||
if (success) | ||
info.Metadata = metadata; | ||
} | ||
|
||
return info; | ||
|
||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, missed that earlier. Copy
[Watch (4, 0), TV (11, 0), Mac (10, 13), iOS (11, 0)]
to the public method, otherwise the developer won't know if it's available.