[buffer] Add sync_so_far()
This removes separate out-buffer, at the cost of possibly changing idx.
This commit is contained in:
parent
cbccadba8d
commit
da9edce84c
|
@ -387,9 +387,11 @@ hb_buffer_t::clear_positions ()
|
|||
hb_memset (pos, 0, sizeof (pos[0]) * len);
|
||||
}
|
||||
|
||||
void
|
||||
bool
|
||||
hb_buffer_t::sync ()
|
||||
{
|
||||
bool ret = false;
|
||||
|
||||
assert (have_output);
|
||||
|
||||
assert (idx <= len);
|
||||
|
@ -403,12 +405,36 @@ hb_buffer_t::sync ()
|
|||
info = out_info;
|
||||
}
|
||||
len = out_len;
|
||||
ret = true;
|
||||
|
||||
reset:
|
||||
have_output = false;
|
||||
out_len = 0;
|
||||
out_info = info;
|
||||
idx = 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
hb_buffer_t::sync_so_far ()
|
||||
{
|
||||
bool had_output = have_output;
|
||||
unsigned out_i = out_len;
|
||||
unsigned i = idx;
|
||||
|
||||
if (sync ())
|
||||
idx = out_i;
|
||||
else
|
||||
idx = i;
|
||||
|
||||
if (had_output)
|
||||
{
|
||||
have_output = true;
|
||||
out_len = idx;
|
||||
}
|
||||
|
||||
assert (idx <= len);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -288,7 +288,8 @@ struct hb_buffer_t
|
|||
|
||||
HB_INTERNAL void guess_segment_properties ();
|
||||
|
||||
HB_INTERNAL void sync ();
|
||||
HB_INTERNAL bool sync ();
|
||||
HB_INTERNAL void sync_so_far ();
|
||||
HB_INTERNAL void clear_output ();
|
||||
HB_INTERNAL void clear_positions ();
|
||||
|
||||
|
|
Loading…
Reference in New Issue