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 #ifndef SkFontMgr_indirect_DEFINED | 8 #ifndef SkFontMgr_indirect_DEFINED |
9 #define SkFontMgr_indirect_DEFINED | 9 #define SkFontMgr_indirect_DEFINED |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 class SkData; | 21 class SkData; |
22 class SkFontStyle; | 22 class SkFontStyle; |
23 class SkStreamAsset; | 23 class SkStreamAsset; |
24 class SkString; | 24 class SkString; |
25 | 25 |
26 class SK_API SkFontMgr_Indirect : public SkFontMgr { | 26 class SK_API SkFontMgr_Indirect : public SkFontMgr { |
27 public: | 27 public: |
28 // TODO: The SkFontMgr is only used for createFromStream/File/Data. | 28 // TODO: The SkFontMgr is only used for createFromStream/File/Data. |
29 // In the future these calls should be broken out into their own interface | 29 // In the future these calls should be broken out into their own interface |
30 // with a name like SkFontRenderer. | 30 // with a name like SkFontRenderer. |
31 SkFontMgr_Indirect(SkFontMgr* impl, SkRemotableFontMgr* proxy) | 31 SkFontMgr_Indirect(sk_sp<SkFontMgr> impl, sk_sp<SkRemotableFontMgr> proxy) |
32 : fImpl(SkRef(impl)), fProxy(SkRef(proxy)) | 32 : fImpl(std::move(impl)), fProxy(std::move(proxy)) |
33 { } | 33 { } |
34 | 34 |
35 protected: | 35 protected: |
36 int onCountFamilies() const override; | 36 int onCountFamilies() const override; |
37 void onGetFamilyName(int index, SkString* familyName) const override; | 37 void onGetFamilyName(int index, SkString* familyName) const override; |
38 SkFontStyleSet* onCreateStyleSet(int index) const override; | 38 SkFontStyleSet* onCreateStyleSet(int index) const override; |
39 | 39 |
40 SkFontStyleSet* onMatchFamily(const char familyName[]) const override; | 40 SkFontStyleSet* onMatchFamily(const char familyName[]) const override; |
41 | 41 |
42 SkTypeface* onMatchFamilyStyle(const char familyName[], | 42 SkTypeface* onMatchFamilyStyle(const char familyName[], |
(...skipping 10 matching lines...) Expand all Loading... |
53 | 53 |
54 SkTypeface* onCreateFromStream(SkStreamAsset* stream, int ttcIndex) const ov
erride; | 54 SkTypeface* onCreateFromStream(SkStreamAsset* stream, int ttcIndex) const ov
erride; |
55 SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const override
; | 55 SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const override
; |
56 SkTypeface* onCreateFromData(SkData* data, int ttcIndex) const override; | 56 SkTypeface* onCreateFromData(SkData* data, int ttcIndex) const override; |
57 | 57 |
58 SkTypeface* onLegacyCreateTypeface(const char familyName[], SkFontStyle) con
st override; | 58 SkTypeface* onLegacyCreateTypeface(const char familyName[], SkFontStyle) con
st override; |
59 | 59 |
60 private: | 60 private: |
61 SkTypeface* createTypefaceFromFontId(const SkFontIdentity& fontId) const; | 61 SkTypeface* createTypefaceFromFontId(const SkFontIdentity& fontId) const; |
62 | 62 |
63 SkAutoTUnref<SkFontMgr> fImpl; | 63 sk_sp<SkFontMgr> fImpl; |
64 SkAutoTUnref<SkRemotableFontMgr> fProxy; | 64 sk_sp<SkRemotableFontMgr> fProxy; |
65 | 65 |
66 struct DataEntry { | 66 struct DataEntry { |
67 uint32_t fDataId; // key1 | 67 uint32_t fDataId; // key1 |
68 uint32_t fTtcIndex; // key2 | 68 uint32_t fTtcIndex; // key2 |
69 SkTypeface* fTypeface; // value: weak ref to typeface | 69 SkTypeface* fTypeface; // value: weak ref to typeface |
70 | 70 |
71 DataEntry() { } | 71 DataEntry() { } |
72 | 72 |
73 DataEntry(DataEntry&& that) | 73 DataEntry(DataEntry&& that) |
74 : fDataId(that.fDataId) | 74 : fDataId(that.fDataId) |
(...skipping 21 matching lines...) Expand all Loading... |
96 mutable SkMutex fDataCacheMutex; | 96 mutable SkMutex fDataCacheMutex; |
97 | 97 |
98 mutable sk_sp<SkDataTable> fFamilyNames; | 98 mutable sk_sp<SkDataTable> fFamilyNames; |
99 mutable SkOnce fFamilyNamesInitOnce; | 99 mutable SkOnce fFamilyNamesInitOnce; |
100 static void set_up_family_names(const SkFontMgr_Indirect* self); | 100 static void set_up_family_names(const SkFontMgr_Indirect* self); |
101 | 101 |
102 friend class SkStyleSet_Indirect; | 102 friend class SkStyleSet_Indirect; |
103 }; | 103 }; |
104 | 104 |
105 #endif | 105 #endif |
OLD | NEW |