Merge buffer->out_pos and buffer->out_length
This commit is contained in:
parent
22f668eb9a
commit
8e6b6bb293
|
@ -113,7 +113,6 @@ struct _hb_buffer_t {
|
|||
unsigned int in_length;
|
||||
unsigned int out_length;
|
||||
unsigned int in_pos;
|
||||
unsigned int out_pos; /* out_length and out_pos are actually always the same */
|
||||
|
||||
hb_internal_glyph_info_t *in_string;
|
||||
hb_internal_glyph_info_t *out_string;
|
||||
|
|
|
@ -184,7 +184,6 @@ hb_buffer_clear (hb_buffer_t *buffer)
|
|||
buffer->in_length = 0;
|
||||
buffer->out_length = 0;
|
||||
buffer->in_pos = 0;
|
||||
buffer->out_pos = 0;
|
||||
buffer->out_string = buffer->in_string;
|
||||
buffer->max_lig_id = 0;
|
||||
}
|
||||
|
@ -247,7 +246,6 @@ _hb_buffer_clear_output (hb_buffer_t *buffer)
|
|||
buffer->have_output = TRUE;
|
||||
buffer->have_positions = FALSE;
|
||||
buffer->out_length = 0;
|
||||
buffer->out_pos = 0;
|
||||
buffer->out_string = buffer->in_string;
|
||||
}
|
||||
|
||||
|
@ -287,9 +285,7 @@ _hb_buffer_swap (hb_buffer_t *buffer)
|
|||
buffer->in_length = buffer->out_length;
|
||||
buffer->out_length = tmp;
|
||||
|
||||
tmp = buffer->in_pos;
|
||||
buffer->in_pos = buffer->out_pos;
|
||||
buffer->out_pos = tmp;
|
||||
buffer->in_pos = 0;
|
||||
}
|
||||
|
||||
/* The following function copies `num_out' elements from `glyph_data'
|
||||
|
@ -325,9 +321,9 @@ _hb_buffer_add_output_glyphs (hb_buffer_t *buffer,
|
|||
unsigned int cluster;
|
||||
|
||||
if (buffer->out_string != buffer->in_string ||
|
||||
buffer->out_pos + num_out > buffer->in_pos + num_in)
|
||||
buffer->out_length + num_out > buffer->in_pos + num_in)
|
||||
{
|
||||
hb_buffer_ensure_separate (buffer, buffer->out_pos + num_out);
|
||||
hb_buffer_ensure_separate (buffer, buffer->out_length + num_out);
|
||||
}
|
||||
|
||||
mask = buffer->in_string[buffer->in_pos].mask;
|
||||
|
@ -339,7 +335,7 @@ _hb_buffer_add_output_glyphs (hb_buffer_t *buffer,
|
|||
|
||||
for (i = 0; i < num_out; i++)
|
||||
{
|
||||
hb_internal_glyph_info_t *info = &buffer->out_string[buffer->out_pos + i];
|
||||
hb_internal_glyph_info_t *info = &buffer->out_string[buffer->out_length + i];
|
||||
info->codepoint = glyph_data[i];
|
||||
info->mask = mask;
|
||||
info->cluster = cluster;
|
||||
|
@ -349,8 +345,7 @@ _hb_buffer_add_output_glyphs (hb_buffer_t *buffer,
|
|||
}
|
||||
|
||||
buffer->in_pos += num_in;
|
||||
buffer->out_pos += num_out;
|
||||
buffer->out_length = buffer->out_pos;
|
||||
buffer->out_length += num_out;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -366,9 +361,9 @@ _hb_buffer_add_output_glyphs_be16 (hb_buffer_t *buffer,
|
|||
unsigned int cluster;
|
||||
|
||||
if (buffer->out_string != buffer->in_string ||
|
||||
buffer->out_pos + num_out > buffer->in_pos + num_in)
|
||||
buffer->out_length + num_out > buffer->in_pos + num_in)
|
||||
{
|
||||
hb_buffer_ensure_separate (buffer, buffer->out_pos + num_out);
|
||||
hb_buffer_ensure_separate (buffer, buffer->out_length + num_out);
|
||||
}
|
||||
|
||||
mask = buffer->in_string[buffer->in_pos].mask;
|
||||
|
@ -380,7 +375,7 @@ _hb_buffer_add_output_glyphs_be16 (hb_buffer_t *buffer,
|
|||
|
||||
for (i = 0; i < num_out; i++)
|
||||
{
|
||||
hb_internal_glyph_info_t *info = &buffer->out_string[buffer->out_pos + i];
|
||||
hb_internal_glyph_info_t *info = &buffer->out_string[buffer->out_length + i];
|
||||
info->codepoint = hb_be_uint16 (glyph_data_be[i]);
|
||||
info->mask = mask;
|
||||
info->cluster = cluster;
|
||||
|
@ -390,8 +385,7 @@ _hb_buffer_add_output_glyphs_be16 (hb_buffer_t *buffer,
|
|||
}
|
||||
|
||||
buffer->in_pos += num_in;
|
||||
buffer->out_pos += num_out;
|
||||
buffer->out_length = buffer->out_pos;
|
||||
buffer->out_length += num_out;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -404,13 +398,13 @@ _hb_buffer_add_output_glyph (hb_buffer_t *buffer,
|
|||
|
||||
if (buffer->out_string != buffer->in_string)
|
||||
{
|
||||
hb_buffer_ensure (buffer, buffer->out_pos + 1);
|
||||
buffer->out_string[buffer->out_pos] = buffer->in_string[buffer->in_pos];
|
||||
hb_buffer_ensure (buffer, buffer->out_length + 1);
|
||||
buffer->out_string[buffer->out_length] = buffer->in_string[buffer->in_pos];
|
||||
}
|
||||
else if (buffer->out_pos != buffer->in_pos)
|
||||
buffer->out_string[buffer->out_pos] = buffer->in_string[buffer->in_pos];
|
||||
else if (buffer->out_length != buffer->in_pos)
|
||||
buffer->out_string[buffer->out_length] = buffer->in_string[buffer->in_pos];
|
||||
|
||||
info = &buffer->out_string[buffer->out_pos];
|
||||
info = &buffer->out_string[buffer->out_length];
|
||||
info->codepoint = glyph_index;
|
||||
if (component != 0xFFFF)
|
||||
info->component = component;
|
||||
|
@ -419,8 +413,7 @@ _hb_buffer_add_output_glyph (hb_buffer_t *buffer,
|
|||
info->gproperty = HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN;
|
||||
|
||||
buffer->in_pos++;
|
||||
buffer->out_pos++;
|
||||
buffer->out_length = buffer->out_pos;
|
||||
buffer->out_length++;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -430,14 +423,13 @@ _hb_buffer_next_glyph (hb_buffer_t *buffer)
|
|||
{
|
||||
if (buffer->out_string != buffer->in_string)
|
||||
{
|
||||
hb_buffer_ensure (buffer, buffer->out_pos + 1);
|
||||
buffer->out_string[buffer->out_pos] = buffer->in_string[buffer->in_pos];
|
||||
hb_buffer_ensure (buffer, buffer->out_length + 1);
|
||||
buffer->out_string[buffer->out_length] = buffer->in_string[buffer->in_pos];
|
||||
}
|
||||
else if (buffer->out_pos != buffer->in_pos)
|
||||
buffer->out_string[buffer->out_pos] = buffer->in_string[buffer->in_pos];
|
||||
else if (buffer->out_length != buffer->in_pos)
|
||||
buffer->out_string[buffer->out_length] = buffer->in_string[buffer->in_pos];
|
||||
|
||||
buffer->out_pos++;
|
||||
buffer->out_length = buffer->out_pos;
|
||||
buffer->out_length++;
|
||||
}
|
||||
|
||||
buffer->in_pos++;
|
||||
|
|
|
@ -289,7 +289,7 @@ struct AlternateSubstFormat1
|
|||
/* XXX callback to user to choose alternate
|
||||
if (c->layout->face->altfunc)
|
||||
alt_index = (c->layout->face->altfunc)(c->layout->layout, c->buffer,
|
||||
c->buffer->out_pos, glyph_id,
|
||||
c->buffer->out_length, glyph_id,
|
||||
alt_set.len, alt_set.array);
|
||||
*/
|
||||
|
||||
|
|
|
@ -116,10 +116,10 @@ static inline bool match_backtrack (hb_apply_context_t *c,
|
|||
match_func_t match_func,
|
||||
const void *match_data)
|
||||
{
|
||||
if (unlikely (c->buffer->out_pos < count))
|
||||
if (unlikely (c->buffer->out_length < count))
|
||||
return false;
|
||||
|
||||
for (unsigned int i = 0, j = c->buffer->out_pos - 1; i < count; i++, j--)
|
||||
for (unsigned int i = 0, j = c->buffer->out_length - 1; i < count; i++, j--)
|
||||
{
|
||||
while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->out_string[j], c->lookup_flag, NULL))
|
||||
{
|
||||
|
@ -519,7 +519,7 @@ static inline bool chain_context_lookup (hb_apply_context_t *c,
|
|||
ChainContextLookupContext &lookup_context)
|
||||
{
|
||||
/* First guess */
|
||||
if (unlikely (c->buffer->out_pos < backtrackCount ||
|
||||
if (unlikely (c->buffer->out_length < backtrackCount ||
|
||||
c->buffer->in_pos + inputCount + lookaheadCount > c->buffer->in_length ||
|
||||
inputCount + lookaheadCount > c->context_length))
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue