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

Side by Side Diff: bench/TextBench.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 | « no previous file | gm/coloremoji.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 2011 Google Inc. 3 * Copyright 2011 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 "Benchmark.h" 9 #include "Benchmark.h"
10 #include "Resources.h" 10 #include "Resources.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 fDoColorEmoji = doColorEmoji; 59 fDoColorEmoji = doColorEmoji;
60 fText.set(text); 60 fText.set(text);
61 61
62 fPaint.setAntiAlias(kBW != fq); 62 fPaint.setAntiAlias(kBW != fq);
63 fPaint.setLCDRenderText(kLCD == fq); 63 fPaint.setLCDRenderText(kLCD == fq);
64 fPaint.setTextSize(SkIntToScalar(ps)); 64 fPaint.setTextSize(SkIntToScalar(ps));
65 fPaint.setColor(color); 65 fPaint.setColor(color);
66 66
67 if (doColorEmoji) { 67 if (doColorEmoji) {
68 SkASSERT(kBW == fFQ); 68 SkASSERT(kBW == fFQ);
69 SkString filename = GetResourcePath("/Funkster.ttf"); 69 fColorEmojiTypeface.reset(GetResourceAsTypeface("/fonts/Funkster.ttf "));
70 SkAutoTDelete<SkFILEStream> stream(new SkFILEStream(filename.c_str() ));
71 if (stream->isValid()) {
72 fColorEmojiTypeface.reset(SkTypeface::CreateFromStream(stream.de tach()));
73 } else {
74 SkDebugf("Could not find Funkster.ttf, please set --resourcePath correctly.\n");
75 }
76 } 70 }
77 71
78 if (doPos) { 72 if (doPos) {
79 size_t len = strlen(text); 73 size_t len = strlen(text);
80 SkScalar* adv = new SkScalar[len]; 74 SkScalar* adv = new SkScalar[len];
81 fPaint.getTextWidths(text, len, adv); 75 fPaint.getTextWidths(text, len, adv);
82 fPos = new SkPoint[len]; 76 fPos = new SkPoint[len];
83 SkScalar x = 0; 77 SkScalar x = 0;
84 for (size_t i = 0; i < len; ++i) { 78 for (size_t i = 0; i < len; ++i) {
85 fPos[i].set(x, SkIntToScalar(50)); 79 fPos[i].set(x, SkIntToScalar(50));
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 DEF_BENCH( return new TextBench(STR, 16, 0xFF000000, kLCD); ) 161 DEF_BENCH( return new TextBench(STR, 16, 0xFF000000, kLCD); )
168 DEF_BENCH( return new TextBench(STR, 16, 0xFFFF0000, kLCD); ) 162 DEF_BENCH( return new TextBench(STR, 16, 0xFFFF0000, kLCD); )
169 DEF_BENCH( return new TextBench(STR, 16, 0x88FF0000, kLCD); ) 163 DEF_BENCH( return new TextBench(STR, 16, 0x88FF0000, kLCD); )
170 164
171 DEF_BENCH( return new TextBench(STR, 16, 0xFF000000, kBW, true); ) 165 DEF_BENCH( return new TextBench(STR, 16, 0xFF000000, kBW, true); )
172 DEF_BENCH( return new TextBench(STR, 16, 0xFFFF0000, kBW, true); ) 166 DEF_BENCH( return new TextBench(STR, 16, 0xFFFF0000, kBW, true); )
173 DEF_BENCH( return new TextBench(STR, 16, 0x88FF0000, kBW, true); ) 167 DEF_BENCH( return new TextBench(STR, 16, 0x88FF0000, kBW, true); )
174 168
175 DEF_BENCH( return new TextBench(STR, 16, 0xFF000000, kBW, true, true); ) 169 DEF_BENCH( return new TextBench(STR, 16, 0xFF000000, kBW, true, true); )
176 DEF_BENCH( return new TextBench(STR, 16, 0xFF000000, kAA, false, true); ) 170 DEF_BENCH( return new TextBench(STR, 16, 0xFF000000, kAA, false, true); )
OLDNEW
« no previous file with comments | « no previous file | gm/coloremoji.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698