Move apply down into subtables accel

This commit is contained in:
Behdad Esfahbod 2018-10-10 11:54:48 -04:00
parent 78c09bf213
commit e78549edfb
2 changed files with 12 additions and 15 deletions

View File

@ -2632,7 +2632,15 @@ struct hb_ot_layout_lookup_accelerator_t
inline bool may_have (hb_codepoint_t g) const
{ return digest.may_have (g); }
public:
inline bool apply (hb_ot_apply_context_t *c) const
{
for (unsigned int i = 0; i < subtables.len; i++)
if (subtables[i].apply (c))
return true;
return false;
}
private:
hb_set_digest_t digest;
hb_get_subtables_context_t::array_t subtables;
};

View File

@ -1118,7 +1118,6 @@ apply_forward (OT::hb_ot_apply_context_t *c,
{
bool ret = false;
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)
{
bool applied = false;
@ -1126,12 +1125,7 @@ apply_forward (OT::hb_ot_apply_context_t *c,
(buffer->cur().mask & c->lookup_mask) &&
c->check_glyph_property (&buffer->cur(), c->lookup_props))
{
for (unsigned int i = 0; i < subtables.len; i++)
if (subtables[i].apply (c))
{
applied = true;
break;
}
applied = accel.apply (c);
}
if (applied)
@ -1148,19 +1142,14 @@ apply_backward (OT::hb_ot_apply_context_t *c,
{
bool ret = false;
hb_buffer_t *buffer = c->buffer;
const OT::hb_get_subtables_context_t::array_t &subtables = accel.subtables;
do
{
if (accel.may_have (buffer->cur().codepoint) &&
(buffer->cur().mask & c->lookup_mask) &&
c->check_glyph_property (&buffer->cur(), c->lookup_props))
{
for (unsigned int i = 0; i < subtables.len; i++)
if (subtables[i].apply (c))
{
ret = true;
break;
}
if (accel.apply (c))
ret = true;
}
/* The reverse lookup doesn't "advance" cursor (for good reason). */
buffer->idx--;