mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Add a benchmark that measures SkParagraph ParagraphBuilder for a simple use case (flutter/engine#32985)
This commit is contained in:
parent
ea8342fc2b
commit
2cb5459327
@ -299,3 +299,19 @@ BENCHMARK_F(SkParagraphFixture, PaintDecoration)(benchmark::State& state) {
|
||||
offset++;
|
||||
}
|
||||
}
|
||||
|
||||
BENCHMARK_F(SkParagraphFixture, SimpleBuilder)(benchmark::State& state) {
|
||||
const char* text = "Hello World";
|
||||
sktxt::ParagraphStyle paragraph_style;
|
||||
sktxt::TextStyle text_style;
|
||||
text_style.setFontFamilies({SkString("Roboto")});
|
||||
text_style.setColor(SK_ColorBLACK);
|
||||
while (state.KeepRunning()) {
|
||||
auto builder =
|
||||
sktxt::ParagraphBuilder::make(paragraph_style, font_collection_);
|
||||
builder->pushStyle(text_style);
|
||||
builder->addText(text);
|
||||
builder->pop();
|
||||
auto paragraph = builder->Build();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user