Skip to content

Commit ea07df0

Browse files
committed
Fix Linux build: guard Darwin-only CGPath code
1 parent b698b77 commit ea07df0

File tree

2 files changed

+21
-17
lines changed

2 files changed

+21
-17
lines changed

Sources/OpenRenderBox/Path/ORBPath.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,6 @@ static const ORBPathCallbacks empty_path_callbacks = {
2525
nullptr,
2626
};
2727

28-
namespace {
29-
ORBPath make_rect(CGRect rect, const CGAffineTransform *transform, ORBPathElement element) {
30-
if (CGRectIsNull(rect)) {
31-
return ORBPathNull;
32-
}
33-
if (transform == nullptr || CGAffineTransformIsIdentity(*transform)) {
34-
// TODO
35-
return ORBPathNull;
36-
} else {
37-
// TODO
38-
return ORBPathNull;
39-
}
40-
}
41-
} /* anonymous namespace */
42-
4328
// Empty path (storage = null)
4429
const ORBPath ORBPathEmpty = {
4530
nullptr,
@@ -70,6 +55,21 @@ void ORBPathRelease(ORBPath path) {
7055

7156
// MARK: - Path Creation
7257

58+
namespace {
59+
ORBPath make_rect(CGRect rect, const CGAffineTransform *transform, ORBPathElement element) {
60+
if (CGRectIsNull(rect)) {
61+
return ORBPathNull;
62+
}
63+
if (transform == nullptr || CGAffineTransformIsIdentity(*transform)) {
64+
// TODO
65+
return ORBPathNull;
66+
} else {
67+
// TODO
68+
return ORBPathNull;
69+
}
70+
}
71+
} /* anonymous namespace */
72+
7373
// TODO: TO be implemented natively
7474

7575
ORBPath ORBPathMakeWithCGPath(CGPathRef cgPath) {
@@ -157,6 +157,8 @@ bool ORBPathContainsPoints(ORBPath path, uint64_t count, const CGPoint *points,
157157
return false;
158158
}
159159

160+
#endif /* ORB_TARGET_OS_DARWIN */
161+
160162
bool ORBPathApplyElements(ORBPath path, void *info, ORBPathApplyCallback callback) {
161163
auto apply = path.callbacks->apply;
162164
bool flag = false; // TODO: calllbacks's flag to indicate whether it supports extra features
@@ -172,5 +174,3 @@ bool ORBPathApplyElements(ORBPath path, void *info, ORBPathApplyCallback callbac
172174
return apply(path.storage, info, callback);
173175
}
174176
}
175-
176-
#endif /* ORB_TARGET_OS_DARWIN */

Sources/OpenRenderBox/Path/PathStorage.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,13 @@ Storage::~Storage() {
6767
}
6868
// TODO: MapCache
6969
if (flags().isExternal()) {
70+
#if ORB_TARGET_OS_DARWIN
7071
if (cachedCGPath() != nullptr) {
7172
auto oldCache = cachedCGPath();
7273
_cached_cgPath = nullptr;
7374
CFRelease(oldCache);
7475
}
76+
#endif
7577
free((void *)external_storage());
7678
}
7779
}
@@ -107,6 +109,7 @@ bool Storage::apply_elements_(void *info, ORBPathApplyCallback callback) const O
107109
return true;
108110
}
109111

112+
#if ORB_TARGET_OS_DARWIN
110113
CGPathRef Storage::cgpath() const ORB_NOEXCEPT {
111114
if (flags().isInline()) {
112115
return nullptr;
@@ -145,6 +148,7 @@ CGPathRef Storage::cgpath() const ORB_NOEXCEPT {
145148
return expected;
146149
}
147150
}
151+
#endif
148152

149153
} /* Path */
150154
} /* ORB */

0 commit comments

Comments
 (0)