From d54902c6598045112374f1f51e1775677dd77d94 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 11 Jan 2023 12:29:25 -0700 Subject: [PATCH] [subset-plan] Simplify axes_old_index_tag_map allocation --- src/hb-ot-var-fvar-table.hh | 2 +- src/hb-subset-plan.cc | 5 ++--- src/hb-subset-plan.hh | 3 +-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/hb-ot-var-fvar-table.hh b/src/hb-ot-var-fvar-table.hh index 2c989e241..398c024c2 100644 --- a/src/hb-ot-var-fvar-table.hh +++ b/src/hb-ot-var-fvar-table.hh @@ -61,7 +61,7 @@ struct InstanceRecord { uint32_t *axis_tag; // only keep instances whose coordinates == pinned axis location - if (!c->plan->axes_old_index_tag_map->has (i, &axis_tag)) continue; + if (!c->plan->axes_old_index_tag_map.has (i, &axis_tag)) continue; if (axes_location->has (*axis_tag) && fabsf (axes_location->get (*axis_tag) - coords[i].to_float ()) > 0.001f) diff --git a/src/hb-subset-plan.cc b/src/hb-subset-plan.cc index 3d8e0038e..1f124dcb9 100644 --- a/src/hb-subset-plan.cc +++ b/src/hb-subset-plan.cc @@ -165,7 +165,7 @@ static void _collect_layout_indices (hb_subset_plan_t *plan, hb_hashmap_t, unsigned> conditionset_map; OT::hb_collect_feature_substitutes_with_var_context_t c = { - plan->axes_old_index_tag_map, + &plan->axes_old_index_tag_map, plan->axes_location, feature_record_cond_idx_map, feature_substitutes_map, @@ -782,7 +782,7 @@ _normalize_axes_location (hb_face_t *face, hb_subset_plan_t *plan) for (const auto& axis : axes) { hb_tag_t axis_tag = axis.get_axis_tag (); - plan->axes_old_index_tag_map->set (old_axis_idx, axis_tag); + plan->axes_old_index_tag_map.set (old_axis_idx, axis_tag); if (!plan->user_axes_location->has (axis_tag)) { @@ -862,7 +862,6 @@ hb_subset_plan_create_or_fail (hb_face_t *face, if (plan->user_axes_location && input->axes_location) *plan->user_axes_location = *input->axes_location; plan->check_success (plan->axes_index_map = hb_map_create ()); - plan->check_success (plan->axes_old_index_tag_map = hb_map_create ()); plan->all_axes_pinned = false; plan->pinned_at_default = true; diff --git a/src/hb-subset-plan.hh b/src/hb-subset-plan.hh index aea2201bc..508b5aca3 100644 --- a/src/hb-subset-plan.hh +++ b/src/hb-subset-plan.hh @@ -56,7 +56,6 @@ struct hb_subset_plan_t hb_map_destroy (reverse_glyph_map); hb_map_destroy (axes_index_map); - hb_map_destroy (axes_old_index_tag_map); hb_hashmap_destroy (axes_location); hb_hashmap_destroy (user_axes_location); @@ -163,7 +162,7 @@ struct hb_subset_plan_t //retained old axis index -> new axis index mapping in fvar axis array hb_map_t *axes_index_map; //axis_index->axis_tag mapping in fvar axis array - hb_map_t *axes_old_index_tag_map; + hb_map_t axes_old_index_tag_map; bool all_axes_pinned; bool pinned_at_default; bool has_seac;