[subset-plan] Simplify axes_index_map allocation
This commit is contained in:
parent
8265277c2e
commit
60418fcb95
|
@ -2838,7 +2838,7 @@ struct ConditionFormat1
|
||||||
auto *out = c->serializer->embed (this);
|
auto *out = c->serializer->embed (this);
|
||||||
if (unlikely (!out)) return_trace (false);
|
if (unlikely (!out)) return_trace (false);
|
||||||
|
|
||||||
const hb_map_t *index_map = c->plan->axes_index_map;
|
const hb_map_t *index_map = &c->plan->axes_index_map;
|
||||||
if (index_map->is_empty ()) return_trace (true);
|
if (index_map->is_empty ()) return_trace (true);
|
||||||
|
|
||||||
if (!index_map->has (axisIndex))
|
if (!index_map->has (axisIndex))
|
||||||
|
|
|
@ -67,7 +67,7 @@ struct InstanceRecord
|
||||||
fabsf (axes_location->get (*axis_tag) - coords[i].to_float ()) > 0.001f)
|
fabsf (axes_location->get (*axis_tag) - coords[i].to_float ()) > 0.001f)
|
||||||
return_trace (false);
|
return_trace (false);
|
||||||
|
|
||||||
if (!c->plan->axes_index_map->has (i))
|
if (!c->plan->axes_index_map.has (i))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!c->serializer->embed (coords[i]))
|
if (!c->serializer->embed (coords[i]))
|
||||||
|
@ -362,7 +362,7 @@ struct fvar
|
||||||
bool subset (hb_subset_context_t *c) const
|
bool subset (hb_subset_context_t *c) const
|
||||||
{
|
{
|
||||||
TRACE_SUBSET (this);
|
TRACE_SUBSET (this);
|
||||||
unsigned retained_axis_count = c->plan->axes_index_map->get_population ();
|
unsigned retained_axis_count = c->plan->axes_index_map.get_population ();
|
||||||
if (!retained_axis_count) //all axes are pinned
|
if (!retained_axis_count) //all axes are pinned
|
||||||
return_trace (false);
|
return_trace (false);
|
||||||
|
|
||||||
|
@ -383,7 +383,7 @@ struct fvar
|
||||||
auto axes_records = get_axes ();
|
auto axes_records = get_axes ();
|
||||||
for (unsigned i = 0 ; i < (unsigned)axisCount; i++)
|
for (unsigned i = 0 ; i < (unsigned)axisCount; i++)
|
||||||
{
|
{
|
||||||
if (!c->plan->axes_index_map->has (i)) continue;
|
if (!c->plan->axes_index_map.has (i)) continue;
|
||||||
if (unlikely (!c->serializer->embed (axes_records[i])))
|
if (unlikely (!c->serializer->embed (axes_records[i])))
|
||||||
return_trace (false);
|
return_trace (false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -787,7 +787,7 @@ _normalize_axes_location (hb_face_t *face, hb_subset_plan_t *plan)
|
||||||
if (!plan->user_axes_location->has (axis_tag))
|
if (!plan->user_axes_location->has (axis_tag))
|
||||||
{
|
{
|
||||||
axis_not_pinned = true;
|
axis_not_pinned = true;
|
||||||
plan->axes_index_map->set (old_axis_idx, new_axis_idx);
|
plan->axes_index_map.set (old_axis_idx, new_axis_idx);
|
||||||
new_axis_idx++;
|
new_axis_idx++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -860,7 +860,6 @@ hb_subset_plan_create_or_fail (hb_face_t *face,
|
||||||
plan->check_success (plan->user_axes_location = hb_hashmap_create<hb_tag_t, float> ());
|
plan->check_success (plan->user_axes_location = hb_hashmap_create<hb_tag_t, float> ());
|
||||||
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->all_axes_pinned = false;
|
plan->all_axes_pinned = false;
|
||||||
plan->pinned_at_default = true;
|
plan->pinned_at_default = true;
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,6 @@ struct hb_subset_plan_t
|
||||||
hb_map_destroy (glyph_map);
|
hb_map_destroy (glyph_map);
|
||||||
hb_map_destroy (reverse_glyph_map);
|
hb_map_destroy (reverse_glyph_map);
|
||||||
|
|
||||||
hb_map_destroy (axes_index_map);
|
|
||||||
hb_hashmap_destroy (user_axes_location);
|
hb_hashmap_destroy (user_axes_location);
|
||||||
|
|
||||||
#ifdef HB_EXPERIMENTAL_API
|
#ifdef HB_EXPERIMENTAL_API
|
||||||
|
@ -159,7 +158,7 @@ struct hb_subset_plan_t
|
||||||
//user specified axes location map
|
//user specified axes location map
|
||||||
hb_hashmap_t<hb_tag_t, float> *user_axes_location;
|
hb_hashmap_t<hb_tag_t, float> *user_axes_location;
|
||||||
//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;
|
||||||
|
|
Loading…
Reference in New Issue