[layout] Don't init iters successively multiple times

This commit is contained in:
Behdad Esfahbod 2023-05-03 16:56:52 -06:00
parent 959f16343b
commit 3f2401e2f1
2 changed files with 9 additions and 8 deletions

View file

@ -772,10 +772,10 @@ struct hb_ot_apply_context_t :
iter_context.init (this, true);
}
void set_lookup_mask (hb_mask_t mask) { lookup_mask = mask; last_base = -1; last_base_until = 0; init_iters (); }
void set_auto_zwj (bool auto_zwj_) { auto_zwj = auto_zwj_; init_iters (); }
void set_auto_zwnj (bool auto_zwnj_) { auto_zwnj = auto_zwnj_; init_iters (); }
void set_per_syllable (bool per_syllable_) { per_syllable = per_syllable_; init_iters (); }
void set_lookup_mask (hb_mask_t mask, bool init = true) { lookup_mask = mask; last_base = -1; last_base_until = 0; if (init) init_iters (); }
void set_auto_zwj (bool auto_zwj_, bool init = true) { auto_zwj = auto_zwj_; if (init) init_iters (); }
void set_auto_zwnj (bool auto_zwnj_, bool init = true) { auto_zwnj = auto_zwnj_; if (init) init_iters (); }
void set_per_syllable (bool per_syllable_, bool init = true) { per_syllable = per_syllable_; if (init) init_iters (); }
void set_random (bool random_) { random = random_; }
void set_recurse_func (recurse_func_t func) { recurse_func = func; }
void set_lookup_index (unsigned int lookup_index_) { lookup_index = lookup_index_; }

View file

@ -1978,11 +1978,12 @@ inline void hb_ot_map_t::apply (const Proxy &proxy,
if (accel->digest.may_have (c.digest))
{
c.set_lookup_index (lookup_index);
c.set_lookup_mask (lookup.mask);
c.set_auto_zwj (lookup.auto_zwj);
c.set_auto_zwnj (lookup.auto_zwnj);
c.set_lookup_mask (lookup.mask, false);
c.set_auto_zwj (lookup.auto_zwj, false);
c.set_auto_zwnj (lookup.auto_zwnj, false);
c.set_random (lookup.random);
c.set_per_syllable (lookup.per_syllable);
c.set_per_syllable (lookup.per_syllable, false);
/* apply_string's set_lookup_props initializes the iterators. */
apply_string<Proxy> (&c,
proxy.accel.table->get_lookup (lookup_index),