mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-20 22:41:10 +01:00
raster-paint reached into the rasterizer through two internal functions: hb_raster_draw_set_external_work() to inject a shared work counter and hb_raster_draw_get_edge_work() to read scanline cost back. Both are gone. The paint session now carries two budgets for two different resources: - The outline budget bounds glyph outline traversal and curve flattening. It is the public draw/paint budget: raster-paint seeds the rasterizer with hb_draw_set_budget() before each glyph and reads the remainder back with hb_draw_get_budget_remaining(), so a whole COLR walk shares one budget without touching rasterizer internals. - The pixel budget bounds scanline and fill work, which scales with surface area, not outline complexity. It is charged from the public extents of the rendered mask (and other pixel areas) and keeps its surface-sized default. An unlimited outline policy disables it too. Folding pixel work into the outline budget was why the default had to be inflated by the surface passes; the two now live apart, so HB_BUDGET_GLYPH is a pure outline budget and the surface scaling belongs to the pixel budget. Standalone hb_raster_draw is unchanged: it draws once, so its scanline work needs no session budget, only its structural caps. COLR drives only push_clip_glyph, whose seed/emit/readback is a single self-contained step, so the aggregate outline budget is always conserved across a COLR walk. The push_clip_path_start/end pair spans client draw calls; like push/pop it must be balanced by the client for the outline budget to reconcile, and each render is still bounded by the rasterizer's structural caps regardless. hb_draw_set_budget() clamps a negative seed to zero, so outline exhaustion does not latch across glyphs; an empty mask can then be rendered once more, but that path is bounded by the pixel budget. Add a regression test that paints a real multi-layer COLR glyph into a 1x1 surface (unbounded pixel budget) and checks the outline budget both aggregates the layers' work and bounds the walk. Tests: meson test -C build (275/275 passed); the raster and gpu COLR regression seeds complete in 0.40s and 0.44s. Assisted-by: Claude <noreply@anthropic.com>