[buffer] Restructure swap_buffers()

Is more of a "commit" operation now. Will rename when ready.
This commit is contained in:
Behdad Esfahbod 2021-07-12 17:09:03 -06:00
parent a7f4c985a8
commit 10a9960f0a
1 changed files with 7 additions and 13 deletions

View File

@ -317,29 +317,23 @@ hb_buffer_t::clear_positions ()
void void
hb_buffer_t::swap_buffers () hb_buffer_t::swap_buffers ()
{ {
if (unlikely (!successful)) return; assert (have_output);
assert (idx <= len); assert (idx <= len);
if (unlikely (!next_glyphs (len - idx))) return;
assert (have_output); if (unlikely (!successful || !next_glyphs (len - idx)))
have_output = false; goto reset;
if (out_info != info) if (out_info != info)
{ {
hb_glyph_info_t *tmp; pos = (hb_glyph_position_t *) info;
tmp = info;
info = out_info; info = out_info;
out_info = tmp;
pos = (hb_glyph_position_t *) out_info;
} }
unsigned int tmp;
tmp = len;
len = out_len; len = out_len;
out_len = tmp;
reset:
have_output = false;
out_len = 0;
idx = 0; idx = 0;
} }