-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
534 additions
and
61 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
Sources/COpenSwiftUI/Overlay/CoreGraphics/__CGPathParseString.m
This file contains 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,12 @@ | ||
// | ||
// __CGPathParseString.m | ||
// COpenSwiftUI | ||
|
||
#include "__CGPathParseString.h" | ||
|
||
#if OPENSWIFTUI_TARGET_OS_DARWIN | ||
BOOL __CGPathParseString(CGMutablePathRef path, const char *utf8CString) { | ||
// TODO | ||
return NO; | ||
} | ||
#endif |
This file contains 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 |
---|---|---|
@@ -1,8 +1,6 @@ | ||
// | ||
// dyld_Private.c | ||
// | ||
// | ||
// | ||
// COpenSwiftUI | ||
|
||
#include "dyld_Private.h" | ||
|
||
|
This file contains 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,24 @@ | ||
// | ||
// __CGPathParseString.m | ||
// COpenSwiftUI | ||
|
||
#ifndef __CGPathParseString_h | ||
#define __CGPathParseString_h | ||
|
||
#include "OpenSwiftUIBase.h" | ||
|
||
#if OPENSWIFTUI_TARGET_OS_DARWIN | ||
|
||
#include <Foundation/Foundation.h> | ||
#include <CoreGraphics/CoreGraphics.h> | ||
|
||
OPENSWIFTUI_ASSUME_NONNULL_BEGIN | ||
|
||
OPENSWIFTUI_EXPORT | ||
BOOL __CGPathParseString(CGMutablePathRef path, const char *utf8CString); | ||
|
||
OPENSWIFTUI_ASSUME_NONNULL_END | ||
|
||
#endif | ||
|
||
#endif /* __CGPathParseString_h */ |
This file contains 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,19 @@ | ||
// | ||
// UnsafeAtomicLazy.swift | ||
// OpenSwiftUI | ||
// | ||
// Audited for RELEASE_2021 | ||
// Status: WIP | ||
|
||
struct UnsafeAtomicLazy<Data>: Destroyable { | ||
@UnsafeLockedPointer | ||
var cache: Data? | ||
|
||
func read(_ block: () -> Data) -> Data { | ||
fatalError("TODO") // StrokedPath.boundingRect | ||
} | ||
|
||
func destroy() { | ||
_cache.destroy() | ||
} | ||
} |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
31 changes: 31 additions & 0 deletions
31
Sources/OpenSwiftUI/View/Shape/Path/FixedRoundedRect.swift
This file contains 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,31 @@ | ||
// FixedRoundedRect.swift | ||
// OpenSwiftUI | ||
// | ||
// Audited for RELEASE_2021 | ||
// Status: WIP | ||
|
||
import Foundation | ||
|
||
@usableFromInline | ||
struct FixedRoundedRect: Equatable { | ||
var rect: CGRect | ||
var cornerSize: CGSize | ||
var style: RoundedCornerStyle | ||
|
||
func contains(_ roundedRect: FixedRoundedRect) -> Bool { | ||
guard rect.insetBy(dx: -0.001, dy: -0.001).contains(roundedRect.rect) else { | ||
return false | ||
} | ||
guard !(cornerSize.width <= roundedRect.cornerSize.width && cornerSize.height <= roundedRect.cornerSize.height) else { | ||
return true | ||
} | ||
let minCornerWidth = min(abs(rect.size.width) / 2, cornerSize.width) | ||
let minCornerHeight = min(abs(rect.size.height) / 2, cornerSize.height) | ||
let factor = 0.292893 // 1 - cos(45 * Double.pi / 180) | ||
return rect.insetBy(dx: minCornerWidth * factor, dy: minCornerHeight * factor).contains(roundedRect.rect) | ||
} | ||
|
||
func distance(to point: CGPoint) -> CGFloat { | ||
fatalError("TODO") | ||
} | ||
} |
Oops, something went wrong.