From 38fa0323303bf6c289314932ad4d41ac40734eac Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 3 Jun 2023 18:51:09 -0600 Subject: [PATCH] Revert "[subset/loca] Build in the serializer memory" This reverts commit 546b51818666ca1ddb01824f752eccbd6a751b4b. --- src/OT/glyf/glyf-helpers.hh | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/OT/glyf/glyf-helpers.hh b/src/OT/glyf/glyf-helpers.hh index 1ea66b6c0..844784045 100644 --- a/src/OT/glyf/glyf-helpers.hh +++ b/src/OT/glyf/glyf-helpers.hh @@ -88,10 +88,7 @@ _add_loca_and_head (hb_subset_context_t *c, unsigned num_offsets = c->plan->num_output_glyphs () + 1; unsigned entry_size = use_short_loca ? 2 : 4; - /* Use the serializer memory since it's hot in cache. */ - auto snapshot = c->serializer->snapshot (); - assert (c->serializer->length () == 0); - char *loca_prime_data = (char *) c->serializer->allocate_size (entry_size * num_offsets, false); + char *loca_prime_data = (char *) hb_malloc (entry_size * num_offsets); if (unlikely (!loca_prime_data)) return false; @@ -103,13 +100,15 @@ _add_loca_and_head (hb_subset_context_t *c, else _write_loca (padded_offsets, c->plan->new_to_old_gid_list, false, (HBUINT32 *) loca_prime_data, num_offsets); - hb_blob_t *loca_blob = c->serializer->copy_blob (); + hb_blob_t *loca_blob = hb_blob_create (loca_prime_data, + entry_size * num_offsets, + HB_MEMORY_MODE_WRITABLE, + loca_prime_data, + hb_free); bool result = c->plan->add_table (HB_OT_TAG_loca, loca_blob) && _add_head_and_set_loca_version (c->plan, use_short_loca); - c->serializer->revert (snapshot); - hb_blob_destroy (loca_blob); return result; }