diff --git a/src/hb-ot-color-colr-table.hh b/src/hb-ot-color-colr-table.hh index 977b1ab0f..dac755c02 100644 --- a/src/hb-ot-color-colr-table.hh +++ b/src/hb-ot-color-colr-table.hh @@ -1270,13 +1270,9 @@ struct COLR struct accelerator_t { - accelerator_t () {} - ~accelerator_t () { fini (); } - - void init (hb_face_t *face) + accelerator_t (hb_face_t *face) { colr = hb_sanitize_context_t ().reference_table (face); } - - void fini () { this->colr.destroy (); } + ~accelerator_t () { this->colr.destroy (); } bool is_valid () { return colr.get_blob ()->length; } @@ -1535,6 +1531,10 @@ struct COLR DEFINE_SIZE_MIN (14); }; +struct COLR_accelerator_t : COLR::accelerator_t { + COLR_accelerator_t (hb_face_t *face) : COLR::accelerator_t (face) {} +}; + } /* namespace OT */ diff --git a/src/hb-ot-layout-gdef-table.hh b/src/hb-ot-layout-gdef-table.hh index 3fe6a5bc3..a76d644c4 100644 --- a/src/hb-ot-layout-gdef-table.hh +++ b/src/hb-ot-layout-gdef-table.hh @@ -587,14 +587,14 @@ struct GDEF { accelerator_t (hb_face_t *face) { - this->table = hb_sanitize_context_t ().reference_table (face); - if (unlikely (this->table->is_blocklisted (this->table.get_blob (), face))) + table = hb_sanitize_context_t ().reference_table (face); + if (unlikely (table->is_blocklisted (table.get_blob (), face))) { - hb_blob_destroy (this->table.get_blob ()); - this->table = hb_blob_get_empty (); + hb_blob_destroy (table.get_blob ()); + table = hb_blob_get_empty (); } } - ~accelerator_t () { this->table.destroy (); } + ~accelerator_t () { table.destroy (); } hb_blob_ptr_t table; }; diff --git a/src/hb-ot-name-table.hh b/src/hb-ot-name-table.hh index d555fc1a5..d52367e9b 100644 --- a/src/hb-ot-name-table.hh +++ b/src/hb-ot-name-table.hh @@ -288,7 +288,6 @@ struct name const hb_array_t all_names (this->table->nameRecordZ.arrayZ, this->table->count); - this->names.init (); this->names.alloc (all_names.length); for (unsigned int i = 0; i < all_names.length; i++) @@ -320,7 +319,6 @@ struct name } ~accelerator_t () { - this->names.fini (); this->table.destroy (); } diff --git a/src/hb-ot-post-table.hh b/src/hb-ot-post-table.hh index 0610ee6d7..f72a6ff03 100644 --- a/src/hb-ot-post-table.hh +++ b/src/hb-ot-post-table.hh @@ -114,8 +114,6 @@ struct post accelerator_t (hb_face_t *face) { - index_to_offset.init (); - table = hb_sanitize_context_t ().reference_table (face); unsigned int table_length = table.get_length (); @@ -135,7 +133,6 @@ struct post } ~accelerator_t () { - index_to_offset.fini (); hb_free (gids_sorted_by_name.get ()); table.destroy (); } diff --git a/src/hb-subset-plan.cc b/src/hb-subset-plan.cc index b7afa8074..af4fcb813 100644 --- a/src/hb-subset-plan.cc +++ b/src/hb-subset-plan.cc @@ -237,8 +237,7 @@ static void _colr_closure (hb_face_t *face, hb_map_t *palettes_map, hb_set_t *glyphs_colred) { - OT::COLR::accelerator_t colr; - colr.init (face); + OT::COLR::accelerator_t colr (face); if (!colr.is_valid ()) return; unsigned iteration_count = 0; @@ -261,7 +260,6 @@ static void _colr_closure (hb_face_t *face, colr.closure_V0palette_indices (glyphs_colred, &palette_indices); _remap_indexes (&layer_indices, layers_map); _remap_palette_indexes (&palette_indices, palettes_map); - colr.fini (); } static inline void