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

Side by Side Diff: gm/dcshader.cpp

Issue 1120823002: Move resource fonts to common location. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Remove now unused variable. Created 5 years, 7 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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 virtual void setFont(SkPaint* paint) { 212 virtual void setFont(SkPaint* paint) {
213 sk_tool_utils::set_portable_typeface(paint); 213 sk_tool_utils::set_portable_typeface(paint);
214 } 214 }
215 215
216 virtual const char* text() const { return "Hello, Skia!"; } 216 virtual const char* text() const { return "Hello, Skia!"; }
217 }; 217 };
218 218
219 struct BmpText : public Text { 219 struct BmpText : public Text {
220 void setFont(SkPaint* paint) override { 220 void setFont(SkPaint* paint) override {
221 if (!fTypeface) { 221 if (!fTypeface) {
222 SkString filename = GetResourcePath("/Funkster.ttf"); 222 fTypeface.reset(GetResourceAsTypeface("/fonts/Funkster.ttf") );
223 SkAutoTDelete<SkFILEStream> stream(new SkFILEStream(filename .c_str()));
224 if (!stream->isValid()) {
225 SkDebugf("Could not find Funkster.ttf, please set --reso urcePath "
226 "correctly.\n");
227 return;
228 }
229 fTypeface.reset(SkTypeface::CreateFromStream(stream.detach() ));
230 } 223 }
231 paint->setTypeface(fTypeface); 224 paint->setTypeface(fTypeface);
232 } 225 }
233 226
234 const char* text() const override { return "Hi, Skia!"; } 227 const char* text() const override { return "Hi, Skia!"; }
235 228
236 SkAutoTUnref<SkTypeface> fTypeface; 229 SkAutoTUnref<SkTypeface> fTypeface;
237 }; 230 };
238 fPrims.push_back(SkNEW(Rect)); 231 fPrims.push_back(SkNEW(Rect));
239 fPrims.push_back(SkNEW(Circle)); 232 fPrims.push_back(SkNEW(Circle));
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 }; 304 };
312 305
313 SkTArray<Prim*> fPrims; 306 SkTArray<Prim*> fPrims;
314 307
315 typedef GM INHERITED; 308 typedef GM INHERITED;
316 }; 309 };
317 310
318 DEF_GM( return SkNEW(DCShaderGM); ) 311 DEF_GM( return SkNEW(DCShaderGM); )
319 } 312 }
320 #endif 313 #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