[gsubgpos] Keep another digest in the applicable_t

The digest for all the remaining subtables combined.
The idea is to get out of the subtable look as soon as
no more can be applied.

Doesn't seem to speed up anything I tested. Going to revert.
colr-paint-template
Behdad Esfahbod 2 years ago
parent e3fd69c889
commit fd79c7cecd
  1. 32
      src/hb-ot-layout-gsubgpos.hh

@ -1002,6 +1002,7 @@ struct hb_accelerate_subtables_context_t :
hb_cache_func_t cache_func; hb_cache_func_t cache_func;
#endif #endif
hb_set_digest_t digest; hb_set_digest_t digest;
hb_set_digest_t digest_rest;
}; };
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE #ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
@ -4339,6 +4340,12 @@ struct hb_ot_layout_lookup_accelerator_t
thiz->digest.init (); thiz->digest.init ();
for (auto& subtable : hb_iter (thiz->subtables, count)) for (auto& subtable : hb_iter (thiz->subtables, count))
thiz->digest.add (subtable.digest); thiz->digest.add (subtable.digest);
if (count)
for (unsigned int i = count - 1; i; i--)
{
thiz->subtables[i - 1].digest_rest.add (thiz->subtables[i].digest);
thiz->subtables[i - 1].digest_rest.add (thiz->subtables[i].digest_rest);
}
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE #ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
thiz->cache_user_idx = c_accelerate_subtables.cache_user_idx; thiz->cache_user_idx = c_accelerate_subtables.cache_user_idx;
@ -4358,23 +4365,28 @@ struct hb_ot_layout_lookup_accelerator_t
#endif #endif
bool apply (hb_ot_apply_context_t *c, unsigned subtables_count, bool use_cache) const bool apply (hb_ot_apply_context_t *c, unsigned subtables_count, bool use_cache) const
{ {
hb_codepoint_t g = c->buffer->cur().codepoint;
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE #ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
if (use_cache) if (use_cache)
{ {
return for (const auto &subtable : hb_iter (subtables, subtables_count))
+ hb_iter (hb_iter (subtables, subtables_count)) {
| hb_map ([&c] (const hb_accelerate_subtables_context_t::hb_applicable_t &_) { return _.apply_cached (c); }) if (subtable.apply_cached (c))
| hb_any return true;
; if (!subtable.digest_rest.may_have (g))
return false;
}
} }
else else
#endif #endif
{ {
return for (const auto &subtable : hb_iter (subtables, subtables_count))
+ hb_iter (hb_iter (subtables, subtables_count)) {
| hb_map ([&c] (const hb_accelerate_subtables_context_t::hb_applicable_t &_) { return _.apply (c); }) if (subtable.apply (c))
| hb_any return true;
; if (!subtable.digest_rest.may_have (g))
return false;
}
} }
return false; return false;
} }

Loading…
Cancel
Save