From 4fb0ac7728e5d3ad20a63f00e636b5a6c180c46a Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 2 Feb 2025 17:06:45 +0000 Subject: [PATCH] [aat] Minor simplify --- src/hb-aat-layout-common.hh | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/hb-aat-layout-common.hh b/src/hb-aat-layout-common.hh index 0e694407b..df4c87637 100644 --- a/src/hb-aat-layout-common.hh +++ b/src/hb-aat-layout-common.hh @@ -639,21 +639,15 @@ struct StateTable int new_state (unsigned int newState) const { return Types::extended ? newState : ((int) newState - (int) stateArrayTable) / (int) nClasses; } - template unsigned int get_class (hb_codepoint_t glyph_id, unsigned int num_glyphs, - cache_t *cache) const + hb_aat_class_cache_t *cache = nullptr) const { if (unlikely (glyph_id == DELETED_GLYPH)) return CLASS_DELETED_GLYPH; - if (cache) - { - unsigned int klass; - if (cache->get (glyph_id, &klass)) - return klass; - } - unsigned klass = (this+classTable).get_class (glyph_id, num_glyphs, CLASS_OUT_OF_BOUNDS); - if (cache) - cache->set (glyph_id, klass); + unsigned klass; + if (cache && cache->get (glyph_id, &klass)) return klass; + klass = (this+classTable).get_class (glyph_id, num_glyphs, CLASS_OUT_OF_BOUNDS); + if (cache) cache->set (glyph_id, klass); return klass; }