CI / Build + Clippy + Test (push) Failing after 1h10m8s
CI / Security audit (RUSTSEC) (push) Failing after 1m31s
Oracle P2 follow-up. The clippy --fix autofixes earlier in this branch
silently introduced dependencies on APIs newer than the README's
1.70+ claim:
- u32::is_multiple_of (stable 1.87)
- Option::is_none_or (stable 1.82)
clippy::incompatible_msrv flagged the mismatch once rust-version was
pinned. Bumping the floor to 1.87 is the honest fix — the codebase
genuinely depends on 1.87 features now, and 1.87 has been stable
long enough (current stable is 1.96) that desktop CLI users on stable
Rust already have it.
- Cargo.toml: rust-version '1.70' -> '1.87'. Comment lists the specific
APIs that drove the bump and notes that further bumps need to be
validated against clippy::incompatible_msrv.
- README.md: Prerequisites line updated to 1.87+ with a brief why.
- src/state_portal.rs: added the AsRawFd rustc-quirk comment that was
already in avhw.rs (rustc emits a false 'unused_imports' warning;
removing it produces E0599). Same known quirk, same documentation
pattern.
- src/transform.rs: fixed empty_line_after_doc_comments warning by
converting the leading // doc-style comment to a //! module-level
doc comment (which is what it should have been when I rewrote the
file in commit 145b5d3).
All 79 unit tests + 3 integration tests pass. clippy: 0 errors,
0 incompatible_msrv warnings, 0 empty_line_after_doc_comments warnings.
Remaining warnings are: 1 AsRawFd rustc false-positive (documented),
5 unnecessary_cast FFI false-positives (rustc quirk on pointer casts),
and 8 dead-code items that need product decisions.
108 lines
2.9 KiB
Rust
108 lines
2.9 KiB
Rust
//! Coordinate transformation module for Wayland output transforms.
|
|
//!
|
|
//! Historically exposed a family of `Rect`/`screen_to_frame`/`fit_inside_bounds`
|
|
//! helpers for ROI-based capture clipping. Those were never wired into the
|
|
//! capture pipeline (we capture full frames and let FFmpeg's filter graph handle
|
|
//! any scaling/rotation); they have been removed. Only `Transform` and the
|
|
//! `transpose_if_transform_transposed` helper remain — both are actively used by
|
|
//! `state.rs` and `avhw.rs`.
|
|
|
|
/// Wayland output transform enum, matching `wl_output::Transform`.
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
|
pub enum Transform {
|
|
Normal,
|
|
Normal90,
|
|
Normal180,
|
|
Normal270,
|
|
Flipped,
|
|
Flipped90,
|
|
Flipped180,
|
|
Flipped270,
|
|
}
|
|
|
|
/// Swap width and height for 90° or 270° rotations.
|
|
///
|
|
/// After a quarter-turn rotation the output dimensions are transposed
|
|
/// relative to the input. This helper returns `(h, w)` for those cases
|
|
/// and `(w, h)` unchanged otherwise.
|
|
pub fn transpose_if_transform_transposed(transform: Transform, w: i32, h: i32) -> (i32, i32) {
|
|
match transform {
|
|
Transform::Normal90
|
|
| Transform::Normal270
|
|
| Transform::Flipped90
|
|
| Transform::Flipped270 => (h, w),
|
|
_ => (w, h),
|
|
}
|
|
}
|
|
|
|
#[cfg(test)]
|
|
mod tests {
|
|
use super::*;
|
|
|
|
// ── transpose_if_transform_transposed ─────────────────────────
|
|
|
|
#[test]
|
|
fn transpose_normal_no_swap() {
|
|
assert_eq!(
|
|
transpose_if_transform_transposed(Transform::Normal, 1920, 1080),
|
|
(1920, 1080)
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn transpose_90_swaps() {
|
|
assert_eq!(
|
|
transpose_if_transform_transposed(Transform::Normal90, 1920, 1080),
|
|
(1080, 1920)
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn transpose_180_no_swap() {
|
|
assert_eq!(
|
|
transpose_if_transform_transposed(Transform::Normal180, 1920, 1080),
|
|
(1920, 1080)
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn transpose_270_swaps() {
|
|
assert_eq!(
|
|
transpose_if_transform_transposed(Transform::Normal270, 1920, 1080),
|
|
(1080, 1920)
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn transpose_flipped_no_swap() {
|
|
assert_eq!(
|
|
transpose_if_transform_transposed(Transform::Flipped, 1920, 1080),
|
|
(1920, 1080)
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn transpose_flipped90_swaps() {
|
|
assert_eq!(
|
|
transpose_if_transform_transposed(Transform::Flipped90, 1920, 1080),
|
|
(1080, 1920)
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn transpose_flipped180_no_swap() {
|
|
assert_eq!(
|
|
transpose_if_transform_transposed(Transform::Flipped180, 1920, 1080),
|
|
(1920, 1080)
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn transpose_flipped270_swaps() {
|
|
assert_eq!(
|
|
transpose_if_transform_transposed(Transform::Flipped270, 1920, 1080),
|
|
(1080, 1920)
|
|
);
|
|
}
|
|
}
|