Skip to main content

rgba_readback_stride

Function rgba_readback_stride 

Source
pub(crate) fn rgba_readback_stride(
    buf_len: usize,
    height: usize,
    width: usize,
) -> usize
Expand description

Row stride (bytes) of a tightly-mapped RGBA8 GPU readback, derived from the mapping length rather than assuming width*4.

Dividing the buffer length by the height recovers a padded stride, so a padded readback cannot skew the cursor image; the result never drops below one full width*4 row, and a zero height short-circuits to one row to avoid dividing by zero.