[pango/harfbuzz-ng] [GSUB] Further optimize the main switch
- From: Behdad Esfahbod <behdad src gnome org>
- To: svn-commits-list gnome org
- Subject: [pango/harfbuzz-ng] [GSUB] Further optimize the main switch
- Date: Sun, 17 May 2009 19:50:16 -0400 (EDT)
commit 9222e0741549ba14a4edf153217fd95fc89d744d
Author: Behdad Esfahbod <behdad behdad org>
Date: Sun May 17 09:07:27 2009 -0400
[GSUB] Further optimize the main switch
---
pango/opentype/hb-ot-layout-gsub-private.h | 31 +++++++++++++++------------
1 files changed, 17 insertions(+), 14 deletions(-)
diff --git a/pango/opentype/hb-ot-layout-gsub-private.h b/pango/opentype/hb-ot-layout-gsub-private.h
index 3b9b1a6..044703a 100644
--- a/pango/opentype/hb-ot-layout-gsub-private.h
+++ b/pango/opentype/hb-ot-layout-gsub-private.h
@@ -735,11 +735,8 @@ struct SubstLookupSubTable {
friend struct SubstLookup;
inline bool substitute (LOOKUP_ARGS_DEF,
- unsigned int lookup_type) const {
-
- unsigned int property;
- if (!_hb_ot_layout_check_glyph_property (layout, IN_CURITEM (), lookup_flag, &property))
- return false;
+ unsigned int property,
+ unsigned int lookup_type) const {
switch (lookup_type) {
case GSUB_Single: return u.single.substitute (LOOKUP_ARGS, property);
@@ -805,23 +802,21 @@ struct SubstLookup : Lookup {
}
}
- bool substitute_once (hb_ot_layout_t *layout,
- hb_buffer_t *buffer,
- unsigned int context_length,
- unsigned int nesting_level_left) const {
+ inline bool substitute_once (hb_ot_layout_t *layout,
+ hb_buffer_t *buffer,
+ unsigned int context_length,
+ unsigned int nesting_level_left) const {
unsigned int lookup_type = get_type ();
unsigned int lookup_flag = get_flag ();
- if (HB_UNLIKELY (nesting_level_left == 0))
- return false;
- nesting_level_left--;
-
- if (HB_UNLIKELY (context_length < 1))
+ unsigned int property;
+ if (!_hb_ot_layout_check_glyph_property (layout, IN_CURITEM (), lookup_flag, &property))
return false;
for (unsigned int i = 0; i < get_subtable_count (); i++)
if (get_subtable (i).substitute (LOOKUP_ARGS,
+ property,
lookup_type))
return true;
@@ -903,6 +898,7 @@ inline bool ExtensionSubstFormat1::substitute (LOOKUP_ARGS_DEF, unsigned int pro
/* XXX either check in sanitize or here that the lookuptype is not 7 again,
* or we can loop indefinitely. */
return (*(SubstLookupSubTable *)(((char *) this) + extensionOffset)).substitute (LOOKUP_ARGS,
+ property,
get_type ());
}
@@ -910,6 +906,13 @@ static inline bool substitute_lookup (LOOKUP_ARGS_DEF, unsigned int lookup_index
const GSUB &gsub = *(layout->gsub);
const SubstLookup &l = gsub.get_lookup (lookup_index);
+ if (HB_UNLIKELY (nesting_level_left == 0))
+ return false;
+ nesting_level_left--;
+
+ if (HB_UNLIKELY (context_length < 1))
+ return false;
+
return l.substitute_once (layout, buffer, context_length, nesting_level_left);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]