Skip to main content

BackdropPlanner

Struct BackdropPlanner 

Source
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

Source

pub fn new() -> Self

Source

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.

Source

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.

Source

pub fn pop_layer(&mut self)

Source

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.

Source

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.

Source

pub fn finish(self) -> FramePlan

Close the frame and hand back what it costs.

Trait Implementations§

Source§

impl Debug for BackdropPlanner

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for BackdropPlanner

Source§

fn default() -> BackdropPlanner

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,