diff --git a/Cargo.lock b/Cargo.lock index 03677e4..1e273ec 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -247,9 +247,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.61" +version = "2.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c993ed8ccba56ae856363b1845da7266a7cb78e1d146c8a32d54b45a8b831fc9" +checksum = "bf5be731623ca1a1fb7d8be6f261a3be6d3e2337b8a1f97be944d020c8fcb704" dependencies = [ "proc-macro2", "quote", @@ -306,7 +306,7 @@ dependencies = [ [[package]] name = "windows-capture" -version = "1.1.9" +version = "1.2.0" dependencies = [ "parking_lot", "rayon", @@ -316,7 +316,7 @@ dependencies = [ [[package]] name = "windows-capture-python" -version = "1.1.9" +version = "1.2.0" dependencies = [ "pyo3", "thiserror", diff --git a/Cargo.toml b/Cargo.toml index 2663842..ab0b8eb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "windows-capture" -version = "1.1.9" +version = "1.2.0" authors = ["NiiightmareXD"] edition = "2021" description = "Fastest Windows Screen Capture Library For Rust 🔥" diff --git a/README.md b/README.md index 75e7be5..9664137 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ Add this library to your `Cargo.toml`: ```toml [dependencies] -windows-capture = "1.1.9" +windows-capture = "1.2.0" ``` or run this command diff --git a/src/frame.rs b/src/frame.rs index 5f3f032..3bf06f3 100644 --- a/src/frame.rs +++ b/src/frame.rs @@ -459,12 +459,18 @@ impl<'a> FrameBuffer<'a> { return Ok(self.raw_buffer); } - let frame_size = (self.width * self.height * 4) as usize; + let multiplyer = match self.color_format { + ColorFormat::Rgba16F => 8, + ColorFormat::Rgba8 => 4, + ColorFormat::Bgra8 => 4, + }; + + let frame_size = (self.width * self.height * multiplyer) as usize; if self.buffer.capacity() < frame_size { self.buffer.resize(frame_size, 0); } - let width_size = (self.width * 4) as usize; + let width_size = (self.width * multiplyer) as usize; let buffer_address = self.buffer.as_mut_ptr() as isize; (0..self.height).into_par_iter().for_each(|y| { let index = (y * self.row_pitch) as usize; diff --git a/src/lib.rs b/src/lib.rs index 681ccb5..4a76d74 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -22,7 +22,7 @@ //! //! ```toml //! [dependencies] -//! windows-capture = "1.1.9" +//! windows-capture = "1.2.0" //! ``` //! or run this command //! diff --git a/windows-capture-python/Cargo.toml b/windows-capture-python/Cargo.toml index 867bb7a..e62c4d8 100644 --- a/windows-capture-python/Cargo.toml +++ b/windows-capture-python/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "windows-capture-python" -version = "1.1.9" +version = "1.2.0" authors = ["NiiightmareXD"] edition = "2021" description = "Fastest Windows Screen Capture Library For Python 🔥" diff --git a/windows-capture-python/pyproject.toml b/windows-capture-python/pyproject.toml index fc5e643..879d10e 100644 --- a/windows-capture-python/pyproject.toml +++ b/windows-capture-python/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "maturin" [project] name = "windows-capture" -version = "1.1.9" +version = "1.2.0" description = "Fastest Windows Screen Capture Library For Python 🔥" readme = "README.md" requires-python = ">=3.9"