Closed TommyGymer closed 1 year ago
not tested if this also affects Linux
Some resolutions seem to result in the incorrect number of pixels being captured:
test captrs_tests::test_capture ... ok
test captrs_tests::test_capture_components ... ok
test captrs_tests::test_capture_components ... FAILED
test captrs_tests::test_capture ... FAILED
failures:
---- captrs_tests::test_capture_components stdout ----
thread 'captrs_tests::test_capture_components' panicked at 'assertion failed: `(left == right)`
left: `19814400`,
right: `19906560`', src\lib.rs:237:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
---- captrs_tests::test_capture stdout ----
thread 'captrs_tests::test_capture' panicked at 'assertion failed: `(left == right)`
left: `4953600`,
right: `4976640`', src\lib.rs:250:9
failures:
captrs_tests::test_capture
captrs_tests::test_capture_components
The discrepency is usually an integer multiple of one of either the width or height of the frame, e.g.: the test_capture
fails with 4976640 which, when divided by 1440 (the height of the frame) gives 3456. This is 16 pixels more than the actual 3440 width.
The additional pixels (on the right of the frame) are transparent.
This appears to be caused by an issue in the dxgcap crate; more investigation needed
edit This issue appears to originate somewhere in either the winapi crate or in the windows api itself
I've reverted those changes; I've been working on an issue I found in your dxgcap crate (the archived one) which is why I'd changed to captrs2, though I'll probably submit another merge request once I've made those changes and remove the captrs2 crate I published earlier: keeps things simpler.
@bryal , all the reverts should have been made. I've managed to build on windows while targeting linux-gnu, though my WSL install didn't build (seemed to be because it thought it was windows) and I have no way of testing if it builds on linux directly.
Looks good, thank you
Added with bgr format.
Also added tests for checking if the frame data length matches the expected length based on the width and height of the frame.
The lib has also been linted with clippy.
capture_frame_components
method which returns the captured image as a Vec