diff --git a/Cargo.toml b/Cargo.toml index 7573935..9a82267 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xcap" -version = "0.0.10" +version = "0.0.11" edition = "2021" description = "XCap is a cross-platform screen capture library written in Rust. It supports Linux (X11, Wayland), MacOS, and Windows. XCap supports screenshot and video recording (to be implemented)." license = "Apache-2.0" diff --git a/src/windows/capture.rs b/src/windows/capture.rs index b4f260d..446c6fe 100644 --- a/src/windows/capture.rs +++ b/src/windows/capture.rs @@ -64,10 +64,11 @@ fn to_rgba_image( } }; + let is_old_version = get_os_major_version() < 8; for src in buffer.chunks_exact_mut(4) { src.swap(0, 2); // fix https://github.com/nashaofu/xcap/issues/92#issuecomment-1910014951 - if src[3] == 0 && get_os_major_version() < 8 { + if src[3] == 0 && is_old_version { src[3] = 255; } }