Port apply to use hb_trace_t

This commit is contained in:
Behdad Esfahbod 2010-05-05 01:30:48 -04:00
parent 969c9705ae
commit 6c42cddfe5
3 changed files with 14 additions and 19 deletions

View File

@ -1487,11 +1487,10 @@ struct PosLookup : Lookup
inline bool apply_once (hb_ot_layout_context_t *layout, inline bool apply_once (hb_ot_layout_context_t *layout,
hb_buffer_t *buffer, hb_buffer_t *buffer,
unsigned int context_length, unsigned int context_length,
unsigned int nesting_level_left, unsigned int nesting_level_left) const
unsigned int apply_depth) const
{ {
unsigned int lookup_type = get_type (); unsigned int lookup_type = get_type ();
hb_apply_context_t context[1]; hb_apply_context_t context[1] = {{}};
context->layout = layout; context->layout = layout;
context->buffer = buffer; context->buffer = buffer;
@ -1528,7 +1527,7 @@ struct PosLookup : Lookup
bool done; bool done;
if (~IN_MASK (buffer->in_pos) & mask) if (~IN_MASK (buffer->in_pos) & mask)
{ {
done = apply_once (layout, buffer, NO_CONTEXT, MAX_NESTING_LEVEL, 0); done = apply_once (layout, buffer, NO_CONTEXT, MAX_NESTING_LEVEL);
ret |= done; ret |= done;
} }
else else
@ -1612,7 +1611,7 @@ static inline bool position_lookup (APPLY_ARG_DEF, unsigned int lookup_index)
if (unlikely (context->context_length < 1)) if (unlikely (context->context_length < 1))
return false; return false;
return l.apply_once (context->layout, context->buffer, context->context_length, context->nesting_level_left - 1, apply_depth + 1); return l.apply_once (context->layout, context->buffer, context->context_length, context->nesting_level_left - 1);
} }

View File

@ -772,11 +772,10 @@ struct SubstLookup : Lookup
inline bool apply_once (hb_ot_layout_context_t *layout, inline bool apply_once (hb_ot_layout_context_t *layout,
hb_buffer_t *buffer, hb_buffer_t *buffer,
unsigned int context_length, unsigned int context_length,
unsigned int nesting_level_left, unsigned int nesting_level_left) const
unsigned int apply_depth) const
{ {
unsigned int lookup_type = get_type (); unsigned int lookup_type = get_type ();
hb_apply_context_t context[1]; hb_apply_context_t context[1] = {{}};
context->layout = layout; context->layout = layout;
context->buffer = buffer; context->buffer = buffer;
@ -828,7 +827,7 @@ struct SubstLookup : Lookup
while (buffer->in_pos < buffer->in_length) while (buffer->in_pos < buffer->in_length)
{ {
if ((~IN_MASK (buffer->in_pos) & mask) && if ((~IN_MASK (buffer->in_pos) & mask) &&
apply_once (layout, buffer, NO_CONTEXT, MAX_NESTING_LEVEL, 0)) apply_once (layout, buffer, NO_CONTEXT, MAX_NESTING_LEVEL))
ret = true; ret = true;
else else
_hb_buffer_next_glyph (buffer); _hb_buffer_next_glyph (buffer);
@ -844,7 +843,7 @@ struct SubstLookup : Lookup
do do
{ {
if ((~IN_MASK (buffer->in_pos) & mask) && if ((~IN_MASK (buffer->in_pos) & mask) &&
apply_once (layout, buffer, NO_CONTEXT, MAX_NESTING_LEVEL, 0)) apply_once (layout, buffer, NO_CONTEXT, MAX_NESTING_LEVEL))
ret = true; ret = true;
else else
buffer->in_pos--; buffer->in_pos--;
@ -931,7 +930,7 @@ static inline bool substitute_lookup (APPLY_ARG_DEF, unsigned int lookup_index)
if (unlikely (context->context_length < 1)) if (unlikely (context->context_length < 1))
return false; return false;
return l.apply_once (context->layout, context->buffer, context->context_length, context->nesting_level_left - 1, apply_depth + 1); return l.apply_once (context->layout, context->buffer, context->context_length, context->nesting_level_left - 1);
} }

View File

@ -36,18 +36,14 @@
#endif #endif
#define TRACE_APPLY() \ #define TRACE_APPLY() \
HB_STMT_START { \ hb_trace_t<HB_DEBUG_APPLY> trace (&context->debug_depth); \
if (HB_DEBUG_APPLY) \ trace.log ("APPLY", HB_FUNC, this);
_hb_trace ("APPLY", HB_FUNC, this, apply_depth, HB_DEBUG_APPLY); \
} HB_STMT_END
#define APPLY_ARG_DEF \ #define APPLY_ARG_DEF \
hb_apply_context_t *context, \ hb_apply_context_t *context
unsigned int apply_depth HB_UNUSED
#define APPLY_ARG \ #define APPLY_ARG \
context, \ context
(HB_DEBUG_APPLY ? apply_depth + 1 : 0)
struct hb_apply_context_t struct hb_apply_context_t
{ {
@ -57,6 +53,7 @@ struct hb_apply_context_t
unsigned int nesting_level_left; unsigned int nesting_level_left;
unsigned int lookup_flag; unsigned int lookup_flag;
unsigned int property; /* propety of first glyph (TODO remove) */ unsigned int property; /* propety of first glyph (TODO remove) */
unsigned int debug_depth;
}; };