Skip to content

Commit 3cca5af

Browse files
authored
Merge pull request #135 from kerosina/main
Fix scap on windows
2 parents 58d4410 + 9011e36 commit 3cca5af

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "scap"
33
description = "Modern, high-performance screen capture library for Rust. Cross-platform."
4-
version = "0.0.7"
4+
version = "0.0.8"
55
edition = "2021"
66
rust-version = "1.71"
77
license = "MIT"

src/capturer/engine/win/mod.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use windows_capture::{
1414
settings::{ColorFormat, CursorCaptureSettings, DrawBorderSettings, Settings as WCSettings},
1515
window::Window as WCWindow,
1616
};
17+
use windows_capture::capture::Context;
1718

1819
#[derive(Debug)]
1920
struct Capturer {
@@ -36,10 +37,10 @@ impl GraphicsCaptureApiHandler for Capturer {
3637
type Flags = FlagStruct;
3738
type Error = Box<dyn std::error::Error + Send + Sync>;
3839

39-
fn new(flag_values: Self::Flags) -> Result<Self, Self::Error> {
40+
fn new(context: Context<Self::Flags>) -> Result<Self, Self::Error> {
4041
Ok(Self {
41-
tx: flag_values.tx,
42-
crop: flag_values.crop,
42+
tx: context.flags.tx,
43+
crop: context.flags.crop,
4344
})
4445
}
4546

@@ -62,7 +63,7 @@ impl GraphicsCaptureApiHandler for Capturer {
6263
.expect("Failed to crop buffer");
6364

6465
// get raw frame buffer
65-
let raw_frame_buffer = match cropped_buffer.as_raw_nopadding_buffer() {
66+
let raw_frame_buffer = match cropped_buffer.as_nopadding_buffer() {
6667
Ok(buffer) => buffer,
6768
Err(_) => return Err(("Failed to get raw buffer").into()),
6869
};

0 commit comments

Comments
 (0)