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
impl PartialRenderingState
Sourcepub fn set_repaint_buffer_type(&self, repaint_buffer_type: RepaintBufferType)
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.
Sourcepub fn repaint_buffer_type(&self) -> RepaintBufferType
pub fn repaint_buffer_type(&self) -> RepaintBufferType
Returns the current repaint buffer type.
Sourcepub fn create_partial_renderer<'a, T: ItemRenderer>(
&'a self,
renderer: T,
) -> PartialRenderer<'a, T>
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.
Sourcepub fn apply_dirty_region<T: ItemRenderer>(
&self,
partial_renderer: &mut PartialRenderer<'_, T>,
components: &[(&ItemTreeRc, LogicalPoint)],
logical_window_size: LogicalSize,
)
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.
Sourcepub fn mark_dirty_region(&self, region: DirtyRegion)
pub fn mark_dirty_region(&self, region: DirtyRegion)
Add the specified region to the list of regions to include in the next rendering.
Sourcepub fn free_graphics_resources(
&self,
items: &mut dyn Iterator<Item = Pin<ItemRef<'_>>>,
)
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.
Sourcepub fn clear_cache(&self)
pub fn clear_cache(&self)
Clears the partial rendering cache. Use this for example when the entire undering window surface changes.
Sourcepub fn force_screen_refresh(&self)
pub fn force_screen_refresh(&self)
Force re-rendering of the entire window region the next time a partial renderer is created.