Use pointers instead of references, in preparation for upcoming change.
This commit is contained in:
Behdad Esfahbod 2012-12-04 17:08:41 -05:00
parent 1bcfa06d11
commit 8303593ba1
3 changed files with 48 additions and 48 deletions

View File

@ -422,7 +422,7 @@ struct SinglePosFormat1
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
{ {
TRACE_COLLECT_GLYPHS (this); TRACE_COLLECT_GLYPHS (this);
(this+coverage).add_coverage (&c->input); (this+coverage).add_coverage (c->input);
} }
inline const Coverage &get_coverage (void) const inline const Coverage &get_coverage (void) const
@ -467,7 +467,7 @@ struct SinglePosFormat2
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
{ {
TRACE_COLLECT_GLYPHS (this); TRACE_COLLECT_GLYPHS (this);
(this+coverage).add_coverage (&c->input); (this+coverage).add_coverage (c->input);
} }
inline const Coverage &get_coverage (void) const inline const Coverage &get_coverage (void) const
@ -572,7 +572,7 @@ struct PairSet
unsigned int count = len; unsigned int count = len;
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
{ {
c->input.add (record->secondGlyph); c->input->add (record->secondGlyph);
record = &StructAtOffset<PairValueRecord> (record, record_size); record = &StructAtOffset<PairValueRecord> (record, record_size);
} }
} }
@ -638,7 +638,7 @@ struct PairPosFormat1
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
{ {
TRACE_COLLECT_GLYPHS (this); TRACE_COLLECT_GLYPHS (this);
(this+coverage).add_coverage (&c->input); (this+coverage).add_coverage (c->input);
unsigned int count = pairSet.len; unsigned int count = pairSet.len;
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
(this+pairSet[i]).collect_glyphs (c, &valueFormat1); (this+pairSet[i]).collect_glyphs (c, &valueFormat1);
@ -701,19 +701,19 @@ struct PairPosFormat2
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
{ {
TRACE_COLLECT_GLYPHS (this); TRACE_COLLECT_GLYPHS (this);
/* (this+coverage).add_coverage (&c->input); // Don't need this. */ /* (this+coverage).add_coverage (c->input); // Don't need this. */
/* TODO only add values for pairs that have nonzero adjustments. */ /* TODO only add values for pairs that have nonzero adjustments. */
unsigned int count1 = class1Count; unsigned int count1 = class1Count;
const ClassDef &klass1 = this+classDef1; const ClassDef &klass1 = this+classDef1;
for (unsigned int i = 0; i < count1; i++) for (unsigned int i = 0; i < count1; i++)
klass1.add_class (&c->input, i); klass1.add_class (c->input, i);
unsigned int count2 = class2Count; unsigned int count2 = class2Count;
const ClassDef &klass2 = this+classDef2; const ClassDef &klass2 = this+classDef2;
for (unsigned int i = 0; i < count2; i++) for (unsigned int i = 0; i < count2; i++)
klass2.add_class (&c->input, i); klass2.add_class (c->input, i);
} }
inline const Coverage &get_coverage (void) const inline const Coverage &get_coverage (void) const
@ -859,7 +859,7 @@ struct CursivePosFormat1
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
{ {
TRACE_COLLECT_GLYPHS (this); TRACE_COLLECT_GLYPHS (this);
(this+coverage).add_coverage (&c->input); (this+coverage).add_coverage (c->input);
} }
inline const Coverage &get_coverage (void) const inline const Coverage &get_coverage (void) const
@ -1005,8 +1005,8 @@ struct MarkBasePosFormat1
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
{ {
TRACE_COLLECT_GLYPHS (this); TRACE_COLLECT_GLYPHS (this);
(this+markCoverage).add_coverage (&c->input); (this+markCoverage).add_coverage (c->input);
(this+baseCoverage).add_coverage (&c->input); (this+baseCoverage).add_coverage (c->input);
/* TODO only add combinations that have nonzero adjustment. */ /* TODO only add combinations that have nonzero adjustment. */
} }
@ -1109,8 +1109,8 @@ struct MarkLigPosFormat1
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
{ {
TRACE_COLLECT_GLYPHS (this); TRACE_COLLECT_GLYPHS (this);
(this+markCoverage).add_coverage (&c->input); (this+markCoverage).add_coverage (c->input);
(this+ligatureCoverage).add_coverage (&c->input); (this+ligatureCoverage).add_coverage (c->input);
/* TODO only add combinations that have nonzero adjustment. */ /* TODO only add combinations that have nonzero adjustment. */
} }
@ -1225,8 +1225,8 @@ struct MarkMarkPosFormat1
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
{ {
TRACE_COLLECT_GLYPHS (this); TRACE_COLLECT_GLYPHS (this);
(this+mark1Coverage).add_coverage (&c->input); (this+mark1Coverage).add_coverage (c->input);
(this+mark2Coverage).add_coverage (&c->input); (this+mark2Coverage).add_coverage (c->input);
/* TODO only add combinations that have nonzero adjustment. */ /* TODO only add combinations that have nonzero adjustment. */
} }

View File

@ -54,8 +54,8 @@ struct SingleSubstFormat1
Coverage::Iter iter; Coverage::Iter iter;
for (iter.init (this+coverage); iter.more (); iter.next ()) { for (iter.init (this+coverage); iter.more (); iter.next ()) {
hb_codepoint_t glyph_id = iter.get_glyph (); hb_codepoint_t glyph_id = iter.get_glyph ();
c->input.add (glyph_id); c->input->add (glyph_id);
c->output.add ((glyph_id + deltaGlyphID) & 0xFFFF); c->output->add ((glyph_id + deltaGlyphID) & 0xFFFF);
} }
} }
@ -130,8 +130,8 @@ struct SingleSubstFormat2
TRACE_COLLECT_GLYPHS (this); TRACE_COLLECT_GLYPHS (this);
Coverage::Iter iter; Coverage::Iter iter;
for (iter.init (this+coverage); iter.more (); iter.next ()) { for (iter.init (this+coverage); iter.more (); iter.next ()) {
c->input.add (iter.get_glyph ()); c->input->add (iter.get_glyph ());
c->output.add (substitute[iter.get_coverage ()]); c->output->add (substitute[iter.get_coverage ()]);
} }
} }
@ -264,7 +264,7 @@ struct Sequence
TRACE_COLLECT_GLYPHS (this); TRACE_COLLECT_GLYPHS (this);
unsigned int count = substitute.len; unsigned int count = substitute.len;
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
c->output.add (substitute[i]); c->output->add (substitute[i]);
} }
inline bool apply (hb_apply_context_t *c) const inline bool apply (hb_apply_context_t *c) const
@ -320,7 +320,7 @@ struct MultipleSubstFormat1
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
{ {
TRACE_COLLECT_GLYPHS (this); TRACE_COLLECT_GLYPHS (this);
(this+coverage).add_coverage (&c->input); (this+coverage).add_coverage (c->input);
unsigned int count = sequence.len; unsigned int count = sequence.len;
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
(this+sequence[i]).collect_glyphs (c); (this+sequence[i]).collect_glyphs (c);
@ -451,11 +451,11 @@ struct AlternateSubstFormat1
TRACE_COLLECT_GLYPHS (this); TRACE_COLLECT_GLYPHS (this);
Coverage::Iter iter; Coverage::Iter iter;
for (iter.init (this+coverage); iter.more (); iter.next ()) { for (iter.init (this+coverage); iter.more (); iter.next ()) {
c->input.add (iter.get_glyph ()); c->input->add (iter.get_glyph ());
const AlternateSet &alt_set = this+alternateSet[iter.get_coverage ()]; const AlternateSet &alt_set = this+alternateSet[iter.get_coverage ()];
unsigned int count = alt_set.len; unsigned int count = alt_set.len;
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
c->output.add (alt_set[i]); c->output->add (alt_set[i]);
} }
} }
@ -595,8 +595,8 @@ struct Ligature
TRACE_COLLECT_GLYPHS (this); TRACE_COLLECT_GLYPHS (this);
unsigned int count = component.len; unsigned int count = component.len;
for (unsigned int i = 1; i < count; i++) for (unsigned int i = 1; i < count; i++)
c->input.add (component[i]); c->input->add (component[i]);
c->output.add (ligGlyph); c->output->add (ligGlyph);
} }
inline bool would_apply (hb_would_apply_context_t *c) const inline bool would_apply (hb_would_apply_context_t *c) const
@ -767,7 +767,7 @@ struct LigatureSubstFormat1
TRACE_COLLECT_GLYPHS (this); TRACE_COLLECT_GLYPHS (this);
Coverage::Iter iter; Coverage::Iter iter;
for (iter.init (this+coverage); iter.more (); iter.next ()) { for (iter.init (this+coverage); iter.more (); iter.next ()) {
c->input.add (iter.get_glyph ()); c->input->add (iter.get_glyph ());
(this+ligatureSet[iter.get_coverage ()]).collect_glyphs (c); (this+ligatureSet[iter.get_coverage ()]).collect_glyphs (c);
} }
} }
@ -933,20 +933,20 @@ struct ReverseChainSingleSubstFormat1
unsigned int count; unsigned int count;
(this+coverage).add_coverage (&c->input); (this+coverage).add_coverage (c->input);
count = backtrack.len; count = backtrack.len;
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
(this+backtrack[i]).add_coverage (&c->before); (this+backtrack[i]).add_coverage (c->before);
count = lookahead.len; count = lookahead.len;
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
(this+lookahead[i]).add_coverage (&c->after); (this+lookahead[i]).add_coverage (c->after);
const ArrayOf<GlyphID> &substitute = StructAfter<ArrayOf<GlyphID> > (lookahead); const ArrayOf<GlyphID> &substitute = StructAfter<ArrayOf<GlyphID> > (lookahead);
count = substitute.len; count = substitute.len;
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
c->output.add (substitute[i]); c->output->add (substitute[i]);
} }
inline const Coverage &get_coverage (void) const inline const Coverage &get_coverage (void) const

View File

@ -162,17 +162,17 @@ struct hb_collect_glyphs_context_t
nesting_level_left--; nesting_level_left--;
/* Only collect output glyphs in the recursion. */ /* Only collect output glyphs in the recursion. */
hb_collect_glyphs_context_t new_c (this->face, NULL, NULL, NULL, &output, nesting_level_left); hb_collect_glyphs_context_t new_c (this->face, NULL, NULL, NULL, output, nesting_level_left);
recurse_func (&new_c, lookup_index); recurse_func (&new_c, lookup_index);
nesting_level_left++; nesting_level_left++;
return VOID; return VOID;
} }
hb_face_t *face; hb_face_t *face;
hb_set_t &before; hb_set_t *before;
hb_set_t &input; hb_set_t *input;
hb_set_t &after; hb_set_t *after;
hb_set_t &output; hb_set_t *output;
recurse_func_t recurse_func; recurse_func_t recurse_func;
unsigned int nesting_level_left; unsigned int nesting_level_left;
unsigned int debug_depth; unsigned int debug_depth;
@ -184,10 +184,10 @@ struct hb_collect_glyphs_context_t
hb_set_t *glyphs_output, /* OUT. May be NULL */ hb_set_t *glyphs_output, /* OUT. May be NULL */
unsigned int nesting_level_left_ = MAX_NESTING_LEVEL) : unsigned int nesting_level_left_ = MAX_NESTING_LEVEL) :
face (face_), face (face_),
before (glyphs_before ? *glyphs_before : *hb_set_get_empty ()), before (glyphs_before ? glyphs_before : hb_set_get_empty ()),
input (glyphs_input ? *glyphs_input : *hb_set_get_empty ()), input (glyphs_input ? glyphs_input : hb_set_get_empty ()),
after (glyphs_after ? *glyphs_after : *hb_set_get_empty ()), after (glyphs_after ? glyphs_after : hb_set_get_empty ()),
output (glyphs_output ? *glyphs_output : *hb_set_get_empty ()), output (glyphs_output ? glyphs_output : hb_set_get_empty ()),
recurse_func (NULL), recurse_func (NULL),
nesting_level_left (nesting_level_left_), nesting_level_left (nesting_level_left_),
debug_depth (0) {} debug_depth (0) {}
@ -918,7 +918,7 @@ static inline void context_collect_glyphs_lookup (hb_collect_glyphs_context_t *c
const LookupRecord lookupRecord[], const LookupRecord lookupRecord[],
ContextCollectGlyphsLookupContext &lookup_context) ContextCollectGlyphsLookupContext &lookup_context)
{ {
collect_array (c, &c->input, collect_array (c, c->input,
inputCount ? inputCount - 1 : 0, input, inputCount ? inputCount - 1 : 0, input,
lookup_context.funcs.collect, lookup_context.collect_data); lookup_context.funcs.collect, lookup_context.collect_data);
recurse_lookups (c, recurse_lookups (c,
@ -1090,7 +1090,7 @@ struct ContextFormat1
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
{ {
TRACE_COLLECT_GLYPHS (this); TRACE_COLLECT_GLYPHS (this);
(this+coverage).add_coverage (&c->input); (this+coverage).add_coverage (c->input);
struct ContextCollectGlyphsLookupContext lookup_context = { struct ContextCollectGlyphsLookupContext lookup_context = {
{collect_glyph}, {collect_glyph},
@ -1178,7 +1178,7 @@ struct ContextFormat2
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
{ {
TRACE_COLLECT_GLYPHS (this); TRACE_COLLECT_GLYPHS (this);
(this+coverage).add_coverage (&c->input); (this+coverage).add_coverage (c->input);
struct ContextCollectGlyphsLookupContext lookup_context = { struct ContextCollectGlyphsLookupContext lookup_context = {
{collect_class}, {collect_class},
@ -1268,7 +1268,7 @@ struct ContextFormat3
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
{ {
TRACE_COLLECT_GLYPHS (this); TRACE_COLLECT_GLYPHS (this);
(this+coverage[0]).add_coverage (&c->input); (this+coverage[0]).add_coverage (c->input);
const LookupRecord *lookupRecord = &StructAtOffset<LookupRecord> (coverage, coverage[0].static_size * glyphCount); const LookupRecord *lookupRecord = &StructAtOffset<LookupRecord> (coverage, coverage[0].static_size * glyphCount);
struct ContextCollectGlyphsLookupContext lookup_context = { struct ContextCollectGlyphsLookupContext lookup_context = {
@ -1428,13 +1428,13 @@ static inline void chain_context_collect_glyphs_lookup (hb_collect_glyphs_contex
const LookupRecord lookupRecord[], const LookupRecord lookupRecord[],
ChainContextCollectGlyphsLookupContext &lookup_context) ChainContextCollectGlyphsLookupContext &lookup_context)
{ {
collect_array (c, &c->before, collect_array (c, c->before,
backtrackCount, backtrack, backtrackCount, backtrack,
lookup_context.funcs.collect, lookup_context.collect_data[0]); lookup_context.funcs.collect, lookup_context.collect_data[0]);
collect_array (c, &c->input, collect_array (c, c->input,
inputCount ? inputCount - 1 : 0, input, inputCount ? inputCount - 1 : 0, input,
lookup_context.funcs.collect, lookup_context.collect_data[1]); lookup_context.funcs.collect, lookup_context.collect_data[1]);
collect_array (c, &c->after, collect_array (c, c->after,
lookaheadCount, lookahead, lookaheadCount, lookahead,
lookup_context.funcs.collect, lookup_context.collect_data[2]); lookup_context.funcs.collect, lookup_context.collect_data[2]);
recurse_lookups (c, recurse_lookups (c,
@ -1647,7 +1647,7 @@ struct ChainContextFormat1
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
{ {
TRACE_COLLECT_GLYPHS (this); TRACE_COLLECT_GLYPHS (this);
(this+coverage).add_coverage (&c->input); (this+coverage).add_coverage (c->input);
struct ChainContextCollectGlyphsLookupContext lookup_context = { struct ChainContextCollectGlyphsLookupContext lookup_context = {
{collect_glyph}, {collect_glyph},
@ -1737,7 +1737,7 @@ struct ChainContextFormat2
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
{ {
TRACE_COLLECT_GLYPHS (this); TRACE_COLLECT_GLYPHS (this);
(this+coverage).add_coverage (&c->input); (this+coverage).add_coverage (c->input);
struct ChainContextCollectGlyphsLookupContext lookup_context = { struct ChainContextCollectGlyphsLookupContext lookup_context = {
{collect_class}, {collect_class},
@ -1850,7 +1850,7 @@ struct ChainContextFormat3
TRACE_COLLECT_GLYPHS (this); TRACE_COLLECT_GLYPHS (this);
const OffsetArrayOf<Coverage> &input = StructAfter<OffsetArrayOf<Coverage> > (backtrack); const OffsetArrayOf<Coverage> &input = StructAfter<OffsetArrayOf<Coverage> > (backtrack);
(this+input[0]).add_coverage (&c->input); (this+input[0]).add_coverage (c->input);
const OffsetArrayOf<Coverage> &lookahead = StructAfter<OffsetArrayOf<Coverage> > (input); const OffsetArrayOf<Coverage> &lookahead = StructAfter<OffsetArrayOf<Coverage> > (input);
const ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead); const ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead);