提交 7dddd4e7 编写于 作者: B Behdad Esfahbod

[OTLayout] More templatizing Extension

上级 653eeb26
...@@ -1248,12 +1248,7 @@ struct ChainContextPos : ChainContext {}; ...@@ -1248,12 +1248,7 @@ struct ChainContextPos : ChainContext {};
struct ExtensionPos : Extension<ExtensionPos> struct ExtensionPos : Extension<ExtensionPos>
{ {
inline const struct PosLookupSubTable& get_subtable (void) const typedef struct PosLookupSubTable LookupSubTable;
{
unsigned int offset = get_offset ();
if (unlikely (!offset)) return Null(PosLookupSubTable);
return StructAtOffset<PosLookupSubTable> (this, offset);
}
inline bool sanitize (hb_sanitize_context_t *c); inline bool sanitize (hb_sanitize_context_t *c);
}; };
......
...@@ -880,12 +880,7 @@ struct ChainContextSubst : ChainContext {}; ...@@ -880,12 +880,7 @@ struct ChainContextSubst : ChainContext {};
struct ExtensionSubst : Extension<ExtensionSubst> struct ExtensionSubst : Extension<ExtensionSubst>
{ {
inline const struct SubstLookupSubTable& get_subtable (void) const typedef struct SubstLookupSubTable LookupSubTable;
{
unsigned int offset = get_offset ();
if (unlikely (!offset)) return Null(SubstLookupSubTable);
return StructAtOffset<SubstLookupSubTable> (this, offset);
}
inline bool sanitize (hb_sanitize_context_t *c); inline bool sanitize (hb_sanitize_context_t *c);
...@@ -1390,7 +1385,7 @@ inline bool ExtensionSubst::is_reverse (void) const ...@@ -1390,7 +1385,7 @@ inline bool ExtensionSubst::is_reverse (void) const
{ {
unsigned int type = get_type (); unsigned int type = get_type ();
if (unlikely (type == SubstLookupSubTable::Extension)) if (unlikely (type == SubstLookupSubTable::Extension))
return CastR<ExtensionSubst> (get_subtable()).is_reverse (); return CastR<ExtensionSubst> (get_subtable<SubstLookupSubTable>()).is_reverse ();
return SubstLookup::lookup_type_is_reverse (type); return SubstLookup::lookup_type_is_reverse (type);
} }
......
...@@ -1783,10 +1783,18 @@ struct Extension ...@@ -1783,10 +1783,18 @@ struct Extension
} }
} }
template <typename X>
inline const X& get_subtable (void) const
{
unsigned int offset = get_offset ();
if (unlikely (!offset)) return Null(typename T::LookupSubTable);
return StructAtOffset<typename T::LookupSubTable> (this, offset);
}
template <typename context_t> template <typename context_t>
inline typename context_t::return_t process (context_t *c) const inline typename context_t::return_t process (context_t *c) const
{ {
return CastP<T>(this)->get_subtable ().process (c, get_type ()); return CastP<T>(this)->get_subtable<typename T::LookupSubTable> ().process (c, get_type ());
} }
inline bool sanitize (hb_sanitize_context_t *c) { inline bool sanitize (hb_sanitize_context_t *c) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册