Skip to main content

Op

Enum Op 

Source
pub enum Op {
    Save,
    SaveLayer {
        paint: Paint,
        mask_composite: Option<MaskKind>,
        scope_bounds: Rect,
        base_slot: u32,
        composite_slot: u32,
        can_elide: bool,
        backdrop_sigma: Option<f32>,
        backdrop_key: Option<u64>,
    },
    Restore,
    Transform(Matrix),
    DrawRect {
        rect: Rect,
        paint: Paint,
        bounds: Rect,
        slot: u32,
    },
    DrawPath {
        path: Arc<Path>,
        fill_rule: FillRule,
        paint: Paint,
        bounds: Rect,
        slot: u32,
    },
    RRectBlur {
        rect: Rect,
        radii: [f32; 4],
        paint: Paint,
        bounds: Rect,
        slot: u32,
    },
    ClipPath {
        path: Arc<Path>,
        fill_rule: FillRule,
        op: ClipOp,
        expiry_slot: u32,
    },
    DrawImage {
        image: Image,
        src: Rect,
        dst: Rect,
        sampling: Sampling,
        paint: Paint,
        bounds: Rect,
        slot: u32,
    },
    GlyphRun {
        font: Arc<Font>,
        size: f32,
        paint: Paint,
        glyphs: Arc<Vec<GlyphPos>>,
        bounds: Rect,
        slot: u32,
    },
    DrawDisplayList {
        list: Arc<DisplayList>,
        bounds: Rect,
        base_slot: u32,
        cache: bool,
    },
}
Expand description

Op is one recorded display-list command.

Draw and clip operations include the bounds and ordering metadata resolved by crate::DisplayListBuilder at record time.

Variants§

§

Save

§

SaveLayer

Open an offscreen layer scope, closed by the matching Restore. All oracle fields are backpatched when the scope closes — still record time; replay reads them, never counts.

Fields

§paint: Paint
§mask_composite: Option<MaskKind>

Set = this layer is a MASK: its composite converts the texture to COVERAGE (luminance or alpha) and multiplies the enclosing layer by it (DstIn over the whole enclosing extent, so content outside the mask’s ink disappears).

§scope_bounds: Rect

Children’s union bounds ∩ clip ∩ hint, list-root space — the layer texture’s size and the composite quad’s rect.

§base_slot: u32

Slot count when the scope opened. Children continue the SAME depth line as the parent (Impeller’s global numbering, Canvas::current_depth_); the layer’s own pass rebases by subtracting it. Impeller records one span (total_content_depth) and counts during replay; valo’s replay never counts, so it records both ends of the span instead.

§composite_slot: u32

The composite draw’s slot — next on the same line, after the children’s span (so the span is composite_slot - base_slot - 1).

§can_elide: bool

Alpha-linear + pairwise-disjoint children and a plain-alpha composite: replay may skip the texture entirely and let the alpha ride each child at its own slot (Impeller’s opacity peephole: elision changes nothing about depth).

§backdrop_sigma: Option<f32>

Set = the layer OPENS pre-filled with a blur of everything already painted beneath it (σ in local units; replay scales it into device px). Children paint over that glass, and the composite applies group alpha to blur + children as one image — Flutter’s saveLayer(bounds, paint, backdrop). A backdrop layer never elides: the seed needs a texture.

§backdrop_key: Option<u64>

Tiles sharing one key reuse the FIRST tile’s blur (and see the scene as of that tile). Meaningful only with backdrop_sigma.

§

Restore

§

Transform(Matrix)

Appends to the current transform (canvas semantics: applies to subsequently drawn geometry first).

§

DrawRect

Fields

§rect: Rect
§paint: Paint
§bounds: Rect
§slot: u32
§

DrawPath

Fields

§path: Arc<Path>
§fill_rule: FillRule
§paint: Paint
§bounds: Rect
§slot: u32
§

RRectBlur

A mask-blurred solid (r)rect in CLOSED FORM — one draw, no filter passes; why a box shadow costs one quad (Impeller’s SolidRRectBlurContents). Recorded when a solid paint has mask_blur; radii are per corner, clockwise from top-left ([0.0; 4] = sharp).

Fields

§rect: Rect
§radii: [f32; 4]
§paint: Paint
§bounds: Rect
§slot: u32
§

ClipPath

Depth-buffer clip (Impeller’s “new clips”): the renderer stencils the shape, then writes a depth CEILING at expiry_slot — Intersect ceilings the exterior, Difference the interior. Draws below the ceiling fail the depth test there; draws after the scope’s restore sit above it. Expiry is auto — restore renders nothing.

Fields

§path: Arc<Path>
§fill_rule: FillRule
§expiry_slot: u32

The slot of the restore that ends this clip’s scope (backpatched by the builder when the scope closes — still record-time).

§

DrawImage

Textured quad: src (texture px) → dst (local space). Sampling picks filter/tiling; paint contributes tint (color as multiplier), alpha, and blend.

Fields

§image: Image
§src: Rect
§dst: Rect
§sampling: Sampling
§paint: Paint
§bounds: Rect
§slot: u32
§

GlyphRun

Positioned glyphs from a laid-out paragraph — the TextFrame analog (font id + glyph ids + positions, so this crate never depends on the text stack). One op per placed run; y sits on the baseline; the renderer picks bitmap/SDF/path per transform.

Fields

§font: Arc<Font>

The font INSTANCE, carried by value to raster (Skia: text blobs hold sk_sp<SkTypeface> — nothing is registered renderer-side). Serialization keeps only the raster identity.

§size: f32
§paint: Paint

Blend/alpha/mask-blur apply like any draw; paint.color tints mask glyphs (color glyphs keep their palette, alpha only).

§glyphs: Arc<Vec<GlyphPos>>
§bounds: Rect
§slot: u32
§

DrawDisplayList

Embed another list by reference — the retained-layer composition op.

Fields

§bounds: Rect
§base_slot: u32

Child slots are child-relative; replay offsets them by this.

§cache: bool

The embedder judges this subtree stable and heavy enough to raster-cache (policy is the caller’s; admission stays in the renderer).

Trait Implementations§

Source§

impl Clone for Op

Source§

fn clone(&self) -> Op

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Op

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Op

§

impl !UnwindSafe for Op

§

impl Freeze for Op

§

impl Send for Op

§

impl Sync for Op

§

impl Unpin for Op

§

impl UnsafeUnpin for Op

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,