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

Side by Side Diff: gm/coloremoji.cpp

Issue 346453002: Refactor how we handle resources path in Tests. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix rebase conflict Created 6 years, 6 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/cmykjpeg.cpp ('k') | gm/copyTo4444.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 2013 Google Inc. 2 * Copyright 2013 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 "gm.h" 8 #include "gm.h"
9
10 #include "Resources.h"
9 #include "SkCanvas.h" 11 #include "SkCanvas.h"
10 #include "SkStream.h" 12 #include "SkStream.h"
11 #include "SkTypeface.h" 13 #include "SkTypeface.h"
12 14
13 namespace skiagm { 15 namespace skiagm {
14 16
15 class ColorEmojiGM : public GM { 17 class ColorEmojiGM : public GM {
16 public: 18 public:
17 ColorEmojiGM() { 19 ColorEmojiGM() {
18 fTypeface = NULL; 20 fTypeface = NULL;
19 } 21 }
20 22
21 ~ColorEmojiGM() { 23 ~ColorEmojiGM() {
22 SkSafeUnref(fTypeface); 24 SkSafeUnref(fTypeface);
23 } 25 }
24 protected: 26 protected:
25 virtual uint32_t onGetFlags() const SK_OVERRIDE { 27 virtual uint32_t onGetFlags() const SK_OVERRIDE {
26 return kSkipTiled_Flag; 28 return kSkipTiled_Flag;
27 } 29 }
28 30
29 virtual void onOnceBeforeDraw() SK_OVERRIDE { 31 virtual void onOnceBeforeDraw() SK_OVERRIDE {
30 32 SkString filename = GetResourcePath();
31 SkString filename(INHERITED::gResourcePath);
32 filename.append("/Funkster.ttf"); 33 filename.append("/Funkster.ttf");
33 34
34 SkAutoTUnref<SkFILEStream> stream(new SkFILEStream(filename.c_str())); 35 SkAutoTUnref<SkFILEStream> stream(new SkFILEStream(filename.c_str()));
35 if (!stream->isValid()) { 36 if (!stream->isValid()) {
36 SkDebugf("Could not find Funkster.ttf, please set --resourcePath cor rectly.\n"); 37 SkDebugf("Could not find Funkster.ttf, please set --resourcePath cor rectly.\n");
37 return; 38 return;
38 } 39 }
39 40
40 fTypeface = SkTypeface::CreateFromStream(stream); 41 fTypeface = SkTypeface::CreateFromStream(stream);
41 } 42 }
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 111
111 typedef GM INHERITED; 112 typedef GM INHERITED;
112 }; 113 };
113 114
114 ////////////////////////////////////////////////////////////////////////////// 115 //////////////////////////////////////////////////////////////////////////////
115 116
116 static GM* MyFactory(void*) { return new ColorEmojiGM; } 117 static GM* MyFactory(void*) { return new ColorEmojiGM; }
117 static GMRegistry reg(MyFactory); 118 static GMRegistry reg(MyFactory);
118 119
119 } 120 }
OLDNEW
« no previous file with comments | « gm/cmykjpeg.cpp ('k') | gm/copyTo4444.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698