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

Side by Side Diff: src/ports/SkFontMgr_fontconfig.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_custom.cpp ('k') | src/ports/SkFontMgr_win_dw.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 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 "SkDataTable.h" 8 #include "SkDataTable.h"
9 #include "SkFixed.h" 9 #include "SkFixed.h"
10 #include "SkFontDescriptor.h" 10 #include "SkFontDescriptor.h"
(...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 const FontParameters::Axis* paramAxes = params.getAxes(&paramAxisCount); 896 const FontParameters::Axis* paramAxes = params.getAxes(&paramAxisCount);
897 SkAutoSTMalloc<4, SkFixed> axisValues(axisDefinitions.count()); 897 SkAutoSTMalloc<4, SkFixed> axisValues(axisDefinitions.count());
898 Scanner::computeAxisValues(axisDefinitions, paramAxes, paramAxisCount, a xisValues, name); 898 Scanner::computeAxisValues(axisDefinitions, paramAxes, paramAxisCount, a xisValues, name);
899 899
900 SkFontData* data(new SkFontData(stream.release(), params.getCollectionIn dex(), 900 SkFontData* data(new SkFontData(stream.release(), params.getCollectionIn dex(),
901 axisValues.get(), axisDefinitions.count( ))); 901 axisValues.get(), axisDefinitions.count( )));
902 return new SkTypeface_stream(data, style, isFixedPitch); 902 return new SkTypeface_stream(data, style, isFixedPitch);
903 } 903 }
904 904
905 SkTypeface* onCreateFromData(SkData* data, int ttcIndex) const override { 905 SkTypeface* onCreateFromData(SkData* data, int ttcIndex) const override {
906 return this->createFromStream(new SkMemoryStream(data), ttcIndex); 906 return this->createFromStream(new SkMemoryStream(sk_ref_sp(data)), ttcIn dex);
907 } 907 }
908 908
909 SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const override { 909 SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const override {
910 return this->createFromStream(SkStream::NewFromFile(path), ttcIndex); 910 return this->createFromStream(SkStream::NewFromFile(path), ttcIndex);
911 } 911 }
912 912
913 SkTypeface* onCreateFromFontData(SkFontData* fontData) const override { 913 SkTypeface* onCreateFromFontData(SkFontData* fontData) const override {
914 SkStreamAsset* stream(fontData->getStream()); 914 SkStreamAsset* stream(fontData->getStream());
915 const size_t length = stream->getLength(); 915 const size_t length = stream->getLength();
916 if (length <= 0 || (1u << 30) < length) { 916 if (length <= 0 || (1u << 30) < length) {
(...skipping 16 matching lines...) Expand all
933 return typeface.release(); 933 return typeface.release();
934 } 934 }
935 935
936 return this->matchFamilyStyle(nullptr, style); 936 return this->matchFamilyStyle(nullptr, style);
937 } 937 }
938 }; 938 };
939 939
940 SK_API SkFontMgr* SkFontMgr_New_FontConfig(FcConfig* fc) { 940 SK_API SkFontMgr* SkFontMgr_New_FontConfig(FcConfig* fc) {
941 return new SkFontMgr_fontconfig(fc); 941 return new SkFontMgr_fontconfig(fc);
942 } 942 }
OLDNEW
« no previous file with comments | « src/ports/SkFontMgr_custom.cpp ('k') | src/ports/SkFontMgr_win_dw.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698