pub struct MaskSpans { /* private fields */ }Expand description
Inline collection of mask spans for one row.
Most mask shapes produce ≤ 5 spans per row (e.g., rounded rect: transparent, partial, opaque, partial, transparent). The inline capacity of 8 covers all practical cases without allocation.
Implementations§
Source§impl MaskSpans
impl MaskSpans
Sourcepub fn uniform(width: u32, kind: SpanKind) -> MaskSpans
pub fn uniform(width: u32, kind: SpanKind) -> MaskSpans
Create a span list with a single span covering the full width.
Sourcepub fn to_mask_fill(&self) -> MaskFill
pub fn to_mask_fill(&self) -> MaskFill
Convert to the legacy MaskFill hint (for callers that don’t use spans).
Sourcepub fn align_to(&mut self, align: u32)
pub fn align_to(&mut self, align: u32)
Snap span boundaries to pixel multiples of align, expanding Partial
spans and shrinking Opaque/Transparent neighbors.
align is in pixels (e.g., 2 for AVX2 4ch RGBA, 4 for AVX-512 4ch).
After alignment, every Partial span’s start and end are multiples of
align (clamped to [0, width]), so the SIMD kernel processes clean
blocks with no scalar tail.
This is always safe because:
- Expanding Partial into Opaque territory: mask=1.0, multiply is identity.
- Expanding Partial into Transparent territory: mask=0.0, multiply zeros.
Spans that shrink to zero width are removed. Adjacent spans with the same kind after adjustment are merged.