mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-21 06:51:01 +01:00
Reserve the paint-encoder API shape and wire the demo to try the
paint path before falling back to draw. The encoder itself is
still a stub so the fallback always fires today; when the encoder
lands, color glyphs will flip automatically with no demo changes.
New public API:
hb_gpu_paint_glyph (paint, font, glyph)
Stashes the font scale on @paint and calls
hb_font_paint_glyph_or_fail() with hb_paint_funcs_get_empty()
so non-color glyphs report false. Returns the funcs call
result.
hb_gpu_paint_encode (paint, &extents)
Stub, returns NULL.
hb_gpu_paint_clear (paint)
hb_gpu_paint_reset (paint)
hb_gpu_paint_recycle_blob (paint, blob)
Stubs that preserve the right semantics. clear is a no-op
(no accumulator state yet), reset additionally zeroes the
stashed scale, recycle_blob hb_blob_destroys.
Adds x_scale / y_scale to hb_gpu_paint_t so glyph can stash them
for the encoder to consume later.
util/gpu/demo-font.cc:
- Creates a paired hb_gpu_paint_t alongside hb_gpu_draw_t.
- Per glyph: if the face has COLRv1 paint for the glyph, tries
hb_gpu_paint_glyph + hb_gpu_paint_encode. On NULL blob, falls
through to the existing draw path.
- Changes the per-iteration sync from _reset to _clear for both
draw and paint: _reset zeroes the font-scale config that
_glyph immediately re-populates, which wastes work and is
semantically wrong. _clear discards accumulator state while
preserving user config.
Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>