def paint.block
gralha-svg-render@0.1.0.1 · svg.bend:5422
import gralha-svg-render@0.1.0.1/svg.bend as Svg
import Base
5422def paint.block(fb: Array<U32>, +x0: U32, +y0: U32, +size: U32, +v: F32, +t: Target, +ctx: PaintCtx) -> Array<U32>:
5423 Target{tx, ty, tw, th} = t
5424 +bx = paint.from(x0, tx)
5425 +by = paint.from(y0, ty)
5426 +cols = paint.span(x0, size, tx, (tx + tw : U32))
5427 +rows = paint.span(y0, size, ty, (ty + th : U32))
5428 +known = paint.block.limit(paint.ctx.clipped(ctx), paint.ctx.clips(ctx), bx, by, (bx + cols : U32), (by + rows : U32))
5429 +half = U32.div(size, 2)
5430 paint.with(F32.is_lt(known, 0.0) && U32.is_gt(size, 8) && U32.is_gt(cols, 0) && U32.is_gt(rows, 0), fb,
5431 fb1 => paint.block(paint.block(paint.block(paint.block(fb1, x0, y0, half, v, t, ctx), (x0 + half : U32), y0, half, v, t, ctx), x0, (y0 + half : U32), half, v, t, ctx), (x0 + half : U32), (y0 + half : U32), half, v, t, ctx),
5432 fb1 => paint.block.some(U32.is_eq(cols, 0) || U32.is_eq(rows, 0) || F32.is_eq(known, 0.0), fb1, bx, by, U32.to_nat(rows), U32.to_nat(cols), v, known, t, ctx))