OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkDataTable.h" | 8 #include "SkDataTable.h" |
9 #include "SkFixed.h" | 9 #include "SkFixed.h" |
10 #include "SkFontDescriptor.h" | 10 #include "SkFontDescriptor.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 106 |
107 template<typename T, void (*D)(T*)> void FcTDestroy(T* t) { | 107 template<typename T, void (*D)(T*)> void FcTDestroy(T* t) { |
108 FCLocker::AssertHeld(); | 108 FCLocker::AssertHeld(); |
109 D(t); | 109 D(t); |
110 } | 110 } |
111 template <typename T, T* (*C)(), void (*D)(T*)> class SkAutoFc | 111 template <typename T, T* (*C)(), void (*D)(T*)> class SkAutoFc |
112 : public SkAutoTCallVProc<T, FcTDestroy<T, D> > { | 112 : public SkAutoTCallVProc<T, FcTDestroy<T, D> > { |
113 public: | 113 public: |
114 SkAutoFc() : SkAutoTCallVProc<T, FcTDestroy<T, D> >(C()) { | 114 SkAutoFc() : SkAutoTCallVProc<T, FcTDestroy<T, D> >(C()) { |
115 T* obj = this->operator T*(); | 115 T* obj = this->operator T*(); |
116 SkASSERT_RELEASE(nullptr != obj); | 116 SK_ALWAYSBREAK(nullptr != obj); |
117 } | 117 } |
118 explicit SkAutoFc(T* obj) : SkAutoTCallVProc<T, FcTDestroy<T, D> >(obj) {} | 118 explicit SkAutoFc(T* obj) : SkAutoTCallVProc<T, FcTDestroy<T, D> >(obj) {} |
119 }; | 119 }; |
120 | 120 |
121 typedef SkAutoFc<FcCharSet, FcCharSetCreate, FcCharSetDestroy> SkAutoFcCharSet; | 121 typedef SkAutoFc<FcCharSet, FcCharSetCreate, FcCharSetDestroy> SkAutoFcCharSet; |
122 typedef SkAutoFc<FcConfig, FcConfigCreate, FcConfigDestroy> SkAutoFcConfig; | 122 typedef SkAutoFc<FcConfig, FcConfigCreate, FcConfigDestroy> SkAutoFcConfig; |
123 typedef SkAutoFc<FcFontSet, FcFontSetCreate, FcFontSetDestroy> SkAutoFcFontSet; | 123 typedef SkAutoFc<FcFontSet, FcFontSetCreate, FcFontSetDestroy> SkAutoFcFontSet; |
124 typedef SkAutoFc<FcLangSet, FcLangSetCreate, FcLangSetDestroy> SkAutoFcLangSet; | 124 typedef SkAutoFc<FcLangSet, FcLangSetCreate, FcLangSetDestroy> SkAutoFcLangSet; |
125 typedef SkAutoFc<FcObjectSet, FcObjectSetCreate, FcObjectSetDestroy> SkAutoFcObj
ectSet; | 125 typedef SkAutoFc<FcObjectSet, FcObjectSetCreate, FcObjectSetDestroy> SkAutoFcObj
ectSet; |
126 typedef SkAutoFc<FcPattern, FcPatternCreate, FcPatternDestroy> SkAutoFcPattern; | 126 typedef SkAutoFc<FcPattern, FcPatternCreate, FcPatternDestroy> SkAutoFcPattern; |
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
873 return typeface.detach(); | 873 return typeface.detach(); |
874 } | 874 } |
875 | 875 |
876 return this->matchFamilyStyle(nullptr, style); | 876 return this->matchFamilyStyle(nullptr, style); |
877 } | 877 } |
878 }; | 878 }; |
879 | 879 |
880 SK_API SkFontMgr* SkFontMgr_New_FontConfig(FcConfig* fc) { | 880 SK_API SkFontMgr* SkFontMgr_New_FontConfig(FcConfig* fc) { |
881 return new SkFontMgr_fontconfig(fc); | 881 return new SkFontMgr_fontconfig(fc); |
882 } | 882 } |
OLD | NEW |