mirror of
https://github.com/servo/servo.git
synced 2025-08-02 04:00:32 +01:00
Profile time spent saving the screenshot image
This commit is contained in:
parent
47c2858647
commit
9b23cf537e
5 changed files with 18 additions and 12 deletions
|
@ -2166,19 +2166,21 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
})
|
||||
}
|
||||
CompositeTarget::PngFile => {
|
||||
let img = self.draw_img(render_target_info,
|
||||
width,
|
||||
height);
|
||||
match opts::get().output_file.as_ref() {
|
||||
Some(path) => match File::create(path) {
|
||||
Ok(mut file) => match DynamicImage::ImageRgb8(img).save(&mut file, ImageFormat::PNG) {
|
||||
Ok(()) => (),
|
||||
Err(e) => error!("Failed to save {} ({}).", path, e),
|
||||
profile(ProfilerCategory::ImageSaving, None, self.time_profiler_chan.clone(), || {
|
||||
match opts::get().output_file.as_ref() {
|
||||
Some(path) => match File::create(path) {
|
||||
Ok(mut file) => {
|
||||
let img = self.draw_img(render_target_info, width, height);
|
||||
let dynamic_image = DynamicImage::ImageRgb8(img);
|
||||
if let Err(e) = dynamic_image.save(&mut file, ImageFormat::PNG) {
|
||||
error!("Failed to save {} ({}).", path, e);
|
||||
}
|
||||
},
|
||||
Err(e) => error!("Failed to create {} ({}).", path, e),
|
||||
},
|
||||
Err(e) => error!("Failed to create {} ({}).", path, e),
|
||||
},
|
||||
None => error!("No file specified."),
|
||||
}
|
||||
None => error!("No file specified."),
|
||||
}
|
||||
});
|
||||
None
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue