[algs] Add hb_iter()

Makes it nicer in pipelines.
This commit is contained in:
Behdad Esfahbod 2019-01-09 20:58:25 -08:00
parent 54ec48ea20
commit 420d8ac350
2 changed files with 7 additions and 3 deletions

View File

@ -31,6 +31,10 @@
#include "hb-null.hh" #include "hb-null.hh"
template <typename T>
inline typename T::iter_t
hb_iter (const T& c) { return c.iter (); }
static HB_UNUSED struct hb_identity_t static HB_UNUSED struct hb_identity_t
{ {
template <typename T> T template <typename T> T

View File

@ -46,7 +46,7 @@ struct SingleSubstFormat1
void closure (hb_closure_context_t *c) const void closure (hb_closure_context_t *c) const
{ {
for (auto it = (this+coverage).iter () for (auto it = hb_iter (this+coverage)
| hb_filter (*c->glyphs); it; ++it) | hb_filter (*c->glyphs); it; ++it)
c->output->add ((*it + deltaGlyphID) & 0xFFFFu); c->output->add ((*it + deltaGlyphID) & 0xFFFFu);
} }
@ -54,7 +54,7 @@ struct SingleSubstFormat1
void collect_glyphs (hb_collect_glyphs_context_t *c) const void collect_glyphs (hb_collect_glyphs_context_t *c) const
{ {
if (unlikely (!(this+coverage).add_coverage (c->input))) return; if (unlikely (!(this+coverage).add_coverage (c->input))) return;
for (auto it = (this+coverage).iter (); it; ++it) for (auto it = hb_iter (this+coverage); it; ++it)
c->output->add ((*it + deltaGlyphID) & 0xFFFFu); c->output->add ((*it + deltaGlyphID) & 0xFFFFu);
} }
@ -100,7 +100,7 @@ struct SingleSubstFormat1
hb_sorted_vector_t<GlyphID> from; hb_sorted_vector_t<GlyphID> from;
hb_vector_t<GlyphID> to; hb_vector_t<GlyphID> to;
hb_codepoint_t delta = deltaGlyphID; hb_codepoint_t delta = deltaGlyphID;
for (auto it = (this+coverage).iter () for (auto it = hb_iter (this+coverage)
| hb_filter (glyphset); it; ++it) | hb_filter (glyphset); it; ++it)
{ {
from.push ()->set (glyph_map[*it]); from.push ()->set (glyph_map[*it]);