Revert "Remove unneeded buffer clear_output / remove_output calls"

This reverts commit 06175b7143.

One of the sanitizers is failing. Pushing again as PR to debug.
I have suspicions.
This commit is contained in:
Behdad Esfahbod 2021-06-15 15:38:49 -06:00
parent 06175b7143
commit 93e6a9bc4e
4 changed files with 21 additions and 5 deletions

View File

@ -281,6 +281,16 @@ 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,6 +209,7 @@ 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,9 +1857,8 @@ apply_string (OT::hb_ot_apply_context_t *c,
if (likely (!lookup.is_reverse ()))
{
/* in/out forward substitution/positioning */
if (!Proxy::inplace)
if (Proxy::table_index == 0u)
buffer->clear_output ();
buffer->idx = 0;
bool ret;
@ -1875,7 +1874,10 @@ 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);
}
}
@ -1891,8 +1893,7 @@ 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++)
{
@ -1914,7 +1915,10 @@ 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,7 +551,6 @@ 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 ();
}
@ -1128,6 +1127,8 @@ 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);