Move subtable array into lookup accel

This commit is contained in:
Behdad Esfahbod 2018-10-10 11:50:46 -04:00
parent 97e5913d5a
commit 78c09bf213
3 changed files with 18 additions and 14 deletions

View File

@ -36,7 +36,7 @@
/* Global nul-content Null pool. Enlarge as necessary. */ /* Global nul-content Null pool. Enlarge as necessary. */
#define HB_NULL_POOL_SIZE 264 #define HB_NULL_POOL_SIZE 512
extern HB_INTERNAL extern HB_INTERNAL
hb_vector_size_impl_t const _hb_NullPool[(HB_NULL_POOL_SIZE + sizeof (hb_vector_size_impl_t) - 1) / sizeof (hb_vector_size_impl_t)]; hb_vector_size_impl_t const _hb_NullPool[(HB_NULL_POOL_SIZE + sizeof (hb_vector_size_impl_t) - 1) / sizeof (hb_vector_size_impl_t)];

View File

@ -286,7 +286,7 @@ struct hb_get_subtables_context_t :
hb_apply_func_t apply_func; hb_apply_func_t apply_func;
}; };
typedef hb_auto_t<hb_vector_t<hb_applicable_t> > array_t; typedef hb_vector_t<hb_applicable_t, 2> array_t;
/* Dispatch interface. */ /* Dispatch interface. */
inline const char *get_name (void) { return "GET_SUBTABLES"; } inline const char *get_name (void) { return "GET_SUBTABLES"; }
@ -2619,14 +2619,22 @@ struct hb_ot_layout_lookup_accelerator_t
{ {
digest.init (); digest.init ();
lookup.add_coverage (&digest); lookup.add_coverage (&digest);
subtables.init ();
OT::hb_get_subtables_context_t c_get_subtables (subtables);
lookup.dispatch (&c_get_subtables);
}
inline void fini (void)
{
subtables.fini ();
} }
inline void fini (void) {}
inline bool may_have (hb_codepoint_t g) const inline bool may_have (hb_codepoint_t g) const
{ return digest.may_have (g); } { return digest.may_have (g); }
private: public:
hb_set_digest_t digest; hb_set_digest_t digest;
hb_get_subtables_context_t::array_t subtables;
}; };
struct GSUBGPOS struct GSUBGPOS

View File

@ -1114,11 +1114,11 @@ struct GPOSProxy
static inline bool static inline bool
apply_forward (OT::hb_ot_apply_context_t *c, apply_forward (OT::hb_ot_apply_context_t *c,
const OT::hb_ot_layout_lookup_accelerator_t &accel, const OT::hb_ot_layout_lookup_accelerator_t &accel)
const OT::hb_get_subtables_context_t::array_t &subtables)
{ {
bool ret = false; bool ret = false;
hb_buffer_t *buffer = c->buffer; hb_buffer_t *buffer = c->buffer;
const OT::hb_get_subtables_context_t::array_t &subtables = accel.subtables;
while (buffer->idx < buffer->len && buffer->successful) while (buffer->idx < buffer->len && buffer->successful)
{ {
bool applied = false; bool applied = false;
@ -1144,11 +1144,11 @@ apply_forward (OT::hb_ot_apply_context_t *c,
static inline bool static inline bool
apply_backward (OT::hb_ot_apply_context_t *c, apply_backward (OT::hb_ot_apply_context_t *c,
const OT::hb_ot_layout_lookup_accelerator_t &accel, const OT::hb_ot_layout_lookup_accelerator_t &accel)
const OT::hb_get_subtables_context_t::array_t &subtables)
{ {
bool ret = false; bool ret = false;
hb_buffer_t *buffer = c->buffer; hb_buffer_t *buffer = c->buffer;
const OT::hb_get_subtables_context_t::array_t &subtables = accel.subtables;
do do
{ {
if (accel.may_have (buffer->cur().codepoint) && if (accel.may_have (buffer->cur().codepoint) &&
@ -1183,10 +1183,6 @@ apply_string (OT::hb_ot_apply_context_t *c,
c->set_lookup_props (lookup.get_props ()); c->set_lookup_props (lookup.get_props ());
OT::hb_get_subtables_context_t::array_t subtables;
OT::hb_get_subtables_context_t c_get_subtables (subtables);
lookup.dispatch (&c_get_subtables);
if (likely (!lookup.is_reverse ())) if (likely (!lookup.is_reverse ()))
{ {
/* in/out forward substitution/positioning */ /* in/out forward substitution/positioning */
@ -1195,7 +1191,7 @@ apply_string (OT::hb_ot_apply_context_t *c,
buffer->idx = 0; buffer->idx = 0;
bool ret; bool ret;
ret = apply_forward (c, accel, subtables); ret = apply_forward (c, accel);
if (ret) if (ret)
{ {
if (!Proxy::inplace) if (!Proxy::inplace)
@ -1211,7 +1207,7 @@ apply_string (OT::hb_ot_apply_context_t *c,
buffer->remove_output (); buffer->remove_output ();
buffer->idx = buffer->len - 1; buffer->idx = buffer->len - 1;
apply_backward (c, accel, subtables); apply_backward (c, accel);
} }
} }