-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a CG render context to the iOS runtime
Diffs= 42f393436 Add a CG render context to the iOS runtime (#5998) Co-authored-by: Chris Dalton <[email protected]>
- Loading branch information
1 parent
b1cba70
commit a795c2f
Showing
8 changed files
with
211 additions
and
37 deletions.
There are no files selected for viewing
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 +1 @@ | ||
2c2ea44922f91b784ec16549ce1cda0346438fd0 | ||
42f39343647f68371989628c3c24da8f2ba31171 |
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 +1 @@ | ||
4bc1e5c1d5af8327b4d5afc8f53afd6d0a7a7d45 | ||
01aa67c9996f1fa96ac8091040dfc91d432192e9 |
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
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
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
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,39 @@ | ||
/* | ||
* Copyright 2023 Rive | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <TargetConditionals.h> | ||
|
||
#if TARGET_OS_IPHONE | ||
#include <CoreGraphics/CoreGraphics.h> | ||
#include <ImageIO/ImageIO.h> | ||
#elif TARGET_OS_MAC | ||
#include <ApplicationServices/ApplicationServices.h> | ||
#endif | ||
|
||
// Helper that remembers to call CFRelease when an object goes out of scope. | ||
template <typename T> class AutoCF | ||
{ | ||
public: | ||
AutoCF() = default; | ||
AutoCF(T obj) : m_Obj(obj) {} | ||
AutoCF(const AutoCF&) = delete; | ||
AutoCF& operator=(const AutoCF&) = delete; | ||
~AutoCF() { adopt(nullptr); } | ||
|
||
void adopt(T obj) | ||
{ | ||
if (m_Obj) | ||
CFRelease(m_Obj); | ||
m_Obj = obj; | ||
} | ||
|
||
operator T() const { return m_Obj; } | ||
operator bool() const { return m_Obj != nullptr; } | ||
T get() const { return m_Obj; } | ||
|
||
private: | ||
T m_Obj = nullptr; | ||
}; |
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
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