Skip to main content

project_command_range

Function project_command_range 

Source
pub fn project_command_range(
    scene: &Scene,
    range: Range<usize>,
    options: RangeOptions,
    out: &mut Scene,
) -> RangeCut
Expand description

Writes the commands of scene in range into out (reset first) as a self-contained display list, and reports what the cut did — the overlay spike’s range projection (render-model Phase 4, decision D10).

range is clamped to the scene: an end past the last command stops at it, and a start past end projects nothing. The projection is a scene, not a compiled-frame filter: the compiled frame’s draws are ordered by depth and grouped into rounds, while a command index is the one paint-order position every producer of a cut (a platform view’s place in the display list) can name.

§The bracket rule

A cut can fall inside a bracket. The rule this spike chose:

  • Clips and layers spanning a cut are closed at it and reopened across it. Every clip or layer open at start is re-recorded, in its original push order and with its original geometry, ahead of the range; every one still open at end is popped after it, innermost first. Both halves of a split clip therefore clip to the same shape, and both halves of a split layer composite at the same alpha — which is exact for a clip, and for a layer differs from the uncut frame only where content on both sides of the cut overlaps inside it (each half is composited on its own).
  • A retained bracket spanning a cut is demoted to inline paint on both sides. A page recorded from half a body would be a stale page the ledger then advertises, so neither side records one: the bracket’s presentation scale is folded into every body command’s transform (the same conjugation crate::compile::layers::retained_correction composes ahead of the frame root) and its alpha below one becomes a plain layer — exactly the lowering frust_scene prescribes for a renderer that does not retain. A retained bracket nested inside a demoted one contributes nothing, as a nested bracket’s presentation never does. A retained bracket wholly inside the range is carried as recorded.
  • A pop with no open bracket of its kind is dropped (every renderer ignores one anyway), and a DrawRetained is dropped when options.keep_draw_retained is off.

Pops match the most recently opened bracket of their own kind, which is the stack discipline of every well-nested display list.

Every carried command is re-recorded through a SceneBuilder with its transform composed under the identity (or a demoted bracket’s correction), so geometry and paints are carried verbatim; the cost is one clone of each carried command’s payload, paid only by a caller that projects.