From acab716b1c8b1a071d0551f8e4df07444b2c0446 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 3 Jun 2023 21:15:36 -0600 Subject: [PATCH] [subset/hvar] Speed up for retaingids --- src/hb-ot-var-hvar-table.hh | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/hb-ot-var-hvar-table.hh b/src/hb-ot-var-hvar-table.hh index 461b2b9cd..c6eb8831b 100644 --- a/src/hb-ot-var-hvar-table.hh +++ b/src/hb-ot-var-hvar-table.hh @@ -89,19 +89,19 @@ struct index_map_subset_plan_t if (unlikely (last_gid == (hb_codepoint_t)-1)) return; map_count = last_gid; - for (gid = 0; gid < map_count; gid++) + for (auto _ : plan->new_to_old_gid_list) { - hb_codepoint_t old_gid; - if (plan->old_gid_for_new_gid (gid, &old_gid)) - { - unsigned int v = index_map.map (old_gid); - unsigned int outer = v >> 16; - unsigned int inner = v & 0xFFFF; - outer_map.add (outer); - if (inner > max_inners[outer]) max_inners[outer] = inner; - if (outer >= inner_sets.length) return; - inner_sets[outer]->add (inner); - } + hb_codepoint_t gid = _.first; + if (gid >= map_count) break; + + hb_codepoint_t old_gid = _.second; + unsigned int v = index_map.map (old_gid); + unsigned int outer = v >> 16; + unsigned int inner = v & 0xFFFF; + outer_map.add (outer); + if (inner > max_inners[outer]) max_inners[outer] = inner; + if (outer >= inner_sets.length) return; + inner_sets[outer]->add (inner); } }