[subset-plan] Simplify sanitized_table_cache allocation

This commit is contained in:
Behdad Esfahbod 2023-01-11 11:13:49 -07:00
parent 9e24873c1e
commit 89905368ca
2 changed files with 2 additions and 4 deletions

View File

@ -862,7 +862,6 @@ hb_subset_plan_create_or_fail (hb_face_t *face,
plan->check_success (plan->layout_variation_idx_delta_map = hb_hashmap_create<unsigned, hb_pair_t<unsigned, int>> ()); plan->check_success (plan->layout_variation_idx_delta_map = hb_hashmap_create<unsigned, hb_pair_t<unsigned, int>> ());
plan->gdef_varstore_inner_maps.init (); plan->gdef_varstore_inner_maps.init ();
plan->check_success (plan->sanitized_table_cache = hb_hashmap_create<hb_tag_t, hb::unique_ptr<hb_blob_t>> ());
plan->check_success (plan->axes_location = hb_hashmap_create<hb_tag_t, int> ()); plan->check_success (plan->axes_location = hb_hashmap_create<hb_tag_t, int> ());
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)

View File

@ -64,7 +64,6 @@ struct hb_subset_plan_t
hb_map_destroy (axes_old_index_tag_map); hb_map_destroy (axes_old_index_tag_map);
hb_hashmap_destroy (axes_location); hb_hashmap_destroy (axes_location);
hb_hashmap_destroy (sanitized_table_cache);
hb_hashmap_destroy (hmtx_map); hb_hashmap_destroy (hmtx_map);
hb_hashmap_destroy (vmtx_map); hb_hashmap_destroy (vmtx_map);
hb_hashmap_destroy (layout_variation_idx_delta_map); hb_hashmap_destroy (layout_variation_idx_delta_map);
@ -169,7 +168,7 @@ struct hb_subset_plan_t
//gdef varstore retained varidx mapping //gdef varstore retained varidx mapping
hb_vector_t<hb_inc_bimap_t> gdef_varstore_inner_maps; hb_vector_t<hb_inc_bimap_t> gdef_varstore_inner_maps;
hb_hashmap_t<hb_tag_t, hb::unique_ptr<hb_blob_t>>* sanitized_table_cache; hb_hashmap_t<hb_tag_t, hb::unique_ptr<hb_blob_t>> sanitized_table_cache;
//normalized axes location map //normalized axes location map
hb_hashmap_t<hb_tag_t, int> *axes_location; hb_hashmap_t<hb_tag_t, int> *axes_location;
hb_vector_t<int> normalized_coords; hb_vector_t<int> normalized_coords;
@ -204,7 +203,7 @@ struct hb_subset_plan_t
{ {
hb_lock_t (accelerator ? &accelerator->sanitized_table_cache_lock : nullptr); hb_lock_t (accelerator ? &accelerator->sanitized_table_cache_lock : nullptr);
auto *cache = accelerator ? &accelerator->sanitized_table_cache : sanitized_table_cache; auto *cache = accelerator ? &accelerator->sanitized_table_cache : &sanitized_table_cache;
if (cache if (cache
&& !cache->in_error () && !cache->in_error ()
&& cache->has (+T::tableTag)) { && cache->has (+T::tableTag)) {