From edca52c3b644f6ebc90eeeb307ed3e87a7245348 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 22 Jul 2022 15:17:32 -0600 Subject: [PATCH] [avar2] Use a varStore cache --- src/hb-ot-var-avar-table.hh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/hb-ot-var-avar-table.hh b/src/hb-ot-var-avar-table.hh index 7bd5ab1ae..e6280386c 100644 --- a/src/hb-ot-var-avar-table.hh +++ b/src/hb-ot-var-avar-table.hh @@ -178,12 +178,11 @@ struct avar if (version.major < 2) return; - /* TODO Use cache. */ - const auto *v2 = (const avarV2Tail *) map; const auto &varidx_map = this+v2->varIdxMap; const auto &var_store = this+v2->varStore; + auto *var_store_cache = var_store.create_cache (); hb_vector_t out; out.alloc (coords_length); @@ -191,12 +190,14 @@ struct avar { int v = coords[i]; uint32_t varidx = varidx_map.map (i); - float delta = var_store.get_delta (varidx, coords, coords_length); + float delta = var_store.get_delta (varidx, coords, coords_length, var_store_cache); v += round (delta); v = hb_clamp (v, -(1<<14), +(1<<14)); out.push (v); } + OT::VariationStore::destroy_cache (var_store_cache); + for (unsigned i = 0; i < coords_length; i++) coords[i] = out[i]; }