mirror of
https://github.com/harfbuzz/harfbuzz.git
synced 2025-04-13 08:42:59 +00:00
Clean accelerators a bit more
This commit is contained in:
parent
0ae6659398
commit
ae9fc7f533
5 changed files with 12 additions and 19 deletions
|
@ -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<COLR> (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 */
|
||||
|
||||
|
||||
|
|
|
@ -587,14 +587,14 @@ struct GDEF
|
|||
{
|
||||
accelerator_t (hb_face_t *face)
|
||||
{
|
||||
this->table = hb_sanitize_context_t ().reference_table<GDEF> (face);
|
||||
if (unlikely (this->table->is_blocklisted (this->table.get_blob (), face)))
|
||||
table = hb_sanitize_context_t ().reference_table<GDEF> (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<GDEF> table;
|
||||
};
|
||||
|
|
|
@ -288,7 +288,6 @@ struct name
|
|||
const hb_array_t<const NameRecord> 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 ();
|
||||
}
|
||||
|
||||
|
|
|
@ -114,8 +114,6 @@ struct post
|
|||
|
||||
accelerator_t (hb_face_t *face)
|
||||
{
|
||||
index_to_offset.init ();
|
||||
|
||||
table = hb_sanitize_context_t ().reference_table<post> (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 ();
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue