summaryrefslogtreecommitdiff
path: root/platform/darwin/src/image.mm
diff options
context:
space:
mode:
Diffstat (limited to 'platform/darwin/src/image.mm')
-rw-r--r--platform/darwin/src/image.mm21
1 files changed, 1 insertions, 20 deletions
diff --git a/platform/darwin/src/image.mm b/platform/darwin/src/image.mm
index 57b680fbdb..7065545763 100644
--- a/platform/darwin/src/image.mm
+++ b/platform/darwin/src/image.mm
@@ -2,26 +2,7 @@
#import <ImageIO/ImageIO.h>
-namespace {
-
-template <typename T, typename S, void (*Releaser)(S)>
-struct CFHandle {
- CFHandle(T t_): t(t_) {}
- ~CFHandle() { Releaser(t); }
- T operator*() { return t; }
- operator bool() { return t; }
-private:
- T t;
-};
-
-} // namespace
-
-using CGImageHandle = CFHandle<CGImageRef, CGImageRef, CGImageRelease>;
-using CFDataHandle = CFHandle<CFDataRef, CFTypeRef, CFRelease>;
-using CGImageSourceHandle = CFHandle<CGImageSourceRef, CFTypeRef, CFRelease>;
-using CGDataProviderHandle = CFHandle<CGDataProviderRef, CGDataProviderRef, CGDataProviderRelease>;
-using CGColorSpaceHandle = CFHandle<CGColorSpaceRef, CGColorSpaceRef, CGColorSpaceRelease>;
-using CGContextHandle = CFHandle<CGContextRef, CGContextRef, CGContextRelease>;
+#import "CFHandle.hpp"
CGImageRef CGImageFromMGLPremultipliedImage(mbgl::PremultipliedImage&& src) {
// We're converting the PremultipliedImage's backing store to a CGDataProvider, and are taking