[aat] Allocate set dynamically

pull/714/head
Behdad Esfahbod 7 years ago
parent 4c4a9fc861
commit 461a605fde
  1. 21
      src/hb-aat-layout-common-private.hh

@ -615,14 +615,12 @@ struct StateTableDriver
machine (machine_), machine (machine_),
buffer (buffer_), buffer (buffer_),
num_glyphs (face_->get_num_glyphs ()), num_glyphs (face_->get_num_glyphs ()),
last_zero (0) last_zero (0),
{ dont_advance_set (nullptr) {}
dont_advance_set.init ();
}
inline ~StateTableDriver (void) inline ~StateTableDriver (void)
{ {
dont_advance_set.finish (); hb_set_destroy (dont_advance_set);
} }
template <typename context_t> template <typename context_t>
@ -650,12 +648,17 @@ struct StateTableDriver
if (entry->flags & context_t::DontAdvance) if (entry->flags & context_t::DontAdvance)
{ {
if (!last_was_dont_advance) if (!last_was_dont_advance)
dont_advance_set.clear (); {
if (dont_advance_set)
dont_advance_set->clear ();
else
dont_advance_set = hb_set_create ();
}
unsigned int key = info[buffer->idx].codepoint | (state << 16); unsigned int key = info[buffer->idx].codepoint | (state << 16);
if (likely (!dont_advance_set.has (key))) if (likely (!dont_advance_set->has (key)))
{ {
dont_advance_set.add (key); dont_advance_set->add (key);
last_was_dont_advance = true; last_was_dont_advance = true;
} }
else else
@ -684,7 +687,7 @@ struct StateTableDriver
unsigned int last_zero; unsigned int last_zero;
private: private:
hb_set_t dont_advance_set; /* Infinite-loop detection */ hb_set_t *dont_advance_set; /* Infinite-loop detection */
}; };

Loading…
Cancel
Save