Commit Graph

152 Commits

Author SHA1 Message Date
Behdad Esfahbod 3ff91c449f [paint] Optimize transform operations again 2022-12-31 14:49:41 -07:00
Behdad Esfahbod 9e3ff0e9f0 [paint] Fixup 2022-12-31 11:55:45 -07:00
Behdad Esfahbod 6b47fcb17a [paint] Add internal push_skew/pop_skew API 2022-12-31 11:40:12 -07:00
Behdad Esfahbod 46adf31b4c [paint] Add internal push_rotate/pop_rotate API 2022-12-31 11:35:39 -07:00
Behdad Esfahbod ce7835124a [paint] Add internal push_scale/pop_scale API 2022-12-31 11:32:15 -07:00
Behdad Esfahbod 7363eb373a [paint] Add internal push_translate/pop_translate 2022-12-31 11:24:42 -07:00
Behdad Esfahbod ae208963df Add hb-limits.hh 2022-12-26 12:30:39 -07:00
Matthias Clasen ea2892c30e [paint] Limit the size of the graph we follow
In addition to checking the depth, also count
the number of edges in the graph we've followed,
and give up after 1024.
2022-12-26 12:20:04 -07:00
Matthias Clasen 5dd69d81b0 Fix hb_ot_color_has_paint
We must no access v1 data without checking that
version is 1. A bit of a trap.
2022-12-26 11:29:26 -07:00
Matthias Clasen b8f2281c6c Add hb_ot_color_glyph_has_paint 2022-12-26 11:29:26 -07:00
Behdad Esfahbod 1c595ec17f [paint-extents] Lazy-load paint_extents funcs 2022-12-24 11:40:44 -07:00
Behdad Esfahbod 0d129ae308 Fix warning 2022-12-23 18:00:38 -07:00
Behdad Esfahbod 73e48b9357 [colr] Push clipbox or computed clip 2022-12-23 17:55:09 -07:00
Behdad Esfahbod 02684751bd [paint-extents] Clean up 2022-12-23 17:33:13 -07:00
Behdad Esfahbod dbea503a38 [colr] Return true extents 2022-12-23 17:28:46 -07:00
Behdad Esfahbod 47c896f004 [paint-extents] Hook it up, kinda 2022-12-23 16:25:36 -07:00
Behdad Esfahbod fe4e9bd930 [colr] Add public vtable for hb_color_line_t 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 7c9e42ed92 [colr] Fix transform hell 2022-12-23 13:37:59 -07:00
Matthias Clasen 5bd3c07b54 [colr] Don't access baseGlyphList unless v1
This was showing up sporadic crashes due to
invalid reads.
2022-12-23 13:37:59 -07:00
Matthias Clasen c221933977 [paint] Preserve foreground information 2022-12-23 13:37:59 -07:00
Matthias Clasen 6387004cad [paint] Simplify api
Drop the hb_paint_context_t struct from the API, and
only pass the font where we need it.
2022-12-23 13:37:59 -07:00
Matthias Clasen 71bd5a0dfc [paint] Resolve colors
We don't need to pass the index/alpha pairs to
client callbacks, and can just resolve the colors
internally.

Update test results.
2022-12-23 13:37:59 -07:00
Matthias Clasen 9be01b6bff [paint] Pass hb_paint_context_t along
Replace the font argument with a hb_paint_context_t
that carries the font, the palette index and the
foreground color.

The hb_font_paint_glyph() api now takes the palette
index and the foreground color as extra arguments.

Update all callers and regenerate test results.
2022-12-23 13:37:59 -07:00
Behdad Esfahbod 6c71c530ca [paint] Rename hb_paint_context_t to hb_ot_paint_context_t 2022-12-23 13:37:59 -07:00
Matthias Clasen 97224f3b63 [paint] Pass font to all callbacks
This will lead to easier implementations.

At the same time, we change the push_clip_glyph
callback to use the font as-is, no unscaling needed.

Update all callers and expected test results.
2022-12-23 13:37:59 -07:00
Matthias Clasen 7c12db46ff Try to fix msvc build 2022-12-23 13:37:59 -07:00
Matthias Clasen 021618e91a [colr] Add hb_ot_color_has_paint
This is a counterpart to hb_ot_color_has_layers
for COLRv1 data.
2022-12-23 13:37:59 -07:00
Behdad Esfahbod b9314400ec [colr] Hook up color-line variation 2022-12-23 13:37:59 -07:00
Behdad Esfahbod edf2738263 [colr] Try fixing bot build
I don't get the error. Let's see.

../../src/harfbuzz/src/hb-ot-color-colr-table.hh:574:66: error: incomplete definition of type 'OT::NoVariable<OT::ColorLine<OT::NoVariable>>'
2022-12-23 13:37:59 -07:00
Matthias Clasen 686e627bdf [paint] Set up root transform in one place
Instead of spreading this in all the tables,
make hb_paint_funcs_t provide a push/pop_root_transform
that does all the setup.
2022-12-23 13:37:59 -07:00
Behdad Esfahbod c6dd56cc64 [colr] Simplify color-stop handling 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 452cfb9599 [colr] Simplify loop using iterators
Or complexify?!
2022-12-23 13:37:59 -07:00
Behdad Esfahbod 8a9069d55f [colr] Fix radial gradient
Broke it when adding variations.
2022-12-23 13:37:59 -07:00
Behdad Esfahbod 1953d26a8a [colr] Limit recursion depth 2022-12-23 13:37:59 -07:00
Matthias Clasen 0b33b35eb0 COLRv1: Return bool from paint_glyph
This will let hb_ot_font_paint_glyph() try
multiple tables in turn.
2022-12-23 13:37:59 -07:00
Matthias Clasen 0d890061d1 Rename 'solid' to 'color'
'solid' does not really describe well what
the function does, and there is no strong
reason to stick 1:1 to the terminology used
in the spec.
2022-12-23 13:37:59 -07:00
Behdad Esfahbod 46286275f7 [colr] More dispatch functionality 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 81f232afb5 [colr] Use dispatch machinery for paint_glyph context 2022-12-23 13:37:59 -07:00
Behdad Esfahbod a96300d42c [colr] Hide internal symbols 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 0757519092 [colr] Add variation to rest of the paints 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 5bce005346 [colr] Flesh out variations for a few paints 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 9d3440b742 [colr] Add variation infrastructure to paint_glyph
No paint applies variations yet.
2022-12-23 13:37:59 -07:00
Matthias Clasen 5c6329555e Apply root transform
This commit applies scale, slant is still missing.
2022-12-23 13:37:59 -07:00
Matthias Clasen d7c2eacf45 Handle COLRv0 layers in paint_glyph 2022-12-23 13:37:59 -07:00
Matthias Clasen 55ca6ed230 minor fixes 2022-12-23 13:37:59 -07:00
Matthias Clasen 1880e54753 Assorted fixes 2022-12-23 13:37:59 -07:00
Matthias Clasen 684df8a82a add some todos 2022-12-23 13:37:59 -07:00
Matthias Clasen a6f813b680 Implement hb_color_line_get_extend 2022-12-23 13:37:59 -07:00
Matthias Clasen 3937d6b0aa Implement hb_color_line_t 2022-12-23 13:37:59 -07:00
Matthias Clasen 627c857f8b rename pop_group_and_composite 2022-12-23 13:37:59 -07:00