Trait ImportAll

Source
pub trait ImportAll: Renderer {
    // Required method
    fn import_buffer(
        &mut self,
        buffer: &WlBuffer,
        surface: Option<&SurfaceData>,
        damage: &[Rectangle<i32, BufferCoord>],
    ) -> Option<Result<Self::TextureId, Self::Error>>;
}
Available on crate feature wayland_frontend only.
Expand description

Common trait for renderers of any wayland buffer type

Required Methods§

Source

fn import_buffer( &mut self, buffer: &WlBuffer, surface: Option<&SurfaceData>, damage: &[Rectangle<i32, BufferCoord>], ) -> Option<Result<Self::TextureId, Self::Error>>

Import a given buffer into the renderer.

Returns a texture_id, which can be used with Frame::render_texture_from_to (or Frame::render_texture_at) or implementation-specific functions.

If not otherwise defined by the implementation, this texture id is only valid for the renderer, that created it.

This operation needs no bound or default rendering target.

The implementation defines, if the id keeps being valid, if the buffer is released, to avoid relying on implementation details, keep the buffer alive, until you destroyed this texture again.

If provided the SurfaceAttributes can be used to do caching of rendering resources and is generally recommended.

The damage argument provides a list of rectangle locating parts of the buffer that need to be updated. When provided with an empty list &[], the renderer is allowed to not update the texture at all.

Returns None, if the buffer type cannot be determined or does not correspond to a texture (e.g.: single pixel buffer).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<R: Renderer + ImportMemWl + ImportEgl + ImportDmaWl> ImportAll for R

Available on crate features backend_egl and use_system_lib only.