Skip to content

Commit

Permalink
Fix more lints
Browse files Browse the repository at this point in the history
This might not be the last of them.
  • Loading branch information
raphlinus committed Dec 9, 2024
1 parent 1f797e3 commit 0c2a142
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions cpu-sparse/examples/svg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub fn main() {
for i in 0..200 {
ctx.reset();
let start = std::time::Instant::now();
render_svg(&mut ctx, &parsed.items, 1.0);
render_svg(&mut ctx, &parsed.items);
let coarse_time = start.elapsed();
ctx.render_to_pixmap(&mut pixmap);
if i % 100 == 0 {
Expand All @@ -46,15 +46,18 @@ pub fn main() {
writer.write_image_data(pixmap.data()).unwrap();
}

fn render_svg(ctx: &mut impl RenderCtx, items: &[Item], scale: f64) {
fn render_svg(ctx: &mut impl RenderCtx, items: &[Item]) {
for item in items {
match item {
Item::Fill(fill_item) => ctx.fill(&fill_item.path, fill_item.color.into()),
Item::Stroke(stroke_item) => {
let style = Stroke::new(stroke_item.width);
ctx.stroke(&stroke_item.path, &style, stroke_item.color.into());
}
Item::Group(group_item) => render_svg(ctx, &group_item.children, scale),
Item::Group(group_item) => {
// TODO: apply transform from group
render_svg(ctx, &group_item.children);
}
}
}
}
Expand Down

0 comments on commit 0c2a142

Please sign in to comment.