From e98af6d1eda33346f72de8a45fbd317fc0e15935 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 25 Oct 2018 22:25:29 -0700 Subject: [PATCH] [layout] Try to speed up collect_lookups some more Barely made a dent :(. --- src/hb-ot-layout-common.hh | 2 ++ src/hb-ot-layout.cc | 23 ++++------------------- 2 files changed, 6 insertions(+), 19 deletions(-) diff --git a/src/hb-ot-layout-common.hh b/src/hb-ot-layout-common.hh index 98f6a07..7bca2ca 100644 --- a/src/hb-ot-layout-common.hh +++ b/src/hb-ot-layout-common.hh @@ -555,6 +555,8 @@ struct Feature unsigned int *lookup_count /* IN/OUT */, unsigned int *lookup_tags /* OUT */) const { return lookupIndex.get_indexes (start_index, lookup_count, lookup_tags); } + inline void add_lookup_indexes_to (hb_set_t *lookup_indexes) const + { lookupIndex.add_indexes_to (lookup_indexes); } inline const FeatureParams &get_feature_params (void) const { return this+featureParams; } diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index c2803f3..096fda2 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -828,29 +828,14 @@ hb_ot_layout_collect_lookups (hb_face_t *face, const hb_tag_t *features, hb_set_t *lookup_indexes /* OUT */) { + const OT::GSUBGPOS &g = get_gsubgpos_table (face, table_tag); + hb_auto_t feature_indexes; hb_ot_layout_collect_features (face, table_tag, scripts, languages, features, &feature_indexes); + for (hb_codepoint_t feature_index = HB_SET_VALUE_INVALID; hb_set_next (&feature_indexes, &feature_index);) - { - unsigned int lookup_indices[32]; - unsigned int offset, len; - - offset = 0; - do { - len = ARRAY_LENGTH (lookup_indices); - hb_ot_layout_feature_get_lookups (face, - table_tag, - feature_index, - offset, &len, - lookup_indices); - - for (unsigned int i = 0; i < len; i++) - lookup_indexes->add (lookup_indices[i]); - - offset += len; - } while (len == ARRAY_LENGTH (lookup_indices)); - } + g.get_feature (feature_index).add_lookup_indexes_to (lookup_indexes); } /** -- 2.7.4