Skip to content

Commit

Permalink
Fix Rgba16F Buffer 🐬
Browse files Browse the repository at this point in the history
  • Loading branch information
NiiightmareXD committed May 12, 2024
1 parent 75ae060 commit 9af2086
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 11 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -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 🔥"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 8 additions & 2 deletions src/frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
//!
//! ```toml
//! [dependencies]
//! windows-capture = "1.1.9"
//! windows-capture = "1.2.0"
//! ```
//! or run this command
//!
Expand Down
2 changes: 1 addition & 1 deletion windows-capture-python/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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 🔥"
Expand Down
2 changes: 1 addition & 1 deletion windows-capture-python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 9af2086

Please sign in to comment.