Remove unneeded buffer clear_output / remove_output calls

Made sure clear_output is always paired with swap_buffers.
Trying to see if we can move towards RAII-like buffer iterators
instead of the buffer keeping an iterator internally.
This commit is contained in:
Behdad Esfahbod 2021-06-15 14:33:27 -06:00
parent bdfed8f113
commit 06175b7143
4 changed files with 5 additions and 21 deletions

View File

@ -281,16 +281,6 @@ hb_buffer_t::add_info (const hb_glyph_info_t &glyph_info)
}
void
hb_buffer_t::remove_output ()
{
have_output = false;
have_positions = false;
out_len = 0;
out_info = info;
}
void
hb_buffer_t::clear_output ()
{

View File

@ -209,7 +209,6 @@ struct hb_buffer_t
HB_INTERNAL void guess_segment_properties ();
HB_INTERNAL void swap_buffers ();
HB_INTERNAL void remove_output ();
HB_INTERNAL void clear_output ();
HB_INTERNAL void clear_positions ();

View File

@ -1857,8 +1857,9 @@ apply_string (OT::hb_ot_apply_context_t *c,
if (likely (!lookup.is_reverse ()))
{
/* in/out forward substitution/positioning */
if (Proxy::table_index == 0u)
if (!Proxy::inplace)
buffer->clear_output ();
buffer->idx = 0;
bool ret;
@ -1874,10 +1875,7 @@ apply_string (OT::hb_ot_apply_context_t *c,
else
{
/* in-place backward substitution/positioning */
if (Proxy::table_index == 0u)
buffer->remove_output ();
buffer->idx = buffer->len - 1;
apply_backward (c, accel);
}
}
@ -1893,7 +1891,8 @@ inline void hb_ot_map_t::apply (const Proxy &proxy,
OT::hb_ot_apply_context_t c (table_index, font, buffer);
c.set_recurse_func (Proxy::Lookup::apply_recurse_func);
for (unsigned int stage_index = 0; stage_index < stages[table_index].length; stage_index++) {
for (unsigned int stage_index = 0; stage_index < stages[table_index].length; stage_index++)
{
const stage_map_t *stage = &stages[table_index][stage_index];
for (; i < stage->last_lookup; i++)
{
@ -1915,10 +1914,7 @@ inline void hb_ot_map_t::apply (const Proxy &proxy,
}
if (stage->pause_func)
{
buffer->clear_output ();
stage->pause_func (plan, font, buffer);
}
}
}

View File

@ -551,6 +551,7 @@ hb_insert_dotted_circle (hb_buffer_t *buffer, hb_font_t *font)
info.cluster = buffer->cur().cluster;
info.mask = buffer->cur().mask;
(void) buffer->output_info (info);
buffer->swap_buffers ();
}
@ -1127,8 +1128,6 @@ hb_ot_shape_internal (hb_ot_shape_context_t *c)
_hb_buffer_allocate_unicode_vars (c->buffer);
c->buffer->clear_output ();
hb_ot_shape_initialize_masks (c);
hb_set_unicode_props (c->buffer);
hb_insert_dotted_circle (c->buffer, c->font);