Use hb_zip() some moore

This commit is contained in:
Behdad Esfahbod 2019-01-09 10:01:28 -08:00
parent 83ad0b6d0f
commit af6c190235
1 changed files with 14 additions and 38 deletions

View File

@ -1436,16 +1436,10 @@ struct ContextFormat1
{intersects_glyph}, {intersects_glyph},
nullptr nullptr
}; };
for (auto it = hb_zip (this+coverage, ruleSet); it; ++it)
unsigned int count = ruleSet.len; if (glyphs->has (it->first))
for (/*TODO(C++11)auto*/Coverage::iter_t iter = (this+coverage).iter (); iter; iter++) if ((this+it->second).intersects (glyphs, lookup_context))
{ return true;
if (unlikely (iter.get_coverage () >= count))
break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */
if (glyphs->has (iter.get_glyph ()) &&
(this+ruleSet[iter.get_coverage ()]).intersects (glyphs, lookup_context))
return true;
}
return false; return false;
} }
@ -1455,15 +1449,9 @@ struct ContextFormat1
{intersects_glyph}, {intersects_glyph},
nullptr nullptr
}; };
for (auto it = hb_zip (this+coverage, ruleSet); it; ++it)
unsigned int count = ruleSet.len; if (c->glyphs->has (it->first))
for (/*TODO(C++11)auto*/Coverage::iter_t iter = (this+coverage).iter (); iter; iter++) (this+it->second).closure (c, lookup_context);
{
if (unlikely (iter.get_coverage () >= count))
break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */
if (c->glyphs->has (iter.get_glyph ()))
(this+ruleSet[iter.get_coverage ()]).closure (c, lookup_context);
}
} }
void collect_glyphs (hb_collect_glyphs_context_t *c) const void collect_glyphs (hb_collect_glyphs_context_t *c) const
@ -2089,16 +2077,10 @@ struct ChainContextFormat1
{intersects_glyph}, {intersects_glyph},
{nullptr, nullptr, nullptr} {nullptr, nullptr, nullptr}
}; };
for (auto it = hb_zip (this+coverage, ruleSet); it; ++it)
unsigned int count = ruleSet.len; if (glyphs->has (it->first))
for (/*TODO(C++11)auto*/Coverage::iter_t iter = (this+coverage).iter (); iter; iter++) if ((this+it->second).intersects (glyphs, lookup_context))
{ return true;
if (unlikely (iter.get_coverage () >= count))
break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */
if (glyphs->has (iter.get_glyph ()) &&
(this+ruleSet[iter.get_coverage ()]).intersects (glyphs, lookup_context))
return true;
}
return false; return false;
} }
@ -2108,15 +2090,9 @@ struct ChainContextFormat1
{intersects_glyph}, {intersects_glyph},
{nullptr, nullptr, nullptr} {nullptr, nullptr, nullptr}
}; };
for (auto it = hb_zip (this+coverage, ruleSet); it; ++it)
unsigned int count = ruleSet.len; if (c->glyphs->has (it->first))
for (/*TODO(C++11)auto*/Coverage::iter_t iter = (this+coverage).iter (); iter; iter++) (this+it->second).closure (c, lookup_context);
{
if (unlikely (iter.get_coverage () >= count))
break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */
if (c->glyphs->has (iter.get_glyph ()))
(this+ruleSet[iter.get_coverage ()]).closure (c, lookup_context);
}
} }
void collect_glyphs (hb_collect_glyphs_context_t *c) const void collect_glyphs (hb_collect_glyphs_context_t *c) const