Skip to content

Commit

Permalink
Merge pull request #135 from kerosina/main
Browse files Browse the repository at this point in the history
Fix scap on windows
  • Loading branch information
Brendonovich authored Dec 10, 2024
2 parents 58d4410 + 9011e36 commit 3cca5af
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "scap"
description = "Modern, high-performance screen capture library for Rust. Cross-platform."
version = "0.0.7"
version = "0.0.8"
edition = "2021"
rust-version = "1.71"
license = "MIT"
Expand Down
9 changes: 5 additions & 4 deletions src/capturer/engine/win/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use windows_capture::{
settings::{ColorFormat, CursorCaptureSettings, DrawBorderSettings, Settings as WCSettings},
window::Window as WCWindow,
};
use windows_capture::capture::Context;

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

fn new(flag_values: Self::Flags) -> Result<Self, Self::Error> {
fn new(context: Context<Self::Flags>) -> Result<Self, Self::Error> {
Ok(Self {
tx: flag_values.tx,
crop: flag_values.crop,
tx: context.flags.tx,
crop: context.flags.crop,
})
}

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

// get raw frame buffer
let raw_frame_buffer = match cropped_buffer.as_raw_nopadding_buffer() {
let raw_frame_buffer = match cropped_buffer.as_nopadding_buffer() {
Ok(buffer) => buffer,
Err(_) => return Err(("Failed to get raw buffer").into()),
};
Expand Down

0 comments on commit 3cca5af

Please sign in to comment.