Skip to main content

capped_dimensions

Function capped_dimensions 

Source
pub fn capped_dimensions(
    width: u32,
    height: u32,
    max_long_edge: u32,
) -> (u32, u32)
Expand description

The dimensions a width x height frame takes when its long edge is capped at max_long_edge, preserving aspect ratio.

Returns the input unchanged when it already fits, so a caller can compare and skip — and unchanged for an empty frame, which is the one case where “never zero” cannot hold: there is no non-degenerate size for a frame with no pixels, and inventing one would have downscale_rgba8 read a buffer that has nothing in it.