Skip to main content

Module strip_layers

Module strip_layers 

Expand description

A frame drawn as retained layers, and strip pans composited from them.

A frame producer whose content holds horizontally panned strips (a wide canvas seen through a viewport) can draw the frame as layers (FrameLayers): what is behind every strip, each strip on its own in canvas coordinates, and everything above them, all in scene (device) pixels. A pan then changes only where each strip reads its canvas (StripBlit::scroll_x); the layers’ scenes stay byte for byte the same.

StripLayers keeps the backdrop, the strips and the chrome rasterised in textures of the output’s size. The strips texture holds the strips as the screen shows them (append_panned). On a pure pan, a pixel whose strips all moved by the same distance is copied from where it was, and only the rest is rasterised: the columns the pan uncovered, and the bands where a moving strip’s drawing meets a strip that moved otherwise (each strip draws its shadows past its row, into its neighbour’s). The output is then composited from the three textures (source over, premultiplied, as vello blends), over what changed. The backdrop and the chrome are rasterised again only when their scenes change.

The composite stores straight alpha, as vello’s fine stage does, so a composited output matches a single render of the same frame within a channel step of rounding.

Structs§

BandCopy
Part of the strips layer that a pan moves: width × height pixels at (src_x, src_y) go to (dst_x, dst_y).
ChromeDamage
Where the chrome of a drawing as layers differs from the chrome of the drawing since (FrameCache::generation), in scene pixels and whole 16-pixel tiles: a presenter whose chrome texture still holds that drawing’s chrome brings it up to date by rasterising only these rects, so a clock tick rasterises a few tiles, not the whole layer.
CompositeTarget
Where a composite is encoded and what it writes.
FrameCache
A frame as layers a presenter retains between frames.
FrameLayers
A frame’s sections as layers, bottom to top, in scene pixels. Drawing them over each other in order (source over) gives the frame’s scene (compose), so a presenter can rasterize each into its own retained buffer and composite the buffers: a strip’s pan then moves that strip’s pixels over a backdrop and chrome that stay put, without drawing any of them again.
LayerPresenter
The layer textures of one output and what they hold.
LayerRecording
One frame drawn as layers, on this thread, from Self::begin until Self::finish (or the guard’s drop, which discards it).
LayerTexture
One layer’s texture: what vello rasterises into and the composite reads.
LayerWork
The work a frame takes: which layers to rasterise, and where to composite the output.
QueuedRaster
The raster an app’s render worker presents layers with: vello renders each layer straight into its texture and the composite writes the worker’s retained target, all submitted in order on one queue, so nothing waits for the GPU here; presenting the target follows them.
Shown
What a set of layer textures shows: the layers of the frame last composited from them, or warmed into them at rest (a presenter warming its textures between pans). A layer is None while its texture holds nothing known: a warm stopped while drawing it.
StripBlit
A strip drawn in canvas coordinates. The presenter shows the strips layer scroll_x pixels to the right of and scroll_y pixels below dest_*, in scene pixels.
StripLayers
The retained layers of one output, and the pass that composites them.

Enums§

Layer
Which layer texture a render goes to.
WorkspaceWork
What the strips layer needs for a frame.

Traits§

LayerRaster
What a LayerPresenter rasterises with and composites through.

Functions§

append_panned
The strips layer as the screen shows it: what no strip carries in place, then each strip, top to bottom, inside its destination read scroll_x pixels to the right of and scroll_y pixels below it.
chrome_damage
Where the chrome texture, holding shown’s chrome, must be rasterised again to hold cache’s, on an output of size: the rects FrameCache::chrome_damage names, when the texture holds the drawing they were measured from. None when that is not known: the whole layer.
compose
The frame cache holds as one scene: its layers over each other, as StripLayers composites them.
draw_strip
Draw a pannable view’s content as the frame’s strip, when a LayerRecording is open: viewport (where the content shows) and scroll (how far it is panned, transform mapping both to device pixels) are whole device pixels, nothing is open around the view in scene, and no other view is the frame’s strip. draw then draws the content where it would show with no pan, scroll right of and below where it shows: the strip’s canvas. Returns false, having drawn nothing, otherwise: the caller draws its content as usual.
plan
The work that brings layer textures showing shown to cache, on an output of size. output_current says the output target still holds shown’s composite, so only what changed needs compositing again.
put_under
Put what cache draws under its chrome below every surface of backdrop: a floating surface drawn in the chrome recorded only the chrome drawn before it as what is behind it.
take_panned
Whether a view that can be drawn as a strip (draw_strip) panned in a frame drawn since the last call: a host draws the next frame as layers.
tiles
damage (device pixels) on an output of size in whole 16-pixel tiles, as ChromeDamage::rects names where a chrome changed.
warm_bands
The bands a warm rasterises a whole layer of an output of size in, top to bottom; None when one render takes the whole layer.