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

Side by Side Diff: src/ports/SkFontHost_win.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/pathops/SkPathOpsOp.cpp ('k') | src/ports/SkFontMgr_android.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 "SkTypes.h" 8 #include "SkTypes.h"
9 #if defined(SK_BUILD_FOR_WIN32) 9 #if defined(SK_BUILD_FOR_WIN32)
10 10
(...skipping 2440 matching lines...) Expand 10 before | Expand all | Expand 10 after
2451 return this->matchFamilyStyle(familyName.c_str(), fontstyle); 2451 return this->matchFamilyStyle(familyName.c_str(), fontstyle);
2452 } 2452 }
2453 2453
2454 SkTypeface* onCreateFromStream(SkStreamAsset* bareStream, int ttcIndex) cons t override { 2454 SkTypeface* onCreateFromStream(SkStreamAsset* bareStream, int ttcIndex) cons t override {
2455 SkAutoTDelete<SkStreamAsset> stream(bareStream); 2455 SkAutoTDelete<SkStreamAsset> stream(bareStream);
2456 return create_from_stream(stream); 2456 return create_from_stream(stream);
2457 } 2457 }
2458 2458
2459 SkTypeface* onCreateFromData(SkData* data, int ttcIndex) const override { 2459 SkTypeface* onCreateFromData(SkData* data, int ttcIndex) const override {
2460 // could be in base impl 2460 // could be in base impl
2461 return this->createFromStream(new SkMemoryStream(data)); 2461 return this->createFromStream(new SkMemoryStream(sk_ref_sp(data)));
2462 } 2462 }
2463 2463
2464 SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const override { 2464 SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const override {
2465 // could be in base impl 2465 // could be in base impl
2466 return this->createFromStream(SkStream::NewFromFile(path)); 2466 return this->createFromStream(SkStream::NewFromFile(path));
2467 } 2467 }
2468 2468
2469 SkTypeface* onLegacyCreateTypeface(const char familyName[], SkFontStyle styl e) const override { 2469 SkTypeface* onLegacyCreateTypeface(const char familyName[], SkFontStyle styl e) const override {
2470 LOGFONT lf; 2470 LOGFONT lf;
2471 if (nullptr == familyName) { 2471 if (nullptr == familyName) {
2472 lf = get_default_font(); 2472 lf = get_default_font();
2473 } else { 2473 } else {
2474 logfont_for_name(familyName, &lf); 2474 logfont_for_name(familyName, &lf);
2475 } 2475 }
2476 2476
2477 lf.lfWeight = style.weight(); 2477 lf.lfWeight = style.weight();
2478 lf.lfItalic = style.slant() == SkFontStyle::kUpright_Slant ? FALSE : TRU E; 2478 lf.lfItalic = style.slant() == SkFontStyle::kUpright_Slant ? FALSE : TRU E;
2479 return SkCreateTypefaceFromLOGFONT(lf); 2479 return SkCreateTypefaceFromLOGFONT(lf);
2480 } 2480 }
2481 2481
2482 private: 2482 private:
2483 SkTDArray<ENUMLOGFONTEX> fLogFontArray; 2483 SkTDArray<ENUMLOGFONTEX> fLogFontArray;
2484 }; 2484 };
2485 2485
2486 /////////////////////////////////////////////////////////////////////////////// 2486 ///////////////////////////////////////////////////////////////////////////////
2487 2487
2488 SkFontMgr* SkFontMgr_New_GDI() { return new SkFontMgrGDI; } 2488 SkFontMgr* SkFontMgr_New_GDI() { return new SkFontMgrGDI; }
2489 2489
2490 #endif//defined(SK_BUILD_FOR_WIN32) 2490 #endif//defined(SK_BUILD_FOR_WIN32)
OLDNEW
« no previous file with comments | « src/pathops/SkPathOpsOp.cpp ('k') | src/ports/SkFontMgr_android.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698