[Device] Save a snap/revert

This commit is contained in:
Behdad Esfahbod 2022-12-03 12:50:32 -07:00
parent 93328cedfc
commit 44a5de3a97
1 changed files with 4 additions and 6 deletions

View File

@ -3455,16 +3455,14 @@ struct VariationDevice
{ {
TRACE_SERIALIZE (this); TRACE_SERIALIZE (this);
if (!layout_variation_idx_delta_map) return_trace (nullptr); if (!layout_variation_idx_delta_map) return_trace (nullptr);
auto snap = c->snapshot ();
auto *out = c->embed (this);
if (unlikely (!out)) return_trace (nullptr);
hb_pair_t<unsigned, int> *v; hb_pair_t<unsigned, int> *v;
if (!layout_variation_idx_delta_map->has (varIdx, &v)) if (!layout_variation_idx_delta_map->has (varIdx, &v))
{
c->revert (snap);
return_trace (nullptr); return_trace (nullptr);
}
auto *out = c->embed (this);
if (unlikely (!out)) return_trace (nullptr);
unsigned new_idx = hb_first (*v); unsigned new_idx = hb_first (*v);
out->varIdx = new_idx; out->varIdx = new_idx;
return_trace (out); return_trace (out);