OLD | NEW |
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 Loading... |
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 Loading... |
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); ) |
OLD | NEW |