pub fn image_format_minimum_row_bytes(
    constraints: &fsysmem::ImageFormatConstraints,
    width: u32,
) -> Result<u32, Error> {
    if constraints.pixel_format.format_modifier.value != DRM_FORMAT_MOD_LINEAR {
        return Err(anyhow!("Non-linear format modifier."));
    }
    if width < constraints.min_coded_width
        || (constraints.max_coded_width > 0 && width > constraints.max_coded_width)
    {
        return Err(anyhow!("Width outside of constraints."));
    }

    let constraints_min_bytes_per_row = constraints.min_bytes_per_row;
    let constraints_bytes_per_row_divisor = constraints.bytes_per_row_divisor;

    round_up_to_increment(
        std::cmp::max(
            image_format_stride_bytes_per_width_pixel(&constraints.pixel_format) * width,
            constraints_min_bytes_per_row,
        ) as usize,
        constraints_bytes_per_row_divisor as usize,
    )
    .map(|bytes| bytes as u32)
}
/// Returns the minimum row bytes for the given constraints and width.
///
/// Returns an error if the width is invalid given the constraints, or the constraint pixel format
/// modifier is invalid.
Returns the minimum row bytes for the given constraints and width.
Returns an error if the width is invalid given the constraints, or the constraint pixel format
modifier is invalid.
Returns the minimum row bytes for the given constraints and width . Returns an error if the width is invalid given the constraints or the constraint pixel format modifier is invalid .
pub fn image_format_minimum_row_bytes(
    constraints: &fsysmem::ImageFormatConstraints,
    width: u32,
) -> Result<u32, Error> {
    if constraints.pixel_format.format_modifier.value != DRM_FORMAT_MOD_LINEAR {
        return Err(anyhow!("Non-linear format modifier."));
    }
    if width < constraints.min_coded_width
        || (constraints.max_coded_width > 0 && width > constraints.max_coded_width)
    {
        return Err(anyhow!("Width outside of constraints."));
    }
    let constraints_min_bytes_per_row = constraints.min_bytes_per_row;
    let constraints_bytes_per_row_divisor = constraints.bytes_per_row_divisor;
    round_up_to_increment(
        std::cmp::max(
            image_format_stride_bytes_per_width_pixel(&constraints.pixel_format) * width,
            constraints_min_bytes_per_row,
        ) as usize,
        constraints_bytes_per_row_divisor as usize,
    )
    .map(|bytes| bytes as u32)
}
pub fn image_format_minimum_row_bytes ( constraints : & fsysmem :: ImageFormatConstraints , width : u32 , ) -> Result < u32 , Error > { if constraints . pixel_format . format_modifier . value != DRM_FORMAT_MOD_LINEAR { return Err ( anyhow ! ( " " ) ) ; } if width < constraints . min_coded_width || ( constraints . max_coded_width > 0 && width > constraints . max_coded_width ) { return Err ( anyhow ! ( " " ) ) ; } let constraints_min_bytes_per_row = constraints . min_bytes_per_row ; let constraints_bytes_per_row_divisor = constraints . bytes_per_row_divisor ; round_up_to_increment ( std :: cmp :: max ( image_format_stride_bytes_per_width_pixel ( & constraints . pixel_format ) * width , constraints_min_bytes_per_row , ) as usize , constraints_bytes_per_row_divisor as usize , ) . map ( | bytes | bytes as u32 ) }
Returns the minimum row bytes for the given constraints and width.
Returns the minimum row bytes for the given constraints and width .
constraints
&fsysmem::ImageFormatConstraints
width
u32
constraints
&fsysmem::ImageFormatConstraints
width
u32