feat: buffer setter methods are now lazy
This commit is contained in:
parent
e5926aec74
commit
626f44dad8
14 changed files with 388 additions and 240 deletions
|
|
@ -10,7 +10,7 @@ fn load_font_system(c: &mut Criterion) {
|
|||
fn layout(c: &mut Criterion) {
|
||||
let mut fs = ct::FontSystem::new();
|
||||
let mut buffer = ct::Buffer::new(&mut fs, ct::Metrics::new(10.0, 10.0));
|
||||
buffer.set_size(&mut fs, Some(80.0), None);
|
||||
buffer.set_size(Some(80.0), None);
|
||||
|
||||
for (wrap_name, wrap) in &[
|
||||
("None", ct::Wrap::None),
|
||||
|
|
@ -22,11 +22,11 @@ fn layout(c: &mut Criterion) {
|
|||
("Advanced", ct::Shaping::Advanced),
|
||||
] {
|
||||
let mut group = c.benchmark_group(format!("Wrap({wrap_name}, {shape_name})"));
|
||||
buffer.set_wrap(&mut fs, *wrap);
|
||||
buffer.set_wrap(*wrap);
|
||||
|
||||
let mut run_on_text = |text: &str| {
|
||||
buffer.lines.clear();
|
||||
buffer.set_text(&mut fs, text, &ct::Attrs::new(), *shape, None);
|
||||
buffer.set_text(text, &ct::Attrs::new(), *shape, None);
|
||||
buffer.shape_until_scroll(&mut fs, false);
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue