Remove tracing from closure

This commit is contained in:
Behdad Esfahbod 2019-01-18 12:53:06 -05:00
parent d9f6be3a61
commit 0772c06f96
3 changed files with 3 additions and 39 deletions

View File

@ -401,18 +401,6 @@ struct hb_no_trace_t {
#define TRACE_APPLY(this) hb_no_trace_t<bool> trace
#endif
#ifndef HB_DEBUG_CLOSURE
#define HB_DEBUG_CLOSURE (HB_DEBUG+0)
#endif
#if HB_DEBUG_CLOSURE
#define TRACE_CLOSURE(this) \
hb_auto_trace_t<HB_DEBUG_CLOSURE, hb_void_t> trace \
(&c->debug_depth, c->get_name (), this, HB_FUNC, \
" ")
#else
#define TRACE_CLOSURE(this) hb_no_trace_t<hb_void_t> trace HB_UNUSED
#endif
#ifndef HB_DEBUG_COLLECT_GLYPHS
#define HB_DEBUG_COLLECT_GLYPHS (HB_DEBUG+0)
#endif
@ -476,7 +464,6 @@ struct hb_no_trace_t {
#ifndef HB_DEBUG_DISPATCH
#define HB_DEBUG_DISPATCH ( \
HB_DEBUG_APPLY + \
HB_DEBUG_CLOSURE + \
HB_DEBUG_COLLECT_GLYPHS + \
HB_DEBUG_SANITIZE + \
HB_DEBUG_SERIALIZE + \

View File

@ -46,7 +46,6 @@ struct SingleSubstFormat1
void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE (this);
for (Coverage::Iter iter (this+coverage); iter.more (); iter.next ())
{
/* TODO Switch to range-based API to work around malicious fonts.
@ -147,7 +146,6 @@ struct SingleSubstFormat2
void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE (this);
unsigned int count = substitute.len;
for (Coverage::Iter iter (this+coverage); iter.more (); iter.next ())
{
@ -298,7 +296,6 @@ struct Sequence
{
void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE (this);
unsigned int count = substitute.len;
for (unsigned int i = 0; i < count; i++)
c->out->add (substitute[i]);
@ -369,7 +366,6 @@ struct MultipleSubstFormat1
void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE (this);
unsigned int count = sequence.len;
for (Coverage::Iter iter (this+coverage); iter.more (); iter.next ())
{
@ -490,7 +486,6 @@ struct AlternateSet
{
void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE (this);
unsigned int count = alternates.len;
for (unsigned int i = 0; i < count; i++)
c->out->add (alternates[i]);
@ -555,7 +550,6 @@ struct AlternateSubstFormat1
void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE (this);
unsigned int count = alternateSet.len;
for (Coverage::Iter iter (this+coverage); iter.more (); iter.next ())
{
@ -690,7 +684,6 @@ struct Ligature
void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE (this);
unsigned int count = component.lenP1;
for (unsigned int i = 1; i < count; i++)
if (!c->glyphs->has (component[i]))
@ -798,7 +791,6 @@ struct LigatureSet
void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE (this);
unsigned int num_ligs = ligature.len;
for (unsigned int i = 0; i < num_ligs; i++)
(this+ligature[i]).closure (c);
@ -891,7 +883,6 @@ struct LigatureSubstFormat1
void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE (this);
unsigned int count = ligatureSet.len;
for (Coverage::Iter iter (this+coverage); iter.more (); iter.next ())
{
@ -1068,7 +1059,6 @@ struct ReverseChainSingleSubstFormat1
void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE (this);
const OffsetArrayOf<Coverage> &lookahead = StructAfter<OffsetArrayOf<Coverage> > (backtrack);
unsigned int count;
@ -1302,9 +1292,8 @@ struct SubstLookup : Lookup
hb_closure_context_t::return_t closure (hb_closure_context_t *c, unsigned int this_index) const
{
TRACE_CLOSURE (this);
if (!c->should_visit_lookup (this_index))
return_trace (HB_VOID);
return hb_closure_context_t::default_return_value ();
c->set_recurse_func (dispatch_closure_recurse_func);
@ -1312,7 +1301,7 @@ struct SubstLookup : Lookup
c->flush ();
return_trace (ret);
return ret;
}
hb_collect_glyphs_context_t::return_t collect_glyphs (hb_collect_glyphs_context_t *c) const

View File

@ -59,7 +59,7 @@ struct hb_intersects_context_t :
};
struct hb_closure_context_t :
hb_dispatch_context_t<hb_closure_context_t, hb_void_t, HB_DEBUG_CLOSURE>
hb_dispatch_context_t<hb_closure_context_t, hb_void_t, 0>
{
const char *get_name () { return "CLOSURE"; }
typedef return_t (*recurse_func_t) (hb_closure_context_t *c, unsigned int lookup_index);
@ -1296,7 +1296,6 @@ struct Rule
void closure (hb_closure_context_t *c, ContextClosureLookupContext &lookup_context) const
{
TRACE_CLOSURE (this);
const UnsizedArrayOf<LookupRecord> &lookupRecord = StructAfter<UnsizedArrayOf<LookupRecord> >
(inputZ.as_array ((inputCount ? inputCount - 1 : 0)));
context_closure_lookup (c,
@ -1376,7 +1375,6 @@ struct RuleSet
void closure (hb_closure_context_t *c,
ContextClosureLookupContext &lookup_context) const
{
TRACE_CLOSURE (this);
unsigned int num_rules = rule.len;
for (unsigned int i = 0; i < num_rules; i++)
(this+rule[i]).closure (c, lookup_context);
@ -1455,8 +1453,6 @@ struct ContextFormat1
void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE (this);
struct ContextClosureLookupContext lookup_context = {
{intersects_glyph},
nullptr
@ -1567,7 +1563,6 @@ struct ContextFormat2
void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE (this);
if (!(this+coverage).intersects (c->glyphs))
return;
@ -1681,7 +1676,6 @@ struct ContextFormat3
void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE (this);
if (!(this+coverageZ[0]).intersects (c->glyphs))
return;
@ -1950,7 +1944,6 @@ struct ChainRule
void closure (hb_closure_context_t *c,
ChainContextClosureLookupContext &lookup_context) const
{
TRACE_CLOSURE (this);
const HeadlessArrayOf<HBUINT16> &input = StructAfter<HeadlessArrayOf<HBUINT16> > (backtrack);
const ArrayOf<HBUINT16> &lookahead = StructAfter<ArrayOf<HBUINT16> > (input);
const ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead);
@ -2046,7 +2039,6 @@ struct ChainRuleSet
}
void closure (hb_closure_context_t *c, ChainContextClosureLookupContext &lookup_context) const
{
TRACE_CLOSURE (this);
unsigned int num_rules = rule.len;
for (unsigned int i = 0; i < num_rules; i++)
(this+rule[i]).closure (c, lookup_context);
@ -2119,8 +2111,6 @@ struct ChainContextFormat1
void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE (this);
struct ChainContextClosureLookupContext lookup_context = {
{intersects_glyph},
{nullptr, nullptr, nullptr}
@ -2232,7 +2222,6 @@ struct ChainContextFormat2
}
void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE (this);
if (!(this+coverage).intersects (c->glyphs))
return;
@ -2382,7 +2371,6 @@ struct ChainContextFormat3
void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE (this);
const OffsetArrayOf<Coverage> &input = StructAfter<OffsetArrayOf<Coverage> > (backtrack);
if (!(this+input[0]).intersects (c->glyphs))