Skip to content

Commit

Permalink
fix: 优化windows截图性能 (#141)
Browse files Browse the repository at this point in the history
* fix: 优化性能

* chore: 修改版本号
  • Loading branch information
nashaofu authored Aug 11, 2024
1 parent d4b249c commit ce670d1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
3 changes: 2 additions & 1 deletion src/windows/capture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit ce670d1

Please sign in to comment.