Revert "[subset/loca] Build in the serializer memory"

This reverts commit 546b518186.
pull/4264/head
Behdad Esfahbod 1 year ago
parent 546b518186
commit 38fa032330
  1. 13
      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<void> (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;
}

Loading…
Cancel
Save