[subset-plan] Simplify axes_old_index_tag_map allocation

This commit is contained in:
Behdad Esfahbod 2023-01-11 12:29:25 -07:00
parent 9f4c8fb700
commit d54902c659
3 changed files with 4 additions and 6 deletions

View File

@ -61,7 +61,7 @@ struct InstanceRecord
{ {
uint32_t *axis_tag; uint32_t *axis_tag;
// only keep instances whose coordinates == pinned axis location // 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) && if (axes_location->has (*axis_tag) &&
fabsf (axes_location->get (*axis_tag) - coords[i].to_float ()) > 0.001f) fabsf (axes_location->get (*axis_tag) - coords[i].to_float ()) > 0.001f)

View File

@ -165,7 +165,7 @@ static void _collect_layout_indices (hb_subset_plan_t *plan,
hb_hashmap_t<hb::shared_ptr<hb_map_t>, unsigned> conditionset_map; hb_hashmap_t<hb::shared_ptr<hb_map_t>, unsigned> conditionset_map;
OT::hb_collect_feature_substitutes_with_var_context_t c = 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, plan->axes_location,
feature_record_cond_idx_map, feature_record_cond_idx_map,
feature_substitutes_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) for (const auto& axis : axes)
{ {
hb_tag_t axis_tag = axis.get_axis_tag (); 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)) 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) if (plan->user_axes_location && input->axes_location)
*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_index_map = hb_map_create ());
plan->check_success (plan->axes_old_index_tag_map = hb_map_create ());
plan->all_axes_pinned = false; plan->all_axes_pinned = false;
plan->pinned_at_default = true; plan->pinned_at_default = true;

View File

@ -56,7 +56,6 @@ struct hb_subset_plan_t
hb_map_destroy (reverse_glyph_map); hb_map_destroy (reverse_glyph_map);
hb_map_destroy (axes_index_map); hb_map_destroy (axes_index_map);
hb_map_destroy (axes_old_index_tag_map);
hb_hashmap_destroy (axes_location); hb_hashmap_destroy (axes_location);
hb_hashmap_destroy (user_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 //retained old axis index -> new axis index mapping in fvar axis array
hb_map_t *axes_index_map; hb_map_t *axes_index_map;
//axis_index->axis_tag mapping in fvar axis array //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 all_axes_pinned;
bool pinned_at_default; bool pinned_at_default;
bool has_seac; bool has_seac;