Expand description
Opacity layers, snapshot brackets, and the bracket stack they share with clips.
Three of the display list’s commands open a group — a bracket whose
matching pop has to undo exactly what it did, and inside which a hoisted
clear is confined (see clear). GroupStack is that one
stack. It is deliberately one stack and not three: frust_scene records
PopClip, PopLayer and PopSnapshot as distinct commands, but a widget
tree can emit them unbalanced or interleaved, and three stacks would let one
kind of pop lift a bracket another kind still relies on. One stack means the
innermost open bracket is always what closes, whichever pop closes it.
§Opacity layers
A PushLayer at alpha >= 1.0 composites source-over at full opacity,
which is precisely what drawing its contents into the parent does — so it
lowers to nothing but its rectangle’s clip, exactly as PushClip does
(frust_scene documents the two as the same command with alpha fixed).
Below full opacity the layer has to be rendered in isolation and composited
as a whole, which is a page and a pass in the scheduler
(schedule) — so it lowers to a recorded layer plus
that same rectangular clip.
The rectangle goes through the clip stack rather than through
LayerProps::clip_path: frust lowers every clip to a scissor or a
coverage mask and never to an intermediate texture, and the scheduler
refuses a recorded layer carrying a clip path for that exact reason. Setting
both would clip the layer twice.
§Snapshot brackets
The engine implements no snapshot cache. frust_scene states what a
renderer that does not must do instead: paint the body inline, wrapped
exactly as if the recorder had emitted push_transform(scale_about(scale, rect.center())) when scale != 1.0 and push_layer(rect, alpha) when
alpha < 1.0. SnapshotStack is that emulation.
The scale is applied as a correction composed ahead of every subsequent
command’s own transform rather than by rewriting the body’s commands,
because the body was recorded in the ordinary composed transform space: the
bracket’s presentation parameters are deliberately not baked into it. The
correction that reproduces push_transform around a body already carrying
transform is transform * scale_about(..) * transform.inverse() — see
snapshot_correction.
Only the outermost bracket is honoured, which the display list explicitly
permits: an inner bracket’s own alpha and scale are ignored, and its
depth is tracked only so the matching pop can be identified.
Structs§
- Group
- One open bracket: what its matching pop has to undo, and the device-space bounds a clear hoisted past it is confined to.
- Group
Stack - The compiler’s stack of open clip, layer and snapshot brackets.
- Snapshot
Stack - The snapshot bracket’s inline emulation: how deep the walk is inside one, and what the outermost bracket installed.
Enums§
- Layer
Lowering - How a
PushLayerbracket lowers.
Functions§
- layer_
props - The recorded properties an isolated opacity layer carries.
- lower_
layer - How a layer at
alphalowers. - snapshot_
correction - The correction that reproduces a snapshot bracket’s presentation scale.