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

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

Issue 1873923002: Begin switch to SkFontStyle for legacy calls. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Dont update bzl file now. 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/SkFontStyle.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
77 SkTypeface* onLegacyCreateTypeface(const char [], unsigned) const override { 78 SkTypeface* onLegacyCreateTypeface(const char [], unsigned) const override {
79 #else
80 SkTypeface* onLegacyCreateTypeface(const char [], SkFontStyle) const overrid e {
81 #endif
78 return nullptr; 82 return nullptr;
79 } 83 }
80 }; 84 };
81 85
82 static SkFontStyleSet* emptyOnNull(SkFontStyleSet* fsset) { 86 static SkFontStyleSet* emptyOnNull(SkFontStyleSet* fsset) {
83 if (nullptr == fsset) { 87 if (nullptr == fsset) {
84 fsset = SkFontStyleSet::CreateEmpty(); 88 fsset = SkFontStyleSet::CreateEmpty();
85 } 89 }
86 return fsset; 90 return fsset;
87 } 91 }
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 return ret; 162 return ret;
159 } 163 }
160 164
161 SkTypeface* SkFontMgr::createFromFile(const char path[], int ttcIndex) const { 165 SkTypeface* SkFontMgr::createFromFile(const char path[], int ttcIndex) const {
162 if (nullptr == path) { 166 if (nullptr == path) {
163 return nullptr; 167 return nullptr;
164 } 168 }
165 return this->onCreateFromFile(path, ttcIndex); 169 return this->onCreateFromFile(path, ttcIndex);
166 } 170 }
167 171
168 SkTypeface* SkFontMgr::legacyCreateTypeface(const char familyName[], 172 #ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
169 unsigned styleBits) const { 173 SkTypeface* SkFontMgr::legacyCreateTypeface(const char familyName[], unsigned st yle) const {
170 return this->onLegacyCreateTypeface(familyName, styleBits); 174 #else
175 SkTypeface* SkFontMgr::legacyCreateTypeface(const char familyName[], SkFontStyle style) const {
176 #endif
177 return this->onLegacyCreateTypeface(familyName, style);
171 } 178 }
172 179
173 SK_DECLARE_STATIC_ONCE_PTR(SkFontMgr, singleton); 180 SK_DECLARE_STATIC_ONCE_PTR(SkFontMgr, singleton);
174 SkFontMgr* SkFontMgr::RefDefault() { 181 SkFontMgr* SkFontMgr::RefDefault() {
175 return SkRef(singleton.get([]{ 182 return SkRef(singleton.get([]{
176 SkFontMgr* fm = SkFontMgr::Factory(); 183 SkFontMgr* fm = SkFontMgr::Factory();
177 return fm ? fm : new SkEmptyFontMgr; 184 return fm ? fm : new SkEmptyFontMgr;
178 })); 185 }));
179 } 186 }
180 187
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 } 278 }
272 } 279 }
273 280
274 if (currentScore.score > maxScore.score) { 281 if (currentScore.score > maxScore.score) {
275 maxScore = currentScore; 282 maxScore = currentScore;
276 } 283 }
277 } 284 }
278 285
279 return this->createTypeface(maxScore.index); 286 return this->createTypeface(maxScore.index);
280 } 287 }
OLDNEW
« no previous file with comments | « include/ports/SkFontMgr_indirect.h ('k') | src/core/SkFontStyle.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698