Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sparse_strips/vello_bench/src/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ impl DataItem {

/// Get the unsorted tiles.
pub fn unsorted_tiles(&self) -> Tiles {
let mut tiles = Tiles::new(Level::new(), self.height);
let mut tiles = Tiles::new(Level::new(), self.width, self.height);
let lines = self.lines();
tiles.make_tiles_analytic_aa(Level::new(), &lines, self.width, self.height);

Expand Down
6 changes: 3 additions & 3 deletions sparse_strips/vello_bench/src/strip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ pub fn render_strips_cull(c: &mut Criterion) {

let shifted_lines = shift_lines_50_percent(&item.lines());

let mut tiler = Tiles::new(simd_level, item.height);
let mut tiler = Tiles::new(simd_level, item.width, item.height);
tiler.make_tiles_analytic_aa(simd_level, &shifted_lines, item.width, item.height);
tiler.sort_tiles();

Expand Down Expand Up @@ -139,7 +139,7 @@ pub fn render_rect(c: &mut Criterion) {
&mut storage,
None,
);
generator.reset();
generator.reset(width, height);
std::hint::black_box(&storage);
});
});
Expand All @@ -152,7 +152,7 @@ pub fn render_rect(c: &mut Criterion) {
b.iter(|| {
storage.clear();
generator.generate_filled_rect_fast(&rect, &mut storage, None);
generator.reset();
generator.reset(width, height);
std::hint::black_box(&storage);
});
});
Expand Down
2 changes: 1 addition & 1 deletion sparse_strips/vello_bench/src/tile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ where

g.bench_with_input(BenchmarkId::from_parameter(&item.name), &item, |b, item| {
b.iter(|| {
let mut tiler = Tiles::new(Level::new(), item.height);
let mut tiler = Tiles::new(Level::new(), item.width, item.height);
op(&mut tiler, &lines, item.width, item.height);
});
});
Expand Down
14 changes: 8 additions & 6 deletions sparse_strips/vello_common/src/strip_generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ impl StripGenerator {
Self {
level,
line_buf: Vec::new(),
tiles: Tiles::new(level, height),
tiles: Tiles::new(level, width, height),
flatten_ctx: FlattenCtx::default(),
stroke_ctx: StrokeCtx::default(),
temp_storage: StripStorage::default(),
Expand Down Expand Up @@ -238,10 +238,12 @@ impl StripGenerator {
);
}

/// Reset the strip generator.
pub fn reset(&mut self) {
/// Reset the strip generator for a viewport size, resizing only when needed.
pub fn reset(&mut self, width: u16, height: u16) {
self.width = width;
self.height = height;
self.line_buf.clear();
self.tiles.reset();
self.tiles.reset(width, height);
self.temp_storage.clear();
}
}
Expand Down Expand Up @@ -307,7 +309,7 @@ mod tests {
assert!(!generator.line_buf.is_empty());
assert!(!storage.is_empty());

generator.reset();
generator.reset(100, 100);
storage.clear();

assert!(generator.line_buf.is_empty());
Expand All @@ -329,7 +331,7 @@ mod tests {
&mut storage_path,
None,
);
generator.reset();
generator.reset(100, 100);

generator.generate_filled_rect_fast(&rect, &mut storage_rect, None);

Expand Down
Loading
Loading