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 "SkFontMgr.h" | 9 #include "SkFontMgr.h" |
10 #include "SkFontMgr_indirect.h" | 10 #include "SkFontMgr_indirect.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 SkAutoTUnref<const SkFontMgr_Indirect> fOwner; | 58 SkAutoTUnref<const SkFontMgr_Indirect> fOwner; |
59 int fFamilyIndex; | 59 int fFamilyIndex; |
60 SkAutoTUnref<SkRemotableFontIdentitySet> fData; | 60 SkAutoTUnref<SkRemotableFontIdentitySet> fData; |
61 }; | 61 }; |
62 | 62 |
63 void SkFontMgr_Indirect::set_up_family_names(const SkFontMgr_Indirect* self) { | 63 void SkFontMgr_Indirect::set_up_family_names(const SkFontMgr_Indirect* self) { |
64 self->fFamilyNames.reset(self->fProxy->getFamilyNames()); | 64 self->fFamilyNames.reset(self->fProxy->getFamilyNames()); |
65 } | 65 } |
66 | 66 |
67 int SkFontMgr_Indirect::onCountFamilies() const { | 67 int SkFontMgr_Indirect::onCountFamilies() const { |
68 SkOnce(&fFamilyNamesInited, &fFamilyNamesMutex, SkFontMgr_Indirect::set_up_f
amily_names, this); | 68 fFamilyNamesInitOnce(SkFontMgr_Indirect::set_up_family_names, this); |
69 return fFamilyNames->count(); | 69 return fFamilyNames->count(); |
70 } | 70 } |
71 | 71 |
72 void SkFontMgr_Indirect::onGetFamilyName(int index, SkString* familyName) const
{ | 72 void SkFontMgr_Indirect::onGetFamilyName(int index, SkString* familyName) const
{ |
73 SkOnce(&fFamilyNamesInited, &fFamilyNamesMutex, SkFontMgr_Indirect::set_up_f
amily_names, this); | 73 fFamilyNamesInitOnce(SkFontMgr_Indirect::set_up_family_names, this); |
74 if (index >= fFamilyNames->count()) { | 74 if (index >= fFamilyNames->count()) { |
75 familyName->reset(); | 75 familyName->reset(); |
76 return; | 76 return; |
77 } | 77 } |
78 familyName->set(fFamilyNames->atStr(index)); | 78 familyName->set(fFamilyNames->atStr(index)); |
79 } | 79 } |
80 | 80 |
81 SkFontStyleSet* SkFontMgr_Indirect::onCreateStyleSet(int index) const { | 81 SkFontStyleSet* SkFontMgr_Indirect::onCreateStyleSet(int index) const { |
82 SkRemotableFontIdentitySet* set = fProxy->getIndex(index); | 82 SkRemotableFontIdentitySet* set = fProxy->getIndex(index); |
83 if (nullptr == set) { | 83 if (nullptr == set) { |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 face.reset(this->matchFamilyStyle(nullptr, style)); | 192 face.reset(this->matchFamilyStyle(nullptr, style)); |
193 } | 193 } |
194 | 194 |
195 if (nullptr == face.get()) { | 195 if (nullptr == face.get()) { |
196 SkFontIdentity fontId = this->fProxy->matchIndexStyle(0, style); | 196 SkFontIdentity fontId = this->fProxy->matchIndexStyle(0, style); |
197 face.reset(this->createTypefaceFromFontId(fontId)); | 197 face.reset(this->createTypefaceFromFontId(fontId)); |
198 } | 198 } |
199 | 199 |
200 return face.release(); | 200 return face.release(); |
201 } | 201 } |
OLD | NEW |