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

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

Issue 2339273002: SkFontData to use smart pointers. (Closed)
Patch Set: Add trivial bodies to the trivial implementations. 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(SkFontData* data) const { 142 SkTypeface* SkFontMgr::createFromFontData(std::unique_ptr<SkFontData> data) cons t {
143 if (nullptr == data) { 143 if (nullptr == data) {
144 return nullptr; 144 return nullptr;
145 } 145 }
146 return this->onCreateFromFontData(data); 146 return this->onCreateFromFontData(std::move(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(SkFontData* data) const { 155 SkTypeface* SkFontMgr::onCreateFromFontData(std::unique_ptr<SkFontData> data) co nst {
156 SkTypeface* ret = this->createFromStream(data->detachStream(), data->getInde x()); 156 return this->createFromStream(data->detachStream().release(), data->getIndex ());
157 delete data;
158 return ret;
159 } 157 }
160 158
161 SkTypeface* SkFontMgr::createFromFile(const char path[], int ttcIndex) const { 159 SkTypeface* SkFontMgr::createFromFile(const char path[], int ttcIndex) const {
162 if (nullptr == path) { 160 if (nullptr == path) {
163 return nullptr; 161 return nullptr;
164 } 162 }
165 return this->onCreateFromFile(path, ttcIndex); 163 return this->onCreateFromFile(path, ttcIndex);
166 } 164 }
167 165
168 SkTypeface* SkFontMgr::legacyCreateTypeface(const char familyName[], SkFontStyle style) const { 166 SkTypeface* SkFontMgr::legacyCreateTypeface(const char familyName[], SkFontStyle style) const {
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 } 286 }
289 } 287 }
290 288
291 if (maxScore < currentScore) { 289 if (maxScore < currentScore) {
292 maxScore = currentScore; 290 maxScore = currentScore;
293 } 291 }
294 } 292 }
295 293
296 return this->createTypeface(maxScore.index); 294 return this->createTypeface(maxScore.index);
297 } 295 }
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