summaryrefslogtreecommitdiff
path: root/platform/darwin/src/local_glyph_rasterizer.mm
diff options
context:
space:
mode:
Diffstat (limited to 'platform/darwin/src/local_glyph_rasterizer.mm')
-rw-r--r--platform/darwin/src/local_glyph_rasterizer.mm28
1 files changed, 5 insertions, 23 deletions
diff --git a/platform/darwin/src/local_glyph_rasterizer.mm b/platform/darwin/src/local_glyph_rasterizer.mm
index fa5d1a9302..944fca48c3 100644
--- a/platform/darwin/src/local_glyph_rasterizer.mm
+++ b/platform/darwin/src/local_glyph_rasterizer.mm
@@ -5,32 +5,10 @@
#import <CoreText/CoreText.h>
#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
-
+#import "CFHandle.hpp"
namespace mbgl {
-using CGContextHandle = CFHandle<CGContextRef, CGContextRef, CGContextRelease>;
-using CGColorSpaceHandle = CFHandle<CGColorSpaceRef, CGColorSpaceRef, CGColorSpaceRelease>;
-using CTFontDescriptorRefHandle = CFHandle<CTFontDescriptorRef, CFTypeRef, CFRelease>;
-using CTFontRefHandle = CFHandle<CTFontRef, CFTypeRef, CFRelease>;
-using CFStringRefHandle = CFHandle<CFStringRef, CFTypeRef, CFRelease>;
-using CFAttributedStringRefHandle = CFHandle<CFAttributedStringRef, CFTypeRef, CFRelease>;
-using CTLineRefHandle = CFHandle<CTLineRef, CFTypeRef, CFRelease>;
-using CFDictionaryRefHandle = CFHandle<CFDictionaryRef, CFTypeRef, CFRelease>;
-
/*
Initial implementation of darwin TinySDF support:
Draw any CJK glyphs using a default system font
@@ -43,6 +21,10 @@ using CFDictionaryRefHandle = CFHandle<CFDictionaryRef, CFTypeRef, CFRelease>;
- Extract glyph metrics so that this can be used with more than just fixed width glyphs
*/
+using CTFontDescriptorRefHandle = CFHandle<CTFontDescriptorRef, CFTypeRef, CFRelease>;
+using CTFontRefHandle = CFHandle<CTFontRef, CFTypeRef, CFRelease>;
+using CTLineRefHandle = CFHandle<CTLineRef, CFTypeRef, CFRelease>;
+
class LocalGlyphRasterizer::Impl {
public:
Impl(CTFontRef fontHandle)