Skip to main content

resolve_dims

Function resolve_dims 

Source
fn resolve_dims(root_w: u16, root_h: u16, s: &CaptureSettings) -> (u16, u16)
Expand description

Resolve the capture dimensions shm_get_image will read, bounded so the region can never run past the live root from the (clamped) capture offset: with auto-adjust (or unset width/height <= 0) the capture tracks the full root minus the offset, otherwise the requested size is clamped to what is available from it. Saturating subtraction plus a final u16 clamp (minimum 2) keep pathological settings from overflowing or collapsing to an unusable surface. Video codecs require even dimensions, so both are then rounded down to a multiple of two.