diff --git a/Package.resolved b/Package.resolved index 28fd5fa..a5b0fae 100644 --- a/Package.resolved +++ b/Package.resolved @@ -7,7 +7,7 @@ "location" : "https://github.com/OpenSwiftUIProject/DarwinPrivateFrameworks.git", "state" : { "branch" : "main", - "revision" : "7b1da8b32736a879afd3964a13085c076eaa1221" + "revision" : "211a9a3d6c2021dd3e8953892131abe06b26bb6f" } }, { diff --git a/Sources/OpenRenderBox/Path/ORBPathCallbacks.swift b/Sources/OpenRenderBox/Path/ORBPathCallbacks.swift index aa3c7ea..6a77eab 100644 --- a/Sources/OpenRenderBox/Path/ORBPathCallbacks.swift +++ b/Sources/OpenRenderBox/Path/ORBPathCallbacks.swift @@ -95,8 +95,8 @@ extension ORBPath { extension ORBPath.Callbacks { /// Global callbacks for CGPath-backed paths - public static var cgPath: ORBPath.Callbacks { - _orbCGPathCallbacks.pointee + public static var cgPath: UnsafePointer { + _orbCGPathCallbacks } } diff --git a/Sources/OpenRenderBoxCxx/Path/ORBPathCallbacks.h b/Sources/OpenRenderBoxCxx/Path/ORBPathCallbacks.h index 39c5d8a..0dbf174 100644 --- a/Sources/OpenRenderBoxCxx/Path/ORBPathCallbacks.h +++ b/Sources/OpenRenderBoxCxx/Path/ORBPathCallbacks.h @@ -103,7 +103,12 @@ static_assert(offsetof(struct ORBPathCallbacksExtended, next) == 0x50); #if ORB_TARGET_OS_DARWIN /// Global callbacks for CGPath-backed paths ORB_EXPORT -const ORBPathCallbacks ORBPathCGPathCallbacks ORB_SWIFT_NAME(ORBPathCallbacks.cgPath); +const ORBPathCallbacks ORBPathCGPathCallbacks ORB_REFINED_FOR_SWIFT; + +static ORB_INLINE const ORBPathCallbacks *_ORBPathCallbacksGetCGPath(void) + ORB_SWIFT_NAME(getter:ORBPathCallbacks.cgPath()) { + return &ORBPathCGPathCallbacks; +} #endif ORB_EXTERN_C_END diff --git a/Sources/OpenRenderBoxShimsCxx/include/RenderBox/OpenRenderBoxShims/OpenRenderBoxShims.h b/Sources/OpenRenderBoxShimsCxx/include/RenderBox/OpenRenderBoxShims/OpenRenderBoxShims.h index 8152b08..6d1c714 100644 --- a/Sources/OpenRenderBoxShimsCxx/include/RenderBox/OpenRenderBoxShims/OpenRenderBoxShims.h +++ b/Sources/OpenRenderBoxShimsCxx/include/RenderBox/OpenRenderBoxShims/OpenRenderBoxShims.h @@ -141,6 +141,7 @@ typedef RBPathApplyShapeCallback ORBPathApplyShapeCallback; #define ORBPathContainsPoints RBPathContainsPoints #define ORBPathCGPathCallbacks RBPathCGPathCallbacks +#define _ORBPathCallbacksGetCGPath _RBPathCallbacksGetCGPath #define ORBPathStorageInit RBPathStorageInit #define ORBPathStorageDestroy RBPathStorageDestroy #define ORBPathStorageClear RBPathStorageClear diff --git a/Tests/OpenRenderBoxCompatibilityTests/PathCallbacksTests.swift b/Tests/OpenRenderBoxCompatibilityTests/PathCallbacksTests.swift index 4a4ff19..674b369 100644 --- a/Tests/OpenRenderBoxCompatibilityTests/PathCallbacksTests.swift +++ b/Tests/OpenRenderBoxCompatibilityTests/PathCallbacksTests.swift @@ -21,7 +21,11 @@ struct PathCallbacksTests { @Test func cgPathCallbacks() { - let callbacks = ORBPath.Callbacks.cgPath + let rectPath = ORBPath(cgPath: CGPath(rect: CGRect(x: 0, y: 0, width: 10, height: 10), transform: nil)) + defer { rectPath.release() } + #expect(rectPath.callbacks == ORBPath.Callbacks.cgPath) + + let callbacks = ORBPath.Callbacks.cgPath.pointee #expect(callbacks.flags.isExtended == false) #expect(callbacks.retain != nil) #expect(callbacks.release != nil)