Move code

In preparation to move add per-subtable set digests...
This commit is contained in:
Behdad Esfahbod 2018-10-10 11:36:28 -04:00
parent a03850a356
commit c8f2d9334c
2 changed files with 54 additions and 53 deletions

View File

@ -259,6 +259,56 @@ struct hb_add_coverage_context_t :
};
struct hb_get_subtables_context_t :
hb_dispatch_context_t<hb_get_subtables_context_t, hb_void_t, HB_DEBUG_APPLY>
{
template <typename Type>
static inline bool apply_to (const void *obj, OT::hb_ot_apply_context_t *c)
{
const Type *typed_obj = (const Type *) obj;
return typed_obj->apply (c);
}
typedef bool (*hb_apply_func_t) (const void *obj, OT::hb_ot_apply_context_t *c);
struct hb_applicable_t
{
inline void init (const void *obj_, hb_apply_func_t apply_func_)
{
obj = obj_;
apply_func = apply_func_;
}
inline bool apply (OT::hb_ot_apply_context_t *c) const { return apply_func (obj, c); }
private:
const void *obj;
hb_apply_func_t apply_func;
};
typedef hb_auto_t<hb_vector_t<hb_applicable_t> > array_t;
/* Dispatch interface. */
inline const char *get_name (void) { return "GET_SUBTABLES"; }
template <typename T>
inline return_t dispatch (const T &obj)
{
hb_applicable_t *entry = array.push();
entry->init (&obj, apply_to<T>);
return HB_VOID;
}
static return_t default_return_value (void) { return HB_VOID; }
bool stop_sublookup_iteration (return_t r HB_UNUSED) const { return false; }
hb_get_subtables_context_t (array_t &array_) :
array (array_),
debug_depth (0) {}
array_t &array;
unsigned int debug_depth;
};
struct hb_ot_apply_context_t :
hb_dispatch_context_t<hb_ot_apply_context_t, bool, HB_DEBUG_APPLY>
{

View File

@ -1112,59 +1112,10 @@ struct GPOSProxy
};
struct hb_get_subtables_context_t :
hb_dispatch_context_t<hb_get_subtables_context_t, hb_void_t, HB_DEBUG_APPLY>
{
template <typename Type>
static inline bool apply_to (const void *obj, OT::hb_ot_apply_context_t *c)
{
const Type *typed_obj = (const Type *) obj;
return typed_obj->apply (c);
}
typedef bool (*hb_apply_func_t) (const void *obj, OT::hb_ot_apply_context_t *c);
struct hb_applicable_t
{
inline void init (const void *obj_, hb_apply_func_t apply_func_)
{
obj = obj_;
apply_func = apply_func_;
}
inline bool apply (OT::hb_ot_apply_context_t *c) const { return apply_func (obj, c); }
private:
const void *obj;
hb_apply_func_t apply_func;
};
typedef hb_auto_t<hb_vector_t<hb_applicable_t> > array_t;
/* Dispatch interface. */
inline const char *get_name (void) { return "GET_SUBTABLES"; }
template <typename T>
inline return_t dispatch (const T &obj)
{
hb_applicable_t *entry = array.push();
entry->init (&obj, apply_to<T>);
return HB_VOID;
}
static return_t default_return_value (void) { return HB_VOID; }
bool stop_sublookup_iteration (return_t r HB_UNUSED) const { return false; }
hb_get_subtables_context_t (array_t &array_) :
array (array_),
debug_depth (0) {}
array_t &array;
unsigned int debug_depth;
};
static inline bool
apply_forward (OT::hb_ot_apply_context_t *c,
const hb_ot_layout_lookup_accelerator_t &accel,
const hb_get_subtables_context_t::array_t &subtables)
const OT::hb_get_subtables_context_t::array_t &subtables)
{
bool ret = false;
hb_buffer_t *buffer = c->buffer;
@ -1194,7 +1145,7 @@ apply_forward (OT::hb_ot_apply_context_t *c,
static inline bool
apply_backward (OT::hb_ot_apply_context_t *c,
const hb_ot_layout_lookup_accelerator_t &accel,
const hb_get_subtables_context_t::array_t &subtables)
const OT::hb_get_subtables_context_t::array_t &subtables)
{
bool ret = false;
hb_buffer_t *buffer = c->buffer;
@ -1232,8 +1183,8 @@ apply_string (OT::hb_ot_apply_context_t *c,
c->set_lookup_props (lookup.get_props ());
hb_get_subtables_context_t::array_t subtables;
hb_get_subtables_context_t c_get_subtables (subtables);
OT::hb_get_subtables_context_t::array_t subtables;
OT::hb_get_subtables_context_t c_get_subtables (subtables);
lookup.dispatch (&c_get_subtables);
if (likely (!lookup.is_reverse ()))