Skip to main content

DirtyTracking

Trait DirtyTracking 

Source
pub trait DirtyTracking: DrawTarget {
    // Required methods
    fn dirty_area(&self) -> Option<Rectangle>;
    fn clear_dirty(&mut self);
    fn mark_all_dirty(&mut self);
}
Expand description

Change tracking for a DrawTarget that buffers pixels in RAM.

This is the producer side of WindowedDrawTarget: a buffer records what was touched during a frame, and the present step asks for that region so it can transmit only those pixels. Keeping the trait here means a GUI library, a 3D rasterizer and an application can all draw into the same buffer and contribute to one coalesced dirty region.

Implementations are free to over-report (a bounding box of the touched pixels is the usual choice) but must never under-report.

Required Methods§

Source

fn dirty_area(&self) -> Option<Rectangle>

Returns the region touched since the last clear_dirty, or None if nothing changed.

Source

fn clear_dirty(&mut self)

Marks the whole target as clean. Called after a successful present.

Source

fn mark_all_dirty(&mut self)

Marks the whole target as dirty, forcing the next present to be a full frame. Useful after a controller reset or a mode change that leaves the panel’s contents unknown.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§