pub struct BackdropPlanner { /* private fields */ }Expand description
Turns a painted scene’s layer and draw events into a FramePlan.
Fed by a backend as it walks the scene. Costs nothing at all until the first backdrop op arrives: a page with no glass on it never allocates and never computes a bounding box.
Implementations§
Source§impl BackdropPlanner
impl BackdropPlanner
pub fn new() -> Self
Sourcepub fn is_tracking(&self) -> bool
pub fn is_tracking(&self) -> bool
Whether the planner is currently tracking anything.
A backend checks this before computing a bounding box to hand to
draw: while it is false, that box would be discarded,
and computing one per draw command is exactly the per-frame CPU cost
this whole design exists to avoid.
Sourcepub fn push_layer(&mut self, bounds: Rect)
pub fn push_layer(&mut self, bounds: Rect)
Record a layer push whose clip bounds everything drawn until its pop.
Accounting content at the layer rather than per draw is what keeps this affordable. A panel’s whole subtree is clipped to the layer, so one bounding box covers all of it however many commands it contains.
pub fn pop_layer(&mut self)
Sourcepub fn draw(&mut self, bounds: Rect)
pub fn draw(&mut self, bounds: Rect)
Record a draw issued with no layer bounding it.
Only meaningful at or above the open batch’s depth; deeper draws are
already covered by the layer they are inside. Backends should gate the
call on is_tracking rather than compute a
bounding box unconditionally.
Sourcepub fn backdrop(
&mut self,
filter: Arc<Filter>,
clip: BezPath,
bounds: Rect,
) -> Boundary
pub fn backdrop( &mut self, filter: Arc<Filter>, clip: BezPath, bounds: Rect, ) -> Boundary
Record a backdrop-filtered layer that is about to be pushed.
Returns whether the scene has to be cut here. The op’s own bounds join the occupied region, so a second panel overlapping this one gets its own segment whether or not the backend also reports the layer push.