mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-22 07:21:06 +01:00
Every COLRv1 renderer ends up rewriting these three helpers;
they now live on hb-paint.h so Skia, FreeType-SVG, and other
downstream paint-API implementers can consume a single
canonical implementation.
* hb_paint_reduce_linear_anchors() -- 3-anchor (P0, P1, P2)
to 2-point axis projection.
* hb_paint_normalize_color_line() -- sort + rescale stops
to [0, 1]; returns (min, max) so callers can shift
gradient geometry to match.
* hb_paint_sweep_gradient_tiles() + matching
hb_paint_sweep_gradient_tile_func_t callback typedef --
iterates the full 0..2π sweep produced by a color-stop
list, invoking the callback once per (start, end)
angular segment. Handles PAD / REPEAT / REFLECT.
Implementation moves from src/hb-paint.hh (private, static
inline) to src/hb-paint.cc (public, HB_EXTERN). The sweep
tiler loses its C++ template/lambda flavor and grows a
user_data parameter alongside the function-pointer callback;
the three in-tree callers (cairo, vector-paint, vector-paint-pdf)
now use standalone trampoline functions + context structs
instead of captured lambdas.
Fixes: https://github.com/harfbuzz/harfbuzz/issues/5928
Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>