Skip to main content

render_impl

Function render_impl 

Source
fn render_impl<S: Simd>(
    s: S,
    rect: Rect,
    strip_buf: &mut Vec<Strip>,
    alpha_buf: &mut Vec<u8>,
)
Expand description

Generates strip data for an axis-aligned rectangle.

ยงStrip layout strategy

Tile rows are classified into two kinds:

  • Edge rows (top/bottom of rect): the rect boundary crosses partway through the tile vertically, so individual pixels need per-cell alpha. We emit a single wide strip spanning all tile columns, with alpha = x_alpha * y_alpha (so the intersection of the alpha mask in each direction).

  • Interior rows: every pixel in the tile has full vertical coverage, so we only need to handle the left and right partial-column edges. We emit a left edge strip (with its x-alpha mask) and, when the rect spans more than one tile column, a right edge strip with fill_gap = true so the renderer fills solid 0xFF between them.

The x-alpha masks for the left/right edge tiles are y-independent, so they are precomputed once and reused across all interior rows.