i_slint_core::item_rendering

Struct PartialRenderingState

Source
pub struct PartialRenderingState { /* private fields */ }
Expand description

This struct holds the state of the partial renderer between different frames, in particular the cache of the bounding rect of each item. This permits a more fine-grained computation of the region that needs to be repainted.

Implementations§

Source§

impl PartialRenderingState

Source

pub fn set_repaint_buffer_type(&self, repaint_buffer_type: RepaintBufferType)

Sets the repaint type of the back buffer used for the next rendering. This helps to compute the partial rendering region correctly, for example when using swapped buffers, the region will include the dirty region of the previous frame.

Source

pub fn repaint_buffer_type(&self) -> RepaintBufferType

Returns the current repaint buffer type.

Source

pub fn create_partial_renderer<'a, T: ItemRenderer>( &'a self, renderer: T, ) -> PartialRenderer<'a, T>

Creates a partial renderer that’s initialized with the partial rendering caches maintained in this state structure. Call Self::apply_dirty_region after this function to compute the correct partial rendering region.

Source

pub fn apply_dirty_region<T: ItemRenderer>( &self, partial_renderer: &mut PartialRenderer<'_, T>, components: &[(&ItemTreeRc, LogicalPoint)], logical_window_size: LogicalSize, )

Compute the correct partial rendering region based on the components to be drawn, the bounding rectangles of changes items within, and the current repaint buffer type.

Source

pub fn mark_dirty_region(&self, region: DirtyRegion)

Add the specified region to the list of regions to include in the next rendering.

Source

pub fn free_graphics_resources( &self, items: &mut dyn Iterator<Item = Pin<ItemRef<'_>>>, )

Call this from your renderer’s free_graphics_resources function to ensure that the cached item geometries are cleared for the destroyed items in the item tree.

Source

pub fn clear_cache(&self)

Clears the partial rendering cache. Use this for example when the entire undering window surface changes.

Source

pub fn force_screen_refresh(&self)

Force re-rendering of the entire window region the next time a partial renderer is created.

Trait Implementations§

Source§

impl Default for PartialRenderingState

Source§

fn default() -> PartialRenderingState

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.