[subset] Remove OffsetTo::serialize().

Convert remaining uses of it to serialize_serialize() which correctly uses the object packer.
This commit is contained in:
Garret Rieger 2021-06-29 14:23:37 -07:00 committed by Behdad Esfahbod
parent 0969614865
commit 0da9158f62
17 changed files with 12 additions and 14 deletions

View File

@ -328,10 +328,6 @@ struct OffsetTo : Offset<OffsetType, has_null>
hb_enable_if (hb_is_convertible (Base, void *))>
friend Type& operator + (OffsetTo &offset, Base &&base) { return offset ((void *) base); }
Type& serialize (hb_serialize_context_t *c, const void *base)
{
return * (Type *) Offset<OffsetType>::serialize (c, base);
}
template <typename ...Ts>
bool serialize_subset (hb_subset_context_t *c, const OffsetTo& src,

View File

@ -2790,8 +2790,8 @@ struct VariationStore
(src+src->dataSets[i]).collect_region_refs (region_map, inner_maps[i]);
region_map.sort ();
if (unlikely (!regions.serialize (c, this)
.serialize (c, &(src+src->regions), region_map))) return_trace (false);
if (unlikely (!regions.serialize_serialize (c, &(src+src->regions), region_map)))
return_trace (false);
/* TODO: The following code could be simplified when
* List16OfOffset16To::subset () can take a custom param to be passed to VarData::serialize ()
@ -2801,8 +2801,8 @@ struct VariationStore
for (unsigned int i = 0; i < inner_maps.length; i++)
{
if (inner_maps[i].get_population () == 0) continue;
if (unlikely (!dataSets[set_index++].serialize (c, this)
.serialize (c, &(src+src->dataSets[i]), inner_maps[i], region_map)))
if (unlikely (!dataSets[set_index++]
.serialize_serialize (c, &(src+src->dataSets[i]), inner_maps[i], region_map)))
return_trace (false);
}

View File

@ -367,15 +367,15 @@ struct HVARVVAR
TRACE_SERIALIZE (this);
if (im_plans[index_map_subset_plan_t::ADV_INDEX].is_identity ())
advMap = 0;
else if (unlikely (!advMap.serialize (c, this).serialize (c, im_plans[index_map_subset_plan_t::ADV_INDEX])))
else if (unlikely (!advMap.serialize_serialize (c, im_plans[index_map_subset_plan_t::ADV_INDEX])))
return_trace (false);
if (im_plans[index_map_subset_plan_t::LSB_INDEX].is_identity ())
lsbMap = 0;
else if (unlikely (!lsbMap.serialize (c, this).serialize (c, im_plans[index_map_subset_plan_t::LSB_INDEX])))
else if (unlikely (!lsbMap.serialize_serialize (c, im_plans[index_map_subset_plan_t::LSB_INDEX])))
return_trace (false);
if (im_plans[index_map_subset_plan_t::RSB_INDEX].is_identity ())
rsbMap = 0;
else if (unlikely (!rsbMap.serialize (c, this).serialize (c, im_plans[index_map_subset_plan_t::RSB_INDEX])))
else if (unlikely (!rsbMap.serialize_serialize (c, im_plans[index_map_subset_plan_t::RSB_INDEX])))
return_trace (false);
return_trace (true);
@ -398,8 +398,10 @@ struct HVARVVAR
out->version.major = 1;
out->version.minor = 0;
if (unlikely (!out->varStore.serialize (c->serializer, out)
.serialize (c->serializer, hvar_plan.var_store, hvar_plan.inner_maps.as_array ())))
if (unlikely (!out->varStore
.serialize_serialize (c->serializer,
hvar_plan.var_store,
hvar_plan.inner_maps.as_array ())))
return_trace (false);
return_trace (out->T::serialize_index_maps (c->serializer,
@ -466,7 +468,7 @@ struct VVAR : HVARVVAR {
return_trace (false);
if (!im_plans[index_map_subset_plan_t::VORG_INDEX].get_map_count ())
vorgMap = 0;
else if (unlikely (!vorgMap.serialize (c, this).serialize (c, im_plans[index_map_subset_plan_t::VORG_INDEX])))
else if (unlikely (!vorgMap.serialize_serialize (c, im_plans[index_map_subset_plan_t::VORG_INDEX])))
return_trace (false);
return_trace (true);