[serialize] Pass offset to serialize_copy()
This commit is contained in:
parent
87dd4bff1c
commit
9260441624
@ -320,17 +320,21 @@ struct OffsetTo : Offset<OffsetType, has_null>
|
||||
|
||||
/* TODO: Somehow merge this with previous function into a serialize_dispatch(). */
|
||||
template <typename ...Ts>
|
||||
bool serialize_copy (hb_serialize_context_t *c, const Type &src, const void *base, Ts&&... ds)
|
||||
bool serialize_copy (hb_serialize_context_t *c,
|
||||
const OffsetTo& src,
|
||||
const void *src_base,
|
||||
const void *dst_base,
|
||||
Ts&&... ds)
|
||||
{
|
||||
*this = 0;
|
||||
if (has_null && &src == _hb_has_null<Type, has_null>::get_null ())
|
||||
if (src.is_null ())
|
||||
return false;
|
||||
|
||||
c->push ();
|
||||
|
||||
bool ret = c->copy (src, hb_forward<Ts> (ds)...);
|
||||
bool ret = c->copy (src_base+src, hb_forward<Ts> (ds)...);
|
||||
|
||||
c->add_link (*this, c->pop_pack (), base);
|
||||
c->add_link (*this, c->pop_pack (), dst_base);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -279,10 +279,10 @@ struct Script
|
||||
TRACE_SUBSET (this);
|
||||
auto *out = c->serializer->embed (*this);
|
||||
if (unlikely (!out)) return_trace (false);
|
||||
out->defaultLangSys.serialize_copy (c->serializer, this+defaultLangSys, out);
|
||||
out->defaultLangSys.serialize_copy (c->serializer, defaultLangSys, this, out);
|
||||
unsigned int count = langSys.len;
|
||||
for (unsigned int i = 0; i < count; i++)
|
||||
out->langSys.arrayZ[i].offset.serialize_copy (c->serializer, this+langSys[i].offset, out);
|
||||
out->langSys.arrayZ[i].offset.serialize_copy (c->serializer, langSys[i].offset, this, out);
|
||||
return_trace (true);
|
||||
}
|
||||
|
||||
|
@ -2695,7 +2695,7 @@ struct GSUBGPOS
|
||||
out);
|
||||
|
||||
if (version.to_int () >= 0x00010001u)
|
||||
out->featureVars.serialize_copy (c->serializer, this+featureVars, out);
|
||||
out->featureVars.serialize_copy (c->serializer, featureVars, this, out);
|
||||
|
||||
return_trace (true);
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ struct NameRecord
|
||||
TRACE_SERIALIZE (this);
|
||||
auto *out = c->embed (this);
|
||||
if (unlikely (!out)) return_trace (nullptr);
|
||||
out->offset.serialize_copy (c, src_base + offset, dst_base, length);
|
||||
out->offset.serialize_copy (c, offset, src_base, dst_base, length);
|
||||
return_trace (out);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user