OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "SkTypes.h" | 8 #include "SkTypes.h" |
9 | 9 |
10 #include "SkData.h" | 10 #include "SkData.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 , fLang(lang) | 68 , fLang(lang) |
69 , fVariantStyle(variantStyle) | 69 , fVariantStyle(variantStyle) |
70 , fFile(cacheFontFiles ? sk_fopen(fPathName.c_str(), kRead_SkFILE_Flag)
: nullptr) { | 70 , fFile(cacheFontFiles ? sk_fopen(fPathName.c_str(), kRead_SkFILE_Flag)
: nullptr) { |
71 if (cacheFontFiles) { | 71 if (cacheFontFiles) { |
72 SkASSERT(fFile); | 72 SkASSERT(fFile); |
73 } | 73 } |
74 } | 74 } |
75 | 75 |
76 SkStreamAsset* createStream() const { | 76 SkStreamAsset* createStream() const { |
77 if (fFile) { | 77 if (fFile) { |
78 SkData* data = SkData::NewFromFILE(fFile); | 78 sk_sp<SkData> data(SkData::MakeFromFILE(fFile)); |
79 return data ? new SkMemoryStream(data) : nullptr; | 79 return data ? new SkMemoryStream(std::move(data)) : nullptr; |
80 } | 80 } |
81 return SkStream::NewFromFile(fPathName.c_str()); | 81 return SkStream::NewFromFile(fPathName.c_str()); |
82 } | 82 } |
83 | 83 |
84 virtual void onGetFontDescriptor(SkFontDescriptor* desc, bool* serialize) co
nst override { | 84 virtual void onGetFontDescriptor(SkFontDescriptor* desc, bool* serialize) co
nst override { |
85 SkASSERT(desc); | 85 SkASSERT(desc); |
86 SkASSERT(serialize); | 86 SkASSERT(serialize); |
87 desc->setFamilyName(fFamilyName.c_str()); | 87 desc->setFamilyName(fFamilyName.c_str()); |
88 desc->setStyle(this->fontStyle()); | 88 desc->setStyle(this->fontStyle()); |
89 *serialize = false; | 89 *serialize = false; |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 SkASSERT(custom->fSystemFontUse < SK_ARRAY_COUNT(gSystemFontUseStrings))
; | 579 SkASSERT(custom->fSystemFontUse < SK_ARRAY_COUNT(gSystemFontUseStrings))
; |
580 SkDEBUGF(("SystemFontUse: %s BasePath: %s Fonts: %s FallbackFonts: %s\n"
, | 580 SkDEBUGF(("SystemFontUse: %s BasePath: %s Fonts: %s FallbackFonts: %s\n"
, |
581 gSystemFontUseStrings[custom->fSystemFontUse], | 581 gSystemFontUseStrings[custom->fSystemFontUse], |
582 custom->fBasePath, | 582 custom->fBasePath, |
583 custom->fFontsXml, | 583 custom->fFontsXml, |
584 custom->fFallbackFontsXml)); | 584 custom->fFallbackFontsXml)); |
585 } | 585 } |
586 | 586 |
587 return new SkFontMgr_Android(custom); | 587 return new SkFontMgr_Android(custom); |
588 } | 588 } |
OLD | NEW |