Repository navigation
feat(path): refine nullability and add portable applier, interpolation, and serialization #41
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
8cf24e7
fix(path): mark ORBPathStorageAppendElement points as nullable
Kyle-Ye 9a5636f
fix(path): mark ORBPathCopyData return type as nullable
Kyle-Ye 70e909e
fix(path): mark ORBPathMakeWithData data parameter as nullable
Kyle-Ye e2f854f
feat(path): add portable CGPath element applier, interpolation, and d…
Kyle-Ye 8116467
chore: update dependencies
Kyle-Ye File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| // | ||
| // ORBPathCFData.swift | ||
| // OpenRenderBox | ||
|
|
||
| #if !OPENRENDERBOX_CF_CGTYPES | ||
| public import CoreFoundation | ||
|
|
||
| extension ORBPath { | ||
| public var data: CFData? { | ||
| let bytes = _encodeWireBytes() | ||
| return bytes.withUnsafeBufferPointer { buffer in | ||
| CFDataCreate(nil, buffer.baseAddress, buffer.count) | ||
| } | ||
| } | ||
|
|
||
| public init(data: CFData?) { | ||
| guard let data else { | ||
| self = .null | ||
| return | ||
| } | ||
| let length = CFDataGetLength(data) | ||
| if length <= 0 { | ||
| self.init(_wireBytes: []) | ||
| } else if let ptr = CFDataGetBytePtr(data) { | ||
| self.init(_wireBytes: Array(UnsafeBufferPointer(start: ptr, count: length))) | ||
| } else { | ||
| let bytes = [UInt8](unsafeUninitializedCapacity: length) { buffer, initializedCount in | ||
| CFDataGetBytes(data, CFRange(location: 0, length: length), buffer.baseAddress) | ||
| initializedCount = length | ||
| } | ||
| self.init(_wireBytes: bytes) | ||
| } | ||
| } | ||
| } | ||
| #endif |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
When a transform has
a == b == d == 0butc != 0, this branch discards the nonzero second column and decomposes the matrix as an all-zero linear transform. For example, interpolating(a: 0, b: 0, c: 1, d: 0)toward identity produces an almost-zero matrix at fraction0.000001, rather than approaching the source matrix. This makes paths jump discontinuously at the start or end of animations involving a rotated zero-scale transform. Preserve the surviving column, or use a fallback interpolation that handles singular matrices.Useful? React with 👍 / 👎.