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

[CoreAnimation] Make P/Invokes have blittable signatures. #19997

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/CoreAnimation/CAFrameRateRange.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,13 @@ public struct CAFrameRateRange {
public float Preferred;

[DllImport (Constants.QuartzLibrary, EntryPoint = "CAFrameRateRangeIsEqualToRange")]
[return: MarshalAs (UnmanagedType.I1)]
static extern bool IsEqualTo (CAFrameRateRange range, CAFrameRateRange other);
static extern byte IsEqualTo (CAFrameRateRange range, CAFrameRateRange other);

[DllImport (Constants.QuartzLibrary, EntryPoint = "CAFrameRateRangeMake")]
public static extern CAFrameRateRange Create (float minimum, float maximum, float preferred);

public bool IsEqualTo (CAFrameRateRange other)
=> IsEqualTo (this, other);
=> IsEqualTo (this, other) != 0;

#if !COREBUILD
[Field ("CAFrameRateRangeDefault", "CoreAnimation")]
Expand Down
17 changes: 7 additions & 10 deletions src/CoreAnimation/CATransform3D.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,29 +97,27 @@ static CATransform3D ()
}

[DllImport (Constants.QuartzLibrary)]
[return: MarshalAs (UnmanagedType.I1)]
extern static bool CATransform3DIsIdentity (CATransform3D t);
extern static byte CATransform3DIsIdentity (CATransform3D t);

public bool IsIdentity {
get {
return CATransform3DIsIdentity (this);
return CATransform3DIsIdentity (this) != 0;
}
}

[DllImport (Constants.QuartzLibrary)]
[return: MarshalAs (UnmanagedType.I1)]
extern static bool CATransform3DEqualToTransform (CATransform3D a, CATransform3D b);
extern static byte CATransform3DEqualToTransform (CATransform3D a, CATransform3D b);

public bool Equals (CATransform3D other)
{
return CATransform3DEqualToTransform (this, other);
return CATransform3DEqualToTransform (this, other) != 0;
}

public override bool Equals (object? other)
{
if (!(other is CATransform3D))
return false;
return CATransform3DEqualToTransform (this, (CATransform3D) other);
return CATransform3DEqualToTransform (this, (CATransform3D) other) != 0;
}

public override int GetHashCode ()
Expand Down Expand Up @@ -242,12 +240,11 @@ public CATransform3D Invert ()


[DllImport (Constants.QuartzLibrary)]
[return: MarshalAs (UnmanagedType.I1)]
extern static bool CATransform3DIsAffine (CATransform3D t);
extern static byte CATransform3DIsAffine (CATransform3D t);

public bool IsAffine {
get {
return CATransform3DIsAffine (this);
return CATransform3DIsAffine (this) != 0;
}
}

Expand Down
4 changes: 0 additions & 4 deletions tests/cecil-tests/BlittablePInvokes.KnownFailures.cs
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,6 @@ public partial class BlittablePInvokes {
"System.Boolean CFNetwork.CFHTTPMessage::CFHTTPMessageApplyCredentials(System.IntPtr,System.IntPtr,System.IntPtr,System.IntPtr,CFNetwork.CFHTTPMessage/CFStreamError&)",
"System.Boolean CFNetwork.CFHTTPMessage::CFHTTPMessageIsHeaderComplete(System.IntPtr)",
"System.Boolean CFNetwork.CFHTTPMessage::CFHTTPMessageIsRequest(System.IntPtr)",
"System.Boolean CoreAnimation.CAFrameRateRange::IsEqualTo(CoreAnimation.CAFrameRateRange,CoreAnimation.CAFrameRateRange)",
"System.Boolean CoreAnimation.CATransform3D::CATransform3DEqualToTransform(CoreAnimation.CATransform3D,CoreAnimation.CATransform3D)",
"System.Boolean CoreAnimation.CATransform3D::CATransform3DIsAffine(CoreAnimation.CATransform3D)",
"System.Boolean CoreAnimation.CATransform3D::CATransform3DIsIdentity(CoreAnimation.CATransform3D)",
"System.Boolean CoreFoundation.CFBoolean::CFBooleanGetValue(System.IntPtr)",
"System.Boolean CoreFoundation.CFBundle::CFBundleIsArchitectureLoadable(CoreFoundation.CFBundle/Architecture)",
"System.Boolean CoreFoundation.CFBundle::CFBundleIsExecutableLoadable(System.IntPtr)",
Expand Down
Loading