Skip to main content

decompose_axis_aligned_gradient

Function decompose_axis_aligned_gradient 

Source
pub fn decompose_axis_aligned_gradient(
    prim_rect: &LayoutRect,
    tile_size: LayoutSize,
    start: LayoutPoint,
    end: LayoutPoint,
    stops: &[GradientStop],
    clip_rect: &LayoutRect,
    callback: impl FnMut(&LayoutRect, LayoutPoint, LayoutPoint, [GradientStop; 2], EdgeMask),
)
Expand description

Decompose an axis-aligned linear gradient into a sequence of two-stop segments that tile end-to-end across prim_rect. Each callback invocation is one segment, ready to be rendered as its own quad via the fast-path gradient shader. Run at frame-build (against the snapped prim_rect) so adjacent segments share a snapped boundary and tile without phase drift.

Caller must have verified eligibility via linear_gradient_decomposes.