From 165e7227e1bfccdea08ede4114c4519474c59c1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sverre=20Johann=20Bj=C3=B8rke?= Date: Mon, 22 Jul 2024 22:43:07 +0200 Subject: [PATCH] fix foo and redundant comment --- src/selfie/mod.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/selfie/mod.rs b/src/selfie/mod.rs index e41e23b..eeb9103 100644 --- a/src/selfie/mod.rs +++ b/src/selfie/mod.rs @@ -18,8 +18,8 @@ pub fn grab_selfie(main_window: &MainWindow) -> Timer { move || { let ui = sc_handle.unwrap(); ui.window().request_redraw(); - let foo = ui.window().take_snapshot().unwrap(); - save_screenshot(foo); + let pixel_buffer = ui.window().take_snapshot().unwrap(); + save_screenshot(pixel_buffer); }, ); @@ -28,10 +28,11 @@ pub fn grab_selfie(main_window: &MainWindow) -> Timer { #[cfg(feature = "selfie")] fn save_screenshot(screenshot: SharedPixelBuffer) { + use log::info; + let (width, height) = (screenshot.width(), screenshot.height()); let raw_pixels: &[u8] = screenshot.as_bytes(); - // Create an ImageBuffer from the raw pixel data let img = ImageBuffer::, _>::from_raw(width, height, raw_pixels) .ok_or_else(|| { ImageError::Parameter(ParameterError::from_kind( @@ -40,6 +41,6 @@ fn save_screenshot(screenshot: SharedPixelBuffer) { }) .unwrap(); - println!("Taking screenshot!"); + info!("Taking screenshot!"); let _ = img.save("screenshot.png"); }