mirror of
https://github.com/harfbuzz/harfbuzz.git
synced 2025-04-06 05:55:06 +00:00
[subset] Speed up a couple of set iteration loops
Need to speed up set::next_range() for the second one to have any effect.
This commit is contained in:
parent
326d319f93
commit
a56288488c
2 changed files with 16 additions and 4 deletions
|
@ -1937,13 +1937,22 @@ struct ClassDefFormat2_4
|
|||
{
|
||||
/* Match if there's any glyph that is not listed! */
|
||||
hb_codepoint_t g = HB_SET_VALUE_INVALID;
|
||||
for (auto &range : rangeRecord)
|
||||
hb_codepoint_t last = HB_SET_VALUE_INVALID;
|
||||
auto it = hb_iter (rangeRecord);
|
||||
for (auto &range : it)
|
||||
{
|
||||
if (it->first == last + 1)
|
||||
{
|
||||
it++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!glyphs->next (&g))
|
||||
break;
|
||||
if (g < range.first)
|
||||
return true;
|
||||
g = range.last;
|
||||
last = g;
|
||||
}
|
||||
if (g != HB_SET_VALUE_INVALID && glyphs->next (&g))
|
||||
return true;
|
||||
|
|
|
@ -605,11 +605,14 @@ _populate_unicodes_to_retain (const hb_set_t *unicodes,
|
|||
|
||||
/* Add gids which where requested, but not mapped in cmap */
|
||||
unsigned num_glyphs = plan->source->get_num_glyphs ();
|
||||
for (hb_codepoint_t gid : *glyphs)
|
||||
hb_codepoint_t first = HB_SET_VALUE_INVALID, last = HB_SET_VALUE_INVALID;
|
||||
for (; glyphs->next_range (&first, &last); )
|
||||
{
|
||||
if (gid >= num_glyphs)
|
||||
if (first >= num_glyphs)
|
||||
break;
|
||||
plan->_glyphset_gsub.add (gid);
|
||||
if (last >= num_glyphs)
|
||||
last = num_glyphs - 1;
|
||||
plan->_glyphset_gsub.add_range (first, last);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue