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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 fPaint.setLCDRenderText(kLCD == fq); | 62 fPaint.setLCDRenderText(kLCD == fq); |
63 fPaint.setTextSize(SkIntToScalar(ps)); | 63 fPaint.setTextSize(SkIntToScalar(ps)); |
64 fPaint.setColor(color); | 64 fPaint.setColor(color); |
65 } | 65 } |
66 | 66 |
67 virtual ~TextBench() { | 67 virtual ~TextBench() { |
68 delete[] fPos; | 68 delete[] fPos; |
69 } | 69 } |
70 | 70 |
71 protected: | 71 protected: |
72 void onPreDraw() override { | 72 void onDelayedSetup() override { |
73 if (fDoColorEmoji) { | 73 if (fDoColorEmoji) { |
74 SkASSERT(kBW == fFQ); | 74 SkASSERT(kBW == fFQ); |
75 fColorEmojiTypeface.reset(GetResourceAsTypeface("/fonts/Funkster.ttf
")); | 75 fColorEmojiTypeface.reset(GetResourceAsTypeface("/fonts/Funkster.ttf
")); |
76 } | 76 } |
77 | 77 |
78 if (fDoPos) { | 78 if (fDoPos) { |
79 size_t len = fText.size(); | 79 size_t len = fText.size(); |
80 SkScalar* adv = new SkScalar[len]; | 80 SkScalar* adv = new SkScalar[len]; |
81 fPaint.getTextWidths(fText.c_str(), len, adv); | 81 fPaint.getTextWidths(fText.c_str(), len, adv); |
82 fPos = new SkPoint[len]; | 82 fPos = new SkPoint[len]; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 DEF_BENCH( return new TextBench(STR, 16, 0xFFFF0000, kLCD); ) | 169 DEF_BENCH( return new TextBench(STR, 16, 0xFFFF0000, kLCD); ) |
170 DEF_BENCH( return new TextBench(STR, 16, 0x88FF0000, kLCD); ) | 170 DEF_BENCH( return new TextBench(STR, 16, 0x88FF0000, kLCD); ) |
171 | 171 |
172 DEF_BENCH( return new TextBench(STR, 16, 0xFFFFFFFF, kBW, true); ) | 172 DEF_BENCH( return new TextBench(STR, 16, 0xFFFFFFFF, kBW, true); ) |
173 DEF_BENCH( return new TextBench(STR, 16, 0xFF000000, kBW, true); ) | 173 DEF_BENCH( return new TextBench(STR, 16, 0xFF000000, kBW, true); ) |
174 DEF_BENCH( return new TextBench(STR, 16, 0xFFFF0000, kBW, true); ) | 174 DEF_BENCH( return new TextBench(STR, 16, 0xFFFF0000, kBW, true); ) |
175 DEF_BENCH( return new TextBench(STR, 16, 0x88FF0000, kBW, true); ) | 175 DEF_BENCH( return new TextBench(STR, 16, 0x88FF0000, kBW, true); ) |
176 | 176 |
177 DEF_BENCH( return new TextBench(STR, 16, 0xFF000000, kBW, true, true); ) | 177 DEF_BENCH( return new TextBench(STR, 16, 0xFF000000, kBW, true, true); ) |
178 DEF_BENCH( return new TextBench(STR, 16, 0xFF000000, kAA, false, true); ) | 178 DEF_BENCH( return new TextBench(STR, 16, 0xFF000000, kAA, false, true); ) |
OLD | NEW |