From eb6de664690d3861ef41dec6ad2de301a02bc4e7 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 14 Sep 2025 13:13:22 -0600 Subject: [PATCH] [instancer/tuplevars] Reduce work --- src/hb-ot-var-common.hh | 20 +++----------------- src/test-tuple-varstore.cc | 2 ++ 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/src/hb-ot-var-common.hh b/src/hb-ot-var-common.hh index f2e1e31f2..d6fd15ed8 100644 --- a/src/hb-ot-var-common.hh +++ b/src/hb-ot-var-common.hh @@ -458,24 +458,10 @@ struct tuple_delta_t const hb_map_t& axes_index_map, const hb_map_t& axes_old_index_tag_map) const { - unsigned orig_axis_count = axes_old_index_tag_map.get_population (); - auto it = peak_coords.iter (); - unsigned count = 0; - for (unsigned i = 0; i < orig_axis_count; i++) - { - if (!axes_index_map.has (i)) /* axis pinned */ - continue; - hb_tag_t axis_tag = axes_old_index_tag_map.get (i); - Triple *coords; - if (!axis_tuples.has (axis_tag, &coords)) - (*it).set_int (0); - else - (*it).set_float (coords->middle); - it++; - count++; - } + unsigned peak_count = compiled_peak_coords.length / F2DOT14::static_size; + hb_memcpy (&peak_coords[0], &compiled_peak_coords[0], peak_count * F2DOT14::static_size); flag |= TupleVariationHeader::TuppleIndex::EmbeddedPeakTuple; - return count; + return peak_count; } /* if no need to encode intermediate coords, then just return p */ diff --git a/src/test-tuple-varstore.cc b/src/test-tuple-varstore.cc index cef04ab7e..92c3e74d0 100644 --- a/src/test-tuple-varstore.cc +++ b/src/test-tuple-varstore.cc @@ -128,6 +128,8 @@ test_decompile_cvar () hb_map_t axes_index_map; axes_index_map.set (0, 0); + for (auto &tuple_var : tuple_variations.tuple_vars) + tuple_var.compile_peak_coords (axes_index_map, axis_idx_tag_map); bool res = tuple_variations.compile_bytes (axes_index_map, axis_idx_tag_map, false); hb_always_assert (res); hb_always_assert (tuple_variations.tuple_vars[0].compiled_tuple_header.length == 6);