Expose budget policy and remaining-work callbacks on draw and paint function
objects. The public setters clamp invalid negative caps, distinguish finite
defaults from explicit unlimited operation, and report whether a backend
participates in accounting.
Let draw sessions borrow the live counter owned by draw_data. OpenType glyf
and CFF traversal then debit the same counter in place, while unsupported
backends retain a finite per-glyph fallback. Forward budget access through
the parent-font draw adaptor.
Document the new API and cover nil, default, unlimited, clamped, concrete,
and live-depletion behavior.
Tests: meson test -C build (272/272 passed)
Assisted-by: OpenAI Codex <codex@openai.com>
The dispatch wrapper handed the callback user_data->push_clip_glyph
instead of user_data->color_glyph, so a client registering both
callbacks with different contexts got the wrong pointer on every
COLR glyph.
Reduce linear gradient anchors and normalize color lines before
printing them in test-paint. This makes the transcript reflect the
renderer-facing gradient geometry instead of backend-specific raw
COLRv1 anchors and stop ranges.
Also normalize signed zero in transform output so the fixtures stay
stable across backends.
Testing:
CCACHE_DISABLE=1 meson test -C build test-paint --print-errorlogs
Assisted-by: OpenAI Codex
Folded into the existing test-paint binary. Two tests,
both font-independent (registered ahead of the glyph-based
flavor setup so they run even on builds without the test
COLRv1 font):
* test_push_clip_path_nil_returns_null: an unset paint-funcs
table returns NULL from push_clip_path_start and clears
the out-param draw_data, and push_clip_path_end is safe
to call on the nil stub.
* test_push_clip_path_round_trip: registered start/end fire
in order, the returned draw-funcs + draw-data round-trip
through the public entry points, and every hb_draw_*()
call reaches the sink accumulator. Asserts the count
includes hb_draw_close_path's synthetic back-to-start
line_to so the contract is documented by the test.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When generating the expected output with GENERATE_DATA=1,
Glib's test framework puts out some comments at the top
of the file. Ignore them when comparing the expected
output. This makes it possible to directly use the output
of
GENERATE_DATA=1 ./test-paint -p TESTCASE
as expected result for TESTCASE.