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

Side by Side Diff: gm/coloremoji.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 | « bench/TextBench.cpp ('k') | gm/dcshader.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 9
10 #include "Resources.h" 10 #include "Resources.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 class ColorEmojiGM : public GM { 47 class ColorEmojiGM : public GM {
48 public: 48 public:
49 ColorEmojiGM() : fCBDT_CBLC_Typeface(NULL), fSBIX_Typeface(NULL) { } 49 ColorEmojiGM() : fCBDT_CBLC_Typeface(NULL), fSBIX_Typeface(NULL) { }
50 50
51 protected: 51 protected:
52 struct EmojiFont { 52 struct EmojiFont {
53 SkTypeface* typeface; 53 SkTypeface* typeface;
54 const char* text; 54 const char* text;
55 } emojiFonts[2]; 55 } emojiFonts[2];
56 virtual void onOnceBeforeDraw() override { 56 virtual void onOnceBeforeDraw() override {
57 SkString filename = GetResourcePath("/Funkster.ttf"); 57 fCBDT_CBLC_Typeface.reset(GetResourceAsTypeface("/fonts/Funkster.ttf"));
58 SkAutoTDelete<SkFILEStream> stream(new SkFILEStream(filename.c_str())); 58 emojiFonts[0].typeface = fCBDT_CBLC_Typeface;
59 if (stream->isValid()) {
60 fCBDT_CBLC_Typeface.reset(SkTypeface::CreateFromStream(stream.detach ()));
61 emojiFonts[0].typeface = fCBDT_CBLC_Typeface;
62 } else {
63 SkDebugf("Could not find Funkster.ttf, please set --resourcePath cor rectly.\n");
64 emojiFonts[0].typeface = NULL;
65 }
66 emojiFonts[0].text = "hamburgerfons"; 59 emojiFonts[0].text = "hamburgerfons";
67 60
68 fSBIX_Typeface.reset(SkTypeface::CreateFromName("Apple Color Emoji", SkT ypeface::kNormal)); 61 fSBIX_Typeface.reset(SkTypeface::CreateFromName("Apple Color Emoji", SkT ypeface::kNormal));
69 emojiFonts[1].typeface = fSBIX_Typeface; 62 emojiFonts[1].typeface = fSBIX_Typeface;
70 emojiFonts[1].text = "\xF0\x9F\x92\xB0" "\xF0\x9F\x8F\xA1" "\xF0\x9F\x8E \x85" // πŸ’°πŸ‘πŸŽ… 63 emojiFonts[1].text = "\xF0\x9F\x92\xB0" "\xF0\x9F\x8F\xA1" "\xF0\x9F\x8E \x85" // πŸ’°πŸ‘πŸŽ…
71 "\xF0\x9F\x8D\xAA" "\xF0\x9F\x8D\x95" "\xF0\x9F\x9A \x80" // πŸͺπŸ•πŸš€ 64 "\xF0\x9F\x8D\xAA" "\xF0\x9F\x8D\x95" "\xF0\x9F\x9A \x80" // πŸͺπŸ•πŸš€
72 "\xF0\x9F\x9A\xBB" "\xF0\x9F\x92\xA9" "\xF0\x9F\x93 \xB7" // πŸš»πŸ’©πŸ“· 65 "\xF0\x9F\x9A\xBB" "\xF0\x9F\x92\xA9" "\xF0\x9F\x93 \xB7" // πŸš»πŸ’©πŸ“·
73 "\xF0\x9F\x93\xA6" // πŸ“¦ 66 "\xF0\x9F\x93\xA6" // πŸ“¦
74 "\xF0\x9F\x87\xBA" "\xF0\x9F\x87\xB8" "\xF0\x9F\x87 \xA6"; // πŸ‡ΊπŸ‡ΈπŸ‡¦ 67 "\xF0\x9F\x87\xBA" "\xF0\x9F\x87\xB8" "\xF0\x9F\x87 \xA6"; // πŸ‡ΊπŸ‡ΈπŸ‡¦
75 } 68 }
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 170
178 typedef GM INHERITED; 171 typedef GM INHERITED;
179 }; 172 };
180 173
181 ////////////////////////////////////////////////////////////////////////////// 174 //////////////////////////////////////////////////////////////////////////////
182 175
183 static GM* MyFactory(void*) { return new ColorEmojiGM; } 176 static GM* MyFactory(void*) { return new ColorEmojiGM; }
184 static GMRegistry reg(MyFactory); 177 static GMRegistry reg(MyFactory);
185 178
186 } 179 }
OLDNEW
« no previous file with comments | « bench/TextBench.cpp ('k') | gm/dcshader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698