pub struct DamageTracker { /* private fields */ }Expand description
Implementations§
Source§impl DamageTracker
impl DamageTracker
Sourcepub fn new(size: Size) -> Self
pub fn new(size: Size) -> Self
Creates a tracker for a surface of size, starting fully damaged.
Sourcepub const fn surface_size(&self) -> Size
pub const fn surface_size(&self) -> Size
Surface extent damage is clipped against.
Sourcepub fn resize(&mut self, size: Size)
pub fn resize(&mut self, size: Size)
Resizes the surface. Every buffer in flight is now the wrong shape, so all history is discarded and the next frame is a full repaint.
Sourcepub fn add(&mut self, rect: Rect)
pub fn add(&mut self, rect: Rect)
Marks a region of the current frame dirty. Clipped to the surface.
Sourcepub fn pending(&self) -> &[Rect]
pub fn pending(&self) -> &[Rect]
What has been marked dirty this frame, before any buffer age widens it.
Distinct from resolved, which is the answer
resolve last gave and therefore describes the
previous frame until this one is resolved. This is what a caller wants
when it has to hand one tracker’s damage to another before either has
seen a buffer — a tree inside a backend’s event loop, which is exactly
the arrangement DeniseApp::update puts them in.
Empty when the whole surface is marked: there is no rectangle list in
that case, and is_clean is how to tell the
two apart.
Sourcepub fn resolve(&mut self, age: BufferAge) -> &[Rect]
pub fn resolve(&mut self, age: BufferAge) -> &[Rect]
Damage that must actually be repainted into a buffer of the given age.
For BufferAge::Frames(n) this is the union of the
last n frames’ damage, current frame included. For
BufferAge::Undefined, or an age deeper than MAX_TRACKED_FRAMES, it
is the whole surface.
Pass the result to both the renderer and crate::Surface::present.
Trait Implementations§
Source§impl Clone for DamageTracker
impl Clone for DamageTracker
Source§fn clone(&self) -> DamageTracker
fn clone(&self) -> DamageTracker
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more