pub struct SnapshotStack { /* private fields */ }Expand description
The snapshot bracket’s inline emulation: how deep the walk is inside one, and what the outermost bracket installed.
Implementations§
Source§impl SnapshotStack
impl SnapshotStack
Sourcepub fn correction(&self) -> Affine
pub fn correction(&self) -> Affine
The affine to compose ahead of the frame root for every command inside the open bracket — the identity when none is open, or when the outermost one asked for no scale.
Sourcepub fn enter(&mut self, rect: Rect, scale: f64, transform: Affine) -> bool
pub fn enter(&mut self, rect: Rect, scale: f64, transform: Affine) -> bool
Enter a bracket, returning whether it is the outermost one.
The outermost bracket installs its presentation scale as the correction; an inner one installs nothing, which is the display list’s own rule that only the outermost bracket needs honouring.
Sourcepub fn record_layer(&mut self, bracket: usize)
pub fn record_layer(&mut self, bracket: usize)
Record that the outermost bracket opened a layer group, so the matching pop closes it.
Separate from enter because opening the layer is the
compiler’s to do and can be declined — a bracket whose corrected
transform does not survive composition opens none, and its pop must not
then close a bracket it never opened. bracket is the group stack’s
depth just after the layer’s own push — the handle leave
uses to tell whether that group is still the one it would close.
Sourcepub fn leave(&mut self, open_brackets: usize) -> bool
pub fn leave(&mut self, open_brackets: usize) -> bool
Leave a bracket, returning whether the outermost one just closed having opened a layer group — that is, whether the caller now has a group to close.
A pop with no bracket open is ignored, the policy the display list
states for an unbalanced PopSnapshot. open_brackets is the group
stack’s current depth: when a stray pop inside the bracket’s body has
already closed the group the snapshot opened, the recorded depth is no
longer reachable and no group is reported — closing one anyway would
lift an ancestor bracket the display list still holds open.