Skip to content
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
2 changes: 1 addition & 1 deletion Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Sources/OpenRenderBox/Path/ORBPathCallbacks.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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<ORBPath.Callbacks> {
_orbCGPathCallbacks
}
}

Expand Down
7 changes: 6 additions & 1 deletion Sources/OpenRenderBoxCxx/Path/ORBPathCallbacks.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ typedef RBPathApplyShapeCallback ORBPathApplyShapeCallback;
#define ORBPathContainsPoints RBPathContainsPoints

#define ORBPathCGPathCallbacks RBPathCGPathCallbacks
#define _ORBPathCallbacksGetCGPath _RBPathCallbacksGetCGPath

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Use the required ORB_ prefix for the new preprocessor macro

The new _ORBPathCallbacksGetCGPath macro violates the root AGENTS.md requirement that C/C++ preprocessor definitions use the ORB_ prefix. Rename the macro to use that prefix and update the corresponding helper name consistently.

AGENTS.md reference: AGENTS.md:L5-L5

Useful? React with 👍 / 👎.

#define ORBPathStorageInit RBPathStorageInit
#define ORBPathStorageDestroy RBPathStorageDestroy
#define ORBPathStorageClear RBPathStorageClear
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading