mirror of
https://github.com/italicsjenga/vello.git
synced 2025-01-23 18:06:34 +11:00
[svg] Log parse and render times separately
The examples logged the total processing time for an SVG including both parse and GPU buffer encoding times. Times for these two operations are now logged separately.
This commit is contained in:
parent
3d83bd7fa0
commit
23f26ef2a1
1 changed files with 3 additions and 1 deletions
|
@ -93,11 +93,13 @@ pub fn svg_function_of<R: AsRef<str>>(
|
||||||
let start = Instant::now();
|
let start = Instant::now();
|
||||||
let svg = usvg::Tree::from_str(&contents, &usvg::Options::default())
|
let svg = usvg::Tree::from_str(&contents, &usvg::Options::default())
|
||||||
.expect("failed to parse svg file");
|
.expect("failed to parse svg file");
|
||||||
|
eprintln!("Parsed svg {name} in {:?}", start.elapsed());
|
||||||
|
let start = Instant::now();
|
||||||
let mut new_scene = SceneFragment::new();
|
let mut new_scene = SceneFragment::new();
|
||||||
let mut builder = SceneBuilder::for_fragment(&mut new_scene);
|
let mut builder = SceneBuilder::for_fragment(&mut new_scene);
|
||||||
vello_svg::render_tree(&mut builder, &svg);
|
vello_svg::render_tree(&mut builder, &svg);
|
||||||
let resolution = Vec2::new(svg.size.width(), svg.size.height());
|
let resolution = Vec2::new(svg.size.width(), svg.size.height());
|
||||||
eprintln!("Rendered svg {name} in {:?}", start.elapsed());
|
eprintln!("Encoded svg {name} in {:?}", start.elapsed());
|
||||||
(new_scene, resolution)
|
(new_scene, resolution)
|
||||||
}
|
}
|
||||||
let mut cached_scene = None;
|
let mut cached_scene = None;
|
||||||
|
|
Loading…
Add table
Reference in a new issue