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 create_partial_renderer<T: ItemRenderer + ItemRendererFeatures>(
&self,
renderer: T,
) -> PartialRenderer<'_, T>
pub fn create_partial_renderer<T: ItemRenderer + ItemRendererFeatures>( &self, renderer: T, ) -> PartialRenderer<'_, 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 + ItemRendererFeatures>(
&self,
partial_renderer: &mut PartialRenderer<'_, T>,
components: &[(ItemTreeWeak, LogicalPoint)],
logical_window_size: LogicalSize,
dirty_region_of_existing_buffer: Option<DirtyRegion>,
) -> DirtyRegion
pub fn apply_dirty_region<T: ItemRenderer + ItemRendererFeatures>( &self, partial_renderer: &mut PartialRenderer<'_, T>, components: &[(ItemTreeWeak, LogicalPoint)], logical_window_size: LogicalSize, dirty_region_of_existing_buffer: Option<DirtyRegion>, ) -> DirtyRegion
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. Returns the computed dirty region just for this frame.
The provided buffer_dirty_region specifies which area of the buffer is known to additionally require repainting,
where None means that buffer is not known to be dirty beyond what applies to this frame (reused buffer).
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 underlying 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.