[buffer] Inline some more

This commit is contained in:
Behdad Esfahbod 2018-10-03 20:09:14 +02:00
parent 6f39c22029
commit 2a6f15213e
2 changed files with 44 additions and 52 deletions

View File

@ -369,37 +369,6 @@ hb_buffer_t::replace_glyphs (unsigned int num_in,
out_len += num_out;
}
void
hb_buffer_t::output_glyph (hb_codepoint_t glyph_index)
{
if (unlikely (!make_room_for (0, 1))) return;
out_info[out_len] = info[idx];
out_info[out_len].codepoint = glyph_index;
out_len++;
}
void
hb_buffer_t::output_info (const hb_glyph_info_t &glyph_info)
{
if (unlikely (!make_room_for (0, 1))) return;
out_info[out_len] = glyph_info;
out_len++;
}
void
hb_buffer_t::copy_glyph (void)
{
if (unlikely (!make_room_for (0, 1))) return;
out_info[out_len] = info[idx];
out_len++;
}
bool
hb_buffer_t::move_to (unsigned int i)
{
@ -442,19 +411,6 @@ hb_buffer_t::move_to (unsigned int i)
return true;
}
void
hb_buffer_t::replace_glyph (hb_codepoint_t glyph_index)
{
if (unlikely (out_info != info || out_len != idx)) {
if (unlikely (!make_room_for (1, 1))) return;
out_info[out_len] = info[idx];
}
out_info[out_len].codepoint = glyph_index;
idx++;
out_len++;
}
void
hb_buffer_t::set_masks (hb_mask_t value,

View File

@ -212,13 +212,46 @@ struct hb_buffer_t
unsigned int num_out,
const hb_codepoint_t *glyph_data);
HB_INTERNAL void replace_glyph (hb_codepoint_t glyph_index);
inline void replace_glyph (hb_codepoint_t glyph_index)
{
if (unlikely (out_info != info || out_len != idx)) {
if (unlikely (!make_room_for (1, 1))) return;
out_info[out_len] = info[idx];
}
out_info[out_len].codepoint = glyph_index;
idx++;
out_len++;
}
/* Makes a copy of the glyph at idx to output and replace glyph_index */
HB_INTERNAL void output_glyph (hb_codepoint_t glyph_index);
HB_INTERNAL void output_info (const hb_glyph_info_t &glyph_info);
inline hb_glyph_info_t & output_glyph (hb_codepoint_t glyph_index)
{
if (unlikely (!make_room_for (0, 1))) return Crap(hb_glyph_info_t);
out_info[out_len] = info[idx];
out_info[out_len].codepoint = glyph_index;
out_len++;
return out_info[out_len - 1];
}
inline void output_info (const hb_glyph_info_t &glyph_info)
{
if (unlikely (!make_room_for (0, 1))) return;
out_info[out_len] = glyph_info;
out_len++;
}
/* Copies glyph at idx to output but doesn't advance idx */
HB_INTERNAL void copy_glyph (void);
HB_INTERNAL bool move_to (unsigned int i); /* i is output-buffer index. */
inline void copy_glyph (void)
{
if (unlikely (!make_room_for (0, 1))) return;
out_info[out_len] = info[idx];
out_len++;
}
/* Copies glyph at idx to output and advance idx.
* If there's no output, just advance idx. */
inline void
@ -235,10 +268,11 @@ struct hb_buffer_t
idx++;
}
/* Advance idx without copying to output. */
inline void skip_glyph (void) { idx++; }
inline void skip_glyph (void)
{
idx++;
}
inline void reset_masks (hb_mask_t mask)
{
for (unsigned int j = 0; j < len; j++)
@ -275,6 +309,8 @@ struct hb_buffer_t
/* Internal methods */
HB_INTERNAL bool move_to (unsigned int i); /* i is output-buffer index. */
HB_INTERNAL bool enlarge (unsigned int size);
inline bool ensure (unsigned int size)