Expand description
Blur kernel and rectangle helpers shared by the renderers.
Structs§
- Blur
Kernel - The separable Gaussian kernel of a blur of
radiussource texels as the blur pass samples it:pair_countpairs on each side,total_weightthe kernel’s sum with the centre tap’s one, computed once per draw. - Blur
TapPair - One pair of kernel taps on one side of the pixel: the Gaussian weights of
the inner and outer tap, and the one bilinear fetch that stands for both,
its
offsetin taps from the pixel and itsweighttheir sum. The outer weight is zero past an odd tap count, which leaves the fetch on the inner tap alone.
Constants§
- BLUR_
MAX_ TAPS - The most taps a blur pass takes on one side of a pixel; a kernel wider than this in scratch texels truncates there.
- BLUR_
TAP_ PAIRS - The tap pairs of a kernel of
BLUR_MAX_TAPStaps: the taps at i and i + 1 on one side share one bilinear fetch.
Functions§
- blur_
reach blur_reach_pxin logical pixels for a blur ofblur_radiuslogical pixels drawn atscaledevice pixels per logical pixel.- blur_
reach_ for_ minimum_ scale - An upper bound on
blur_reachfor every finite scale at leastminimum_scale. A nonpositive or nonfinite minimum has no finite bound. - blur_
reach_ px - How far, in device pixels, a blur of
radius_pxcarries a source pixel: the kernel’s taps at the scratch grid, the block each scratch texel averages on the way down and interpolates on the way back, and the source’s own antialiased pixel, rounded up to whole blocks so the scratch grid sits on the source the same way whatever the margin. Past this distance the blur is exactly zero, so nothing reads or draws beyond it. - blur_
scratch_ block - The block of device pixels one scratch texel of a blur stands for: a wide blur runs at a coarser grid, its kernel scaled with it.
- expand_
blurred_ rect - Grows
recton every side by the reach of a blur ofblur_radiuslogical pixels drawn atscaledevice pixels per logical pixel, then intersects it withclipwhen one is given. ReturnsNonewhen the grown rectangle does not meetclip. - union_
rect - Returns
lhsgrown to coverrhs. Arhswith no area leaveslhsunchanged, and aNonelhsbecomesrhs.