Skip to main content

Module frame

Module frame 

Source
Expand description

One frame of one surface, as it sits in the ring.

header   u32 magic "TRF1", u16 version, u16 flags, u32 record length,
         u32 surface, u64 sequence, u32 width, u32 height,
         4 × f32 base colour (premultiplied-free sRGB, alpha last)
sections u16 kind, u16 section flags, u32 length, payload, zero padding to 4

A section whose kind the reader does not know is skipped when its sender set SECTION_OPTIONAL, and refuses the frame otherwise: a later step can add scene annotations as optional sections that older services ignore, and service-run motion as required ones that only a service which announced them in its hello receives.

Sections of version 1:

  • SECTION_DAMAGE: rectangles of the surface that changed since the previous frame, in pixels. With the header’s FRAME_FULL the whole surface did. With its FRAME_DAMAGE_ONLY the scene holds only what that damage needs, and is never drawn beyond it.
  • SECTION_SCROLL_COPY: copies within the retained surface, in order, before the damage is repainted (what a scroll keeps).
  • SECTION_LAYER: a layer’s new content, transform, opacity and clip; or that it keeps its content; or that it is gone. Layers not named keep everything.
  • SECTION_ORDER: the order layers draw in, bottom first. Without it the previous order holds; new layers go on top.
  • SECTION_BACKDROP: a floating surface’s blurred backdrop: the placeholder image the scene draws, where, how blurred, and the scene composed below it.

Structs§

Backdrop
A floating surface’s blurred backdrop.
BackdropStage
A material stage as a frame carries it.
Checked
A frame, read and validated, with what it costs to draw.
Frame
A frame record, decoded.
FrameWriter
Writes a frame record; FrameWriter::finish fills in its length.
LayerUpdate
Rect
A rectangle in surface pixels, x0 <= x1, y0 <= y1.
ScrollCopy
A copy within the retained surface: the source rectangle and how far it moves, in pixels.

Enums§

LayerChange
What a frame does to one layer.

Constants§

FRAME_DAMAGE_ONLY
The scene holds only what the frame’s damage needs (an app leaves out what the pixels it presented last still show): a service that would have to draw more of it than that damage refuses the frame (crate::control::Refusal::DamageOnly) and the app sends it whole.
FRAME_FULL
The whole surface changed: repaint all of it.
MAX_STAGE_SOURCE
The most WGSL a stage may carry, bytes.
SECTION_BACKDROP
SECTION_DAMAGE
SECTION_LAYER
SECTION_OPTIONAL
A reader that does not know this section’s kind skips it.
SECTION_ORDER
SECTION_SCROLL_COPY
STAGE_FLOATS
How many numbers a stage’s uniforms hold.

Functions§

read
Read one frame record from bytes (exactly one record) and validate every scene in it against limits. Every byte is read once.