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

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

Issue 2343933002: Revert of SkFontData to use smart pointers. (Closed)
Patch Set: Created 4 years, 3 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 | « src/core/SkFontDescriptor.cpp ('k') | src/core/SkStream.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 "SkOnce.h" 10 #include "SkOnce.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 return this->onCreateFromStream(stream, ttcIndex); 132 return this->onCreateFromStream(stream, ttcIndex);
133 } 133 }
134 134
135 SkTypeface* SkFontMgr::createFromStream(SkStreamAsset* stream, const FontParamet ers& params) const { 135 SkTypeface* SkFontMgr::createFromStream(SkStreamAsset* stream, const FontParamet ers& params) const {
136 if (nullptr == stream) { 136 if (nullptr == stream) {
137 return nullptr; 137 return nullptr;
138 } 138 }
139 return this->onCreateFromStream(stream, params); 139 return this->onCreateFromStream(stream, params);
140 } 140 }
141 141
142 SkTypeface* SkFontMgr::createFromFontData(std::unique_ptr<SkFontData> data) cons t { 142 SkTypeface* SkFontMgr::createFromFontData(SkFontData* data) const {
143 if (nullptr == data) { 143 if (nullptr == data) {
144 return nullptr; 144 return nullptr;
145 } 145 }
146 return this->onCreateFromFontData(std::move(data)); 146 return this->onCreateFromFontData(data);
147 } 147 }
148 148
149 // This implementation is temporary until it can be made pure virtual. 149 // This implementation is temporary until it can be made pure virtual.
150 SkTypeface* SkFontMgr::onCreateFromStream(SkStreamAsset* stream, const FontParam eters& p) const { 150 SkTypeface* SkFontMgr::onCreateFromStream(SkStreamAsset* stream, const FontParam eters& p) const {
151 return this->createFromStream(stream, p.getCollectionIndex()); 151 return this->createFromStream(stream, p.getCollectionIndex());
152 } 152 }
153 153
154 // This implementation is temporary until it can be made pure virtual. 154 // This implementation is temporary until it can be made pure virtual.
155 SkTypeface* SkFontMgr::onCreateFromFontData(std::unique_ptr<SkFontData> data) co nst { 155 SkTypeface* SkFontMgr::onCreateFromFontData(SkFontData* data) const {
156 return this->createFromStream(data->detachStream().release(), data->getIndex ()); 156 SkTypeface* ret = this->createFromStream(data->detachStream(), data->getInde x());
157 delete data;
158 return ret;
157 } 159 }
158 160
159 SkTypeface* SkFontMgr::createFromFile(const char path[], int ttcIndex) const { 161 SkTypeface* SkFontMgr::createFromFile(const char path[], int ttcIndex) const {
160 if (nullptr == path) { 162 if (nullptr == path) {
161 return nullptr; 163 return nullptr;
162 } 164 }
163 return this->onCreateFromFile(path, ttcIndex); 165 return this->onCreateFromFile(path, ttcIndex);
164 } 166 }
165 167
166 SkTypeface* SkFontMgr::legacyCreateTypeface(const char familyName[], SkFontStyle style) const { 168 SkTypeface* SkFontMgr::legacyCreateTypeface(const char familyName[], SkFontStyle style) const {
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 } 288 }
287 } 289 }
288 290
289 if (maxScore < currentScore) { 291 if (maxScore < currentScore) {
290 maxScore = currentScore; 292 maxScore = currentScore;
291 } 293 }
292 } 294 }
293 295
294 return this->createTypeface(maxScore.index); 296 return this->createTypeface(maxScore.index);
295 } 297 }
OLDNEW
« no previous file with comments | « src/core/SkFontDescriptor.cpp ('k') | src/core/SkStream.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698