Skip to main content

compose_into_framebuffer

Function compose_into_framebuffer 

Source
pub fn compose_into_framebuffer(
    target: &mut FbTarget<'_>,
    shadow: &mut [u8],
    items: &[BlitItem<'_>],
    damage: DamageRect,
)
Expand description

Blend items into target over damage.

shadow is an ARGB8888 scratch buffer the size of the framebuffer. Compositing happens there and is converted into the framebuffer’s own format afterwards, rather than blending directly: a blend needs a consistent channel order and an alpha channel, and the destination has neither in general.

Only the damaged rows are converted. The blend is already confined to the damage; converting the whole buffer afterwards would make the damage tracking pointless, since the conversion is the same cost per row as the blend.

Does nothing when the damage is empty, or when the shadow is too small for the framebuffer it is meant to shadow.