def paint.data.if
gralha-svg-render@0.1.0.1 · svg.bend:5554
import gralha-svg-render@0.1.0.1/svg.bend as Svg
import Base
import gralha-text-scan@0.1.0.1/scan.bend as U
import gralha-coverage@0.1.0.1/cover.bend as Cov
5554def paint.data.if(present: Bool, d: Cov.CovData, fb: Array<U32>, +gx: U32, +gy: U32, +w: U32, +h: U32, +size: U32, +tg: Target, +ctx: PaintCtx) -> Array<U32>:
5555 match present:
5556 case True{}:
5557 Target{tx, ty, tw, th} = tg
5558 +x0 = U.max.u32(gx, tx)
5559 +y0 = U.max.u32(gy, ty)
5560 +x1 = U.min.u32((gx + w : U32), (tx + tw : U32))
5561 +y1 = U.min.u32((gy + h : U32), (ty + th : U32))
5562 +known = U.choose(F32, U32.is_ge(x0, x1) || U32.is_ge(y0, y1), 0.0, paint.block.limit(paint.ctx.clipped(ctx), paint.ctx.clips(ctx), x0, y0, x1, y1))
5563 paint.data.known(F32.is_eq(known, 0.0), known, d, fb, gx, gy, size, Target{tx, ty, tw, th}, ctx)
5564 case False{}: fb