Skip to main content

decode_shm_cursor

Function decode_shm_cursor 

Source
fn decode_shm_cursor(
    width: i32,
    height: i32,
    stride: i32,
    offset: i32,
    opaque: bool,
    raw_bytes: &[u8],
) -> Option<RgbaImage>
Expand description

Read a wl_shm BGRA/XRGB sprite sub-image into a premultiplied RGBA image, the form cap_and_encode must resize before it unpremultiplies. Stride/offset are clamped non-negative with checked arithmetic so a garbage descriptor skips pixels instead of panicking; a sprite past MAX_SPRITE_SIDE is ignored.