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

Side by Side Diff: src/ports/SkFontMgr_custom.cpp

Issue 2333713002: change SkStreams to work with sk_sp<SkData> instead of SkData* (Closed)
Patch Set: fix xpsdevice 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/ports/SkFontMgr_android.cpp ('k') | src/ports/SkFontMgr_fontconfig.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 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 "SkFontHost_FreeType_common.h" 9 #include "SkFontHost_FreeType_common.h"
10 #include "SkFontMgr.h" 10 #include "SkFontMgr.h"
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 for (int j = 0; j < fFamilies[i]->fStyles.count(); ++j) { 254 for (int j = 0; j < fFamilies[i]->fStyles.count(); ++j) {
255 if (fFamilies[i]->fStyles[j].get() == familyMember) { 255 if (fFamilies[i]->fStyles[j].get() == familyMember) {
256 return fFamilies[i]->matchStyle(fontStyle); 256 return fFamilies[i]->matchStyle(fontStyle);
257 } 257 }
258 } 258 }
259 } 259 }
260 return nullptr; 260 return nullptr;
261 } 261 }
262 262
263 SkTypeface* onCreateFromData(SkData* data, int ttcIndex) const override { 263 SkTypeface* onCreateFromData(SkData* data, int ttcIndex) const override {
264 return this->createFromStream(new SkMemoryStream(data), ttcIndex); 264 return this->createFromStream(new SkMemoryStream(sk_ref_sp(data)), ttcIn dex);
265 } 265 }
266 266
267 SkTypeface* onCreateFromStream(SkStreamAsset* bareStream, int ttcIndex) cons t override { 267 SkTypeface* onCreateFromStream(SkStreamAsset* bareStream, int ttcIndex) cons t override {
268 return this->createFromStream(bareStream, FontParameters().setCollection Index(ttcIndex)); 268 return this->createFromStream(bareStream, FontParameters().setCollection Index(ttcIndex));
269 } 269 }
270 270
271 SkTypeface* onCreateFromStream(SkStreamAsset* s, const FontParameters& param s) const override { 271 SkTypeface* onCreateFromStream(SkStreamAsset* s, const FontParameters& param s) const override {
272 using Scanner = SkTypeface_FreeType::Scanner; 272 using Scanner = SkTypeface_FreeType::Scanner;
273 SkAutoTDelete<SkStreamAsset> stream(s); 273 SkAutoTDelete<SkStreamAsset> stream(s);
274 bool isFixedPitch; 274 bool isFixedPitch;
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 SkFontStyleSet_Custom* family = new SkFontStyleSet_Custom(SkString()); 511 SkFontStyleSet_Custom* family = new SkFontStyleSet_Custom(SkString());
512 families->push_back().reset(family); 512 families->push_back().reset(family);
513 family->appendTypeface(sk_make_sp<SkTypeface_Empty>()); 513 family->appendTypeface(sk_make_sp<SkTypeface_Empty>());
514 } 514 }
515 515
516 }; 516 };
517 517
518 SK_API SkFontMgr* SkFontMgr_New_Custom_Empty() { 518 SK_API SkFontMgr* SkFontMgr_New_Custom_Empty() {
519 return new SkFontMgr_Custom(EmptyFontLoader()); 519 return new SkFontMgr_Custom(EmptyFontLoader());
520 } 520 }
OLDNEW
« no previous file with comments | « src/ports/SkFontMgr_android.cpp ('k') | src/ports/SkFontMgr_fontconfig.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698