From 5fc91de2c0f32f0e067950ce004f498a378690e9 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 11 Jan 2023 11:04:17 -0700 Subject: [PATCH] [shape-plan] Simplify _glyphset_colred allocation --- src/OT/Color/COLR/COLR.hh | 6 +++--- src/hb-subset-plan.cc | 3 +-- src/hb-subset-plan.hh | 3 +-- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/OT/Color/COLR/COLR.hh b/src/OT/Color/COLR/COLR.hh index d1f96a5c4..318ca114f 100644 --- a/src/OT/Color/COLR/COLR.hh +++ b/src/OT/Color/COLR/COLR.hh @@ -1456,7 +1456,7 @@ struct ClipList if (unlikely (!c->serializer->extend_min (out))) return_trace (false); if (!c->serializer->check_assign (out->format, format, HB_SERIALIZE_ERROR_INT_OVERFLOW)) return_trace (false); - const hb_set_t& glyphset = *c->plan->_glyphset_colred; + const hb_set_t& glyphset = c->plan->_glyphset_colred; const hb_map_t &glyph_map = *c->plan->glyph_map; hb_map_t new_gid_offset_map; @@ -1641,7 +1641,7 @@ struct BaseGlyphList : SortedArray32Of TRACE_SUBSET (this); auto *out = c->serializer->start_embed (this); if (unlikely (!c->serializer->extend_min (out))) return_trace (false); - const hb_set_t* glyphset = c->plan->_glyphset_colred; + const hb_set_t* glyphset = &c->plan->_glyphset_colred; for (const auto& _ : as_array ()) { @@ -1882,7 +1882,7 @@ struct COLR TRACE_SUBSET (this); const hb_map_t &reverse_glyph_map = *c->plan->reverse_glyph_map; - const hb_set_t& glyphset = *c->plan->_glyphset_colred; + const hb_set_t& glyphset = c->plan->_glyphset_colred; auto base_it = + hb_range (c->plan->num_output_glyphs ()) diff --git a/src/hb-subset-plan.cc b/src/hb-subset-plan.cc index 40077be2f..e6a0a2101 100644 --- a/src/hb-subset-plan.cc +++ b/src/hb-subset-plan.cc @@ -661,7 +661,7 @@ _populate_gids_to_retain (hb_subset_plan_t* plan, _remove_invalid_gids (&cur_glyphset, plan->source->get_num_glyphs ()); } - hb_set_set (plan->_glyphset_colred, &cur_glyphset); + plan->_glyphset_colred = cur_glyphset; /* Populate a full set of glyphs to retain by adding all referenced * composite glyphs. */ @@ -852,7 +852,6 @@ hb_subset_plan_create_or_fail (hb_face_t *face, plan->source = hb_face_reference (face); plan->dest = hb_face_builder_create (); - plan->_glyphset_colred = hb_set_create (); plan->codepoint_to_glyph = hb_map_create (); plan->glyph_map = hb_map_create (); plan->reverse_glyph_map = hb_map_create (); diff --git a/src/hb-subset-plan.hh b/src/hb-subset-plan.hh index be4d481aa..f9f2bafcb 100644 --- a/src/hb-subset-plan.hh +++ b/src/hb-subset-plan.hh @@ -58,7 +58,6 @@ struct hb_subset_plan_t hb_map_destroy (glyph_map); hb_map_destroy (reverse_glyph_map); hb_map_destroy (glyph_map_gsub); - hb_set_destroy (_glyphset_colred); hb_map_destroy (colrv1_layers); hb_map_destroy (colr_palettes); hb_map_destroy (axes_index_map); @@ -143,7 +142,7 @@ struct hb_subset_plan_t hb_set_t _glyphset; hb_set_t _glyphset_gsub; hb_set_t _glyphset_mathed; - hb_set_t *_glyphset_colred; + hb_set_t _glyphset_colred; //active lookups we'd like to retain hb_map_t gsub_lookups;