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: gm/dcshader.cpp

Issue 849103004: Make SkStream *not* ref counted. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase, just in case. 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 | « gm/coloremoji.cpp ('k') | gm/dftext.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 /* 2 /*
3 * Copyright 2014 Google Inc. 3 * Copyright 2014 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "gm.h" 9 #include "gm.h"
10 #if SK_SUPPORT_GPU 10 #if SK_SUPPORT_GPU
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 sk_tool_utils::set_portable_typeface(paint); 209 sk_tool_utils::set_portable_typeface(paint);
210 } 210 }
211 211
212 virtual const char* text() const { return "Hello, Skia!"; } 212 virtual const char* text() const { return "Hello, Skia!"; }
213 }; 213 };
214 214
215 struct BmpText : public Text { 215 struct BmpText : public Text {
216 void setFont(SkPaint* paint) SK_OVERRIDE { 216 void setFont(SkPaint* paint) SK_OVERRIDE {
217 if (!fTypeface) { 217 if (!fTypeface) {
218 SkString filename = GetResourcePath("/Funkster.ttf"); 218 SkString filename = GetResourcePath("/Funkster.ttf");
219 SkAutoTUnref<SkFILEStream> stream(new SkFILEStream(filename. c_str())); 219 SkAutoTDelete<SkFILEStream> stream(new SkFILEStream(filename .c_str()));
220 if (!stream->isValid()) { 220 if (!stream->isValid()) {
221 SkDebugf("Could not find Funkster.ttf, please set --reso urcePath " 221 SkDebugf("Could not find Funkster.ttf, please set --reso urcePath "
222 "correctly.\n"); 222 "correctly.\n");
223 return; 223 return;
224 } 224 }
225 fTypeface.reset(SkTypeface::CreateFromStream(stream)); 225 fTypeface.reset(SkTypeface::CreateFromStream(stream.detach() ));
226 } 226 }
227 paint->setTypeface(fTypeface); 227 paint->setTypeface(fTypeface);
228 } 228 }
229 229
230 const char* text() const SK_OVERRIDE { return "Hi, Skia!"; } 230 const char* text() const SK_OVERRIDE { return "Hi, Skia!"; }
231 231
232 SkAutoTUnref<SkTypeface> fTypeface; 232 SkAutoTUnref<SkTypeface> fTypeface;
233 }; 233 };
234 fPrims.push_back(SkNEW(Rect)); 234 fPrims.push_back(SkNEW(Rect));
235 fPrims.push_back(SkNEW(Circle)); 235 fPrims.push_back(SkNEW(Circle));
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 }; 301 };
302 302
303 SkTArray<Prim*> fPrims; 303 SkTArray<Prim*> fPrims;
304 304
305 typedef GM INHERITED; 305 typedef GM INHERITED;
306 }; 306 };
307 307
308 DEF_GM( return SkNEW(DCShaderGM); ) 308 DEF_GM( return SkNEW(DCShaderGM); )
309 } 309 }
310 #endif 310 #endif
OLDNEW
« no previous file with comments | « gm/coloremoji.cpp ('k') | gm/dftext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698