From b693fd0dc6c7979dcacdff060ecf12a2e107071d Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 7 Nov 2018 11:05:28 -0500 Subject: [PATCH] [morx] Simplify --- src/hb-aat-layout-morx-table.hh | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/src/hb-aat-layout-morx-table.hh b/src/hb-aat-layout-morx-table.hh index c06af4210..784b36cf4 100644 --- a/src/hb-aat-layout-morx-table.hh +++ b/src/hb-aat-layout-morx-table.hh @@ -384,12 +384,10 @@ struct LigatureEntry DEFINE_SIZE_STATIC (2); }; - template - static inline bool performAction (Flags flags) - { return flags & PerformAction; } + static inline bool performAction (const Entry *entry) + { return entry->flags & PerformAction; } - template - static inline unsigned int ligActionIndex (Entry &entry, Flags flags) + static inline unsigned int ligActionIndex (const Entry *entry) { return entry->data.ligActionIndex; } }; template <> @@ -408,13 +406,11 @@ struct LigatureEntry typedef void EntryData; - template - static inline bool performAction (Flags flags) - { return flags & Offset; } + static inline bool performAction (const Entry *entry) + { return entry->flags & Offset; } - template - static inline unsigned int ligActionIndex (Entry &entry, Flags flags) - { return flags & 0x3FFF; } + static inline unsigned int ligActionIndex (const Entry *entry) + { return entry->flags & 0x3FFF; } }; @@ -458,16 +454,15 @@ struct LigatureSubtable inline bool is_actionable (StateTableDriver *driver HB_UNUSED, const Entry *entry) { - return LigatureEntryT::performAction (entry->flags); + return LigatureEntryT::performAction (entry); } inline bool transition (StateTableDriver *driver, const Entry *entry) { hb_buffer_t *buffer = driver->buffer; - unsigned int flags = entry->flags; DEBUG_MSG (APPLY, nullptr, "Ligature transition at %d", buffer->idx); - if (flags & LigatureEntryT::SetComponent) + if (entry->flags & LigatureEntryT::SetComponent) { if (unlikely (match_length >= ARRAY_LENGTH (match_positions))) return false; @@ -480,11 +475,11 @@ struct LigatureSubtable DEBUG_MSG (APPLY, nullptr, "Set component at %d", buffer->out_len); } - if (LigatureEntryT::performAction (flags)) + if (LigatureEntryT::performAction (entry)) { DEBUG_MSG (APPLY, nullptr, "Perform action with %d", match_length); unsigned int end = buffer->out_len; - unsigned int action_idx = LigatureEntryT::ligActionIndex (entry, flags); + unsigned int action_idx = LigatureEntryT::ligActionIndex (entry); unsigned int action; unsigned int ligature_idx = 0;