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

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

Issue 849103004: Make SkStream *not* ref counted. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Delete streams in onCreateFromStream failures. Created 5 years, 11 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.h ('k') | src/core/SkPaint.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 "SkFontMgr.h" 8 #include "SkFontMgr.h"
9 #include "SkLazyPtr.h" 9 #include "SkLazyPtr.h"
10 #include "SkStream.h"
10 #include "SkTypes.h" 11 #include "SkTypes.h"
11 12
12 class SkFontStyle; 13 class SkFontStyle;
13 class SkStream; 14 class SkStream;
bungeman-skia 2015/01/20 22:23:54 Since we need to include now, should remove this f
scroggo 2015/01/20 22:25:15 Done.
14 class SkTypeface; 15 class SkTypeface;
15 16
16 class SkEmptyFontStyleSet : public SkFontStyleSet { 17 class SkEmptyFontStyleSet : public SkFontStyleSet {
17 public: 18 public:
18 int count() SK_OVERRIDE { return 0; } 19 int count() SK_OVERRIDE { return 0; }
19 void getStyle(int, SkFontStyle*, SkString*) SK_OVERRIDE { 20 void getStyle(int, SkFontStyle*, SkString*) SK_OVERRIDE {
20 SkDEBUGFAIL("SkFontStyleSet::getStyle called on empty set"); 21 SkDEBUGFAIL("SkFontStyleSet::getStyle called on empty set");
21 } 22 }
22 SkTypeface* createTypeface(int index) SK_OVERRIDE { 23 SkTypeface* createTypeface(int index) SK_OVERRIDE {
23 SkDEBUGFAIL("SkFontStyleSet::createTypeface called on empty set"); 24 SkDEBUGFAIL("SkFontStyleSet::createTypeface called on empty set");
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 SkUnichar character) const S K_OVERRIDE { 62 SkUnichar character) const S K_OVERRIDE {
62 return NULL; 63 return NULL;
63 } 64 }
64 virtual SkTypeface* onMatchFaceStyle(const SkTypeface*, 65 virtual SkTypeface* onMatchFaceStyle(const SkTypeface*,
65 const SkFontStyle&) const SK_OVERRIDE { 66 const SkFontStyle&) const SK_OVERRIDE {
66 return NULL; 67 return NULL;
67 } 68 }
68 SkTypeface* onCreateFromData(SkData*, int) const SK_OVERRIDE { 69 SkTypeface* onCreateFromData(SkData*, int) const SK_OVERRIDE {
69 return NULL; 70 return NULL;
70 } 71 }
71 SkTypeface* onCreateFromStream(SkStream*, int) const SK_OVERRIDE { 72 SkTypeface* onCreateFromStream(SkStream* stream, int) const SK_OVERRIDE {
73 SkDELETE(stream);
72 return NULL; 74 return NULL;
73 } 75 }
74 SkTypeface* onCreateFromFile(const char[], int) const SK_OVERRIDE { 76 SkTypeface* onCreateFromFile(const char[], int) const SK_OVERRIDE {
75 return NULL; 77 return NULL;
76 } 78 }
77 SkTypeface* onLegacyCreateTypeface(const char [], unsigned) const SK_OVERRID E { 79 SkTypeface* onLegacyCreateTypeface(const char [], unsigned) const SK_OVERRID E {
78 return NULL; 80 return NULL;
79 } 81 }
80 }; 82 };
81 83
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 SkFontMgr* sk_fontmgr_create_default() { 150 SkFontMgr* sk_fontmgr_create_default() {
149 SkFontMgr* fm = SkFontMgr::Factory(); 151 SkFontMgr* fm = SkFontMgr::Factory();
150 return fm ? fm : SkNEW(SkEmptyFontMgr); 152 return fm ? fm : SkNEW(SkEmptyFontMgr);
151 } 153 }
152 154
153 SK_DECLARE_STATIC_LAZY_PTR(SkFontMgr, singleton, sk_fontmgr_create_default); 155 SK_DECLARE_STATIC_LAZY_PTR(SkFontMgr, singleton, sk_fontmgr_create_default);
154 156
155 SkFontMgr* SkFontMgr::RefDefault() { 157 SkFontMgr* SkFontMgr::RefDefault() {
156 return SkRef(singleton.get()); 158 return SkRef(singleton.get());
157 } 159 }
OLDNEW
« no previous file with comments | « src/core/SkFontDescriptor.h ('k') | src/core/SkPaint.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698