[buffer] Merge two functions into a template

This commit is contained in:
Behdad Esfahbod committed 2025-02-06 02:37:10 +00:00
1 parent 403f12f766
commit e5e3bc4080
4 files changed
+6 -11

No files matched your search

+1 -1
View File
@@ -93,7 +93,7 @@ struct hb_aat_apply_context_t :
using_buffer_glyph_set = buffer->len >= 4;
if (using_buffer_glyph_set)
buffer_glyph_set = buffer->bit_set ();
buffer_glyph_set = buffer->collect_codepoints<hb_bit_set_t> ();
}
bool buffer_intersects_machine () const
{
+3 -8
View File
@@ -198,15 +198,10 @@ struct hb_buffer_t
__attribute__((always_inline))
hb_glyph_info_t prev () const { return out_info[out_len ? out_len - 1 : 0]; }
hb_set_digest_t digest () const
template <typename set_t>
set_t collect_codepoints () const
{
hb_set_digest_t d;
d.add_array (&info[0].codepoint, len, sizeof (info[0]));
return d;
}
hb_bit_set_t bit_set () const
{
hb_bit_set_t d;
set_t d;
d.add_array (&info[0].codepoint, len, sizeof (info[0]));
return d;
}
+1 -1
View File
@@ -763,7 +763,7 @@ struct hb_ot_apply_context_t :
nullptr
#endif
),
digest (buffer_->digest ()),
digest (buffer_->collect_codepoints<hb_set_digest_t> ()),
direction (buffer_->props.direction),
has_glyph_classes (gdef.has_glyph_classes ())
{ init_iters (); }
+1 -1
View File
@@ -2059,7 +2059,7 @@ inline void hb_ot_map_t::apply (const Proxy &proxy,
if (stage->pause_func (plan, font, buffer))
{
/* Refresh working buffer digest since buffer changed. */
c.digest = buffer->digest ();
c.digest = buffer->collect_codepoints<hb_set_digest_t> ();
}
}
}