Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(171)

Side by Side Diff: src/core/SkFontMgr.cpp

Issue 1882803002: Remove SK_VERY_LEGACY_CREATE_TYPEFACE. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/ports/SkFontMgr_indirect.h ('k') | src/core/SkTypeface.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 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 "SkFontDescriptor.h" 8 #include "SkFontDescriptor.h"
9 #include "SkFontMgr.h" 9 #include "SkFontMgr.h"
10 #include "SkOncePtr.h" 10 #include "SkOncePtr.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 SkTypeface* onCreateFromData(SkData*, int) const override { 67 SkTypeface* onCreateFromData(SkData*, int) const override {
68 return nullptr; 68 return nullptr;
69 } 69 }
70 SkTypeface* onCreateFromStream(SkStreamAsset* stream, int) const override { 70 SkTypeface* onCreateFromStream(SkStreamAsset* stream, int) const override {
71 delete stream; 71 delete stream;
72 return nullptr; 72 return nullptr;
73 } 73 }
74 SkTypeface* onCreateFromFile(const char[], int) const override { 74 SkTypeface* onCreateFromFile(const char[], int) const override {
75 return nullptr; 75 return nullptr;
76 } 76 }
77 #ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
78 SkTypeface* onLegacyCreateTypeface(const char [], unsigned) const override {
79 #else
80 SkTypeface* onLegacyCreateTypeface(const char [], SkFontStyle) const overrid e { 77 SkTypeface* onLegacyCreateTypeface(const char [], SkFontStyle) const overrid e {
81 #endif
82 return nullptr; 78 return nullptr;
83 } 79 }
84 }; 80 };
85 81
86 static SkFontStyleSet* emptyOnNull(SkFontStyleSet* fsset) { 82 static SkFontStyleSet* emptyOnNull(SkFontStyleSet* fsset) {
87 if (nullptr == fsset) { 83 if (nullptr == fsset) {
88 fsset = SkFontStyleSet::CreateEmpty(); 84 fsset = SkFontStyleSet::CreateEmpty();
89 } 85 }
90 return fsset; 86 return fsset;
91 } 87 }
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 return ret; 158 return ret;
163 } 159 }
164 160
165 SkTypeface* SkFontMgr::createFromFile(const char path[], int ttcIndex) const { 161 SkTypeface* SkFontMgr::createFromFile(const char path[], int ttcIndex) const {
166 if (nullptr == path) { 162 if (nullptr == path) {
167 return nullptr; 163 return nullptr;
168 } 164 }
169 return this->onCreateFromFile(path, ttcIndex); 165 return this->onCreateFromFile(path, ttcIndex);
170 } 166 }
171 167
172 #ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
173 SkTypeface* SkFontMgr::legacyCreateTypeface(const char familyName[], unsigned st yle) const {
174 #else
175 SkTypeface* SkFontMgr::legacyCreateTypeface(const char familyName[], SkFontStyle style) const { 168 SkTypeface* SkFontMgr::legacyCreateTypeface(const char familyName[], SkFontStyle style) const {
176 #endif
177 return this->onLegacyCreateTypeface(familyName, style); 169 return this->onLegacyCreateTypeface(familyName, style);
178 } 170 }
179 171
180 SK_DECLARE_STATIC_ONCE_PTR(SkFontMgr, singleton); 172 SK_DECLARE_STATIC_ONCE_PTR(SkFontMgr, singleton);
181 SkFontMgr* SkFontMgr::RefDefault() { 173 SkFontMgr* SkFontMgr::RefDefault() {
182 return SkRef(singleton.get([]{ 174 return SkRef(singleton.get([]{
183 SkFontMgr* fm = SkFontMgr::Factory(); 175 SkFontMgr* fm = SkFontMgr::Factory();
184 return fm ? fm : new SkEmptyFontMgr; 176 return fm ? fm : new SkEmptyFontMgr;
185 })); 177 }));
186 } 178 }
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 } 270 }
279 } 271 }
280 272
281 if (currentScore.score > maxScore.score) { 273 if (currentScore.score > maxScore.score) {
282 maxScore = currentScore; 274 maxScore = currentScore;
283 } 275 }
284 } 276 }
285 277
286 return this->createTypeface(maxScore.index); 278 return this->createTypeface(maxScore.index);
287 } 279 }
OLDNEW
« no previous file with comments | « include/ports/SkFontMgr_indirect.h ('k') | src/core/SkTypeface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698