[subset/closure] Batch recursions in scheduled stages

Going to revert. Doesn't pass tests and savings are minor.
pull/4324/head
Behdad Esfahbod 2 years ago
parent 5a65ede5d4
commit f2aaeeb301
  1. 9
      src/hb-ot-layout-gsub-table.hh
  2. 15
      src/hb-ot-layout-gsubgpos.hh

@ -53,9 +53,14 @@ template <typename context_t>
/*static*/ typename hb_closure_context_t::return_t SubstLookup::closure_glyphs_recurse_func (hb_closure_context_t *c, unsigned lookup_index, hb_set_t *covered_seq_indices, unsigned seq_index, unsigned end_index)
{
const SubstLookup &l = c->face->table.GSUB.get_relaxed ()->table->get_lookup (lookup_index);
if (l.may_have_non_1to1 ())
if (covered_seq_indices && l.may_have_non_1to1 ())
hb_set_add_range (covered_seq_indices, seq_index, end_index);
return l.dispatch (c);
if (covered_seq_indices)
c->schedule (lookup_index);
else
l.dispatch (c);
return hb_empty_t ();
}
template <>

@ -183,8 +183,22 @@ struct hb_closure_context_t :
void set_recurse_func (recurse_func_t func) { recurse_func = func; }
void schedule (unsigned lookup_index)
{
scheduled.add (lookup_index);
}
void flush ()
{
hb_set_t scheduled_copy;
while (scheduled)
{
scheduled_copy = scheduled;
scheduled.clear ();
for (unsigned lookup_index : scheduled_copy)
recurse (lookup_index, nullptr, 0, 0);
}
output->del_range (face->get_num_glyphs (), HB_SET_VALUE_INVALID); /* Remove invalid glyphs. */
glyphs->union_ (*output);
output->clear ();
@ -196,6 +210,7 @@ struct hb_closure_context_t :
hb_map_t *done_lookups_glyph_count;
hb_hashmap_t<unsigned, hb::unique_ptr<hb_set_t>> *done_lookups_glyph_set;
unsigned int lookup_count = 0;
hb_set_t scheduled;
};

Loading…
Cancel
Save