30
30
#include " txt/font_style.h"
31
31
#include " txt/font_weight.h"
32
32
#include " txt/paragraph.h"
33
- #include " txt/paragraph_builder .h"
33
+ #include " txt/paragraph_builder_txt .h"
34
34
35
35
namespace txt {
36
36
@@ -45,15 +45,15 @@ static void BM_ParagraphShortLayout(benchmark::State& state) {
45
45
txt::TextStyle text_style;
46
46
text_style.font_families = std::vector<std::string>(1 , " Roboto" );
47
47
text_style.color = SK_ColorBLACK;
48
- txt::ParagraphBuilder builder (paragraph_style, GetTestFontCollection ());
48
+ txt::ParagraphBuilderTxt builder (paragraph_style, GetTestFontCollection ());
49
49
50
50
builder.PushStyle (text_style);
51
51
builder.AddText (u16_text);
52
52
builder.Pop ();
53
- auto paragraph = builder. Build ( );
53
+ auto paragraph = BuildParagraph (builder );
54
54
while (state.KeepRunning ()) {
55
55
paragraph->SetDirty ();
56
- paragraph->Layout (300 , true );
56
+ paragraph->Layout (300 );
57
57
}
58
58
}
59
59
BENCHMARK (BM_ParagraphShortLayout);
@@ -87,15 +87,15 @@ static void BM_ParagraphLongLayout(benchmark::State& state) {
87
87
text_style.font_families = std::vector<std::string>(1 , " Roboto" );
88
88
text_style.color = SK_ColorBLACK;
89
89
90
- txt::ParagraphBuilder builder (paragraph_style, GetTestFontCollection ());
90
+ txt::ParagraphBuilderTxt builder (paragraph_style, GetTestFontCollection ());
91
91
92
92
builder.PushStyle (text_style);
93
93
builder.AddText (u16_text);
94
94
builder.Pop ();
95
- auto paragraph = builder. Build ( );
95
+ auto paragraph = BuildParagraph (builder );
96
96
while (state.KeepRunning ()) {
97
97
paragraph->SetDirty ();
98
- paragraph->Layout (300 , true );
98
+ paragraph->Layout (300 );
99
99
}
100
100
}
101
101
BENCHMARK (BM_ParagraphLongLayout);
@@ -130,15 +130,15 @@ static void BM_ParagraphJustifyLayout(benchmark::State& state) {
130
130
text_style.font_families = std::vector<std::string>(1 , " Roboto" );
131
131
text_style.color = SK_ColorBLACK;
132
132
133
- txt::ParagraphBuilder builder (paragraph_style, GetTestFontCollection ());
133
+ txt::ParagraphBuilderTxt builder (paragraph_style, GetTestFontCollection ());
134
134
135
135
builder.PushStyle (text_style);
136
136
builder.AddText (u16_text);
137
137
builder.Pop ();
138
- auto paragraph = builder. Build ( );
138
+ auto paragraph = BuildParagraph (builder );
139
139
while (state.KeepRunning ()) {
140
140
paragraph->SetDirty ();
141
- paragraph->Layout (300 , true );
141
+ paragraph->Layout (300 );
142
142
}
143
143
}
144
144
BENCHMARK (BM_ParagraphJustifyLayout);
@@ -154,15 +154,15 @@ static void BM_ParagraphManyStylesLayout(benchmark::State& state) {
154
154
txt::TextStyle text_style;
155
155
text_style.font_families = std::vector<std::string>(1 , " Roboto" );
156
156
text_style.color = SK_ColorBLACK;
157
- txt::ParagraphBuilder builder (paragraph_style, GetTestFontCollection ());
157
+ txt::ParagraphBuilderTxt builder (paragraph_style, GetTestFontCollection ());
158
158
for (int i = 0 ; i < 1000 ; ++i) {
159
159
builder.PushStyle (text_style);
160
160
builder.AddText (u16_text);
161
161
}
162
- auto paragraph = builder. Build ( );
162
+ auto paragraph = BuildParagraph (builder );
163
163
while (state.KeepRunning ()) {
164
164
paragraph->SetDirty ();
165
- paragraph->Layout (300 , true );
165
+ paragraph->Layout (300 );
166
166
}
167
167
}
168
168
BENCHMARK (BM_ParagraphManyStylesLayout);
@@ -181,15 +181,15 @@ static void BM_ParagraphTextBigO(benchmark::State& state) {
181
181
text_style.font_families = std::vector<std::string>(1 , " Roboto" );
182
182
text_style.color = SK_ColorBLACK;
183
183
184
- txt::ParagraphBuilder builder (paragraph_style, GetTestFontCollection ());
184
+ txt::ParagraphBuilderTxt builder (paragraph_style, GetTestFontCollection ());
185
185
186
186
builder.PushStyle (text_style);
187
187
builder.AddText (u16_text);
188
188
builder.Pop ();
189
- auto paragraph = builder. Build ( );
189
+ auto paragraph = BuildParagraph (builder );
190
190
while (state.KeepRunning ()) {
191
191
paragraph->SetDirty ();
192
- paragraph->Layout (300 , true );
192
+ paragraph->Layout (300 );
193
193
}
194
194
state.SetComplexityN (state.range (0 ));
195
195
}
@@ -210,16 +210,16 @@ static void BM_ParagraphStylesBigO(benchmark::State& state) {
210
210
text_style.font_families = std::vector<std::string>(1 , " Roboto" );
211
211
text_style.color = SK_ColorBLACK;
212
212
213
- txt::ParagraphBuilder builder (paragraph_style, GetTestFontCollection ());
213
+ txt::ParagraphBuilderTxt builder (paragraph_style, GetTestFontCollection ());
214
214
215
215
for (int i = 0 ; i < state.range (0 ); ++i) {
216
216
builder.PushStyle (text_style);
217
217
builder.AddText (u16_text);
218
218
}
219
- auto paragraph = builder. Build ( );
219
+ auto paragraph = BuildParagraph (builder );
220
220
while (state.KeepRunning ()) {
221
221
paragraph->SetDirty ();
222
- paragraph->Layout (300 , true );
222
+ paragraph->Layout (300 );
223
223
}
224
224
state.SetComplexityN (state.range (0 ));
225
225
}
@@ -239,11 +239,11 @@ static void BM_ParagraphPaintSimple(benchmark::State& state) {
239
239
txt::TextStyle text_style;
240
240
text_style.font_families = std::vector<std::string>(1 , " Roboto" );
241
241
text_style.color = SK_ColorBLACK;
242
- txt::ParagraphBuilder builder (paragraph_style, GetTestFontCollection ());
242
+ txt::ParagraphBuilderTxt builder (paragraph_style, GetTestFontCollection ());
243
243
builder.PushStyle (text_style);
244
244
builder.AddText (u16_text);
245
- auto paragraph = builder. Build ( );
246
- paragraph->Layout (300 , true );
245
+ auto paragraph = BuildParagraph (builder );
246
+ paragraph->Layout (300 );
247
247
248
248
std::unique_ptr<SkBitmap> bitmap = std::make_unique<SkBitmap>();
249
249
bitmap->allocN32Pixels (1000 , 1000 );
@@ -286,11 +286,11 @@ static void BM_ParagraphPaintLarge(benchmark::State& state) {
286
286
txt::TextStyle text_style;
287
287
text_style.font_families = std::vector<std::string>(1 , " Roboto" );
288
288
text_style.color = SK_ColorBLACK;
289
- txt::ParagraphBuilder builder (paragraph_style, GetTestFontCollection ());
289
+ txt::ParagraphBuilderTxt builder (paragraph_style, GetTestFontCollection ());
290
290
builder.PushStyle (text_style);
291
291
builder.AddText (u16_text);
292
- auto paragraph = builder. Build ( );
293
- paragraph->Layout (300 , true );
292
+ auto paragraph = BuildParagraph (builder );
293
+ paragraph->Layout (300 );
294
294
295
295
std::unique_ptr<SkBitmap> bitmap = std::make_unique<SkBitmap>();
296
296
bitmap->allocN32Pixels (1000 , 1000 );
@@ -322,7 +322,7 @@ static void BM_ParagraphPaintDecoration(benchmark::State& state) {
322
322
text_style.decoration_style = TextDecorationStyle (kSolid );
323
323
text_style.color = SK_ColorBLACK;
324
324
325
- txt::ParagraphBuilder builder (paragraph_style, GetTestFontCollection ());
325
+ txt::ParagraphBuilderTxt builder (paragraph_style, GetTestFontCollection ());
326
326
327
327
builder.PushStyle (text_style);
328
328
builder.AddText (u16_text);
@@ -335,8 +335,8 @@ static void BM_ParagraphPaintDecoration(benchmark::State& state) {
335
335
builder.PushStyle (text_style);
336
336
builder.AddText (u16_text);
337
337
338
- auto paragraph = builder. Build ( );
339
- paragraph->Layout (300 , true );
338
+ auto paragraph = BuildParagraph (builder );
339
+ paragraph->Layout (300 );
340
340
341
341
std::unique_ptr<SkBitmap> bitmap = std::make_unique<SkBitmap>();
342
342
bitmap->allocN32Pixels (1000 , 1000 );
0 commit comments