Add 1-param passthrough constructor to hb_auto_t<>

And use.
This commit is contained in:
Behdad Esfahbod 2018-08-25 21:08:15 -07:00
parent c8cfb702e9
commit ddea4d19cf
2 changed files with 4 additions and 4 deletions

View File

@ -492,6 +492,7 @@ template <typename Type>
struct hb_auto_t : Type struct hb_auto_t : Type
{ {
hb_auto_t (void) { Type::init (); } hb_auto_t (void) { Type::init (); }
template <typename T1> hb_auto_t (T1 t1) { Type::init (t1); }
~hb_auto_t (void) { Type::fini (); } ~hb_auto_t (void) { Type::fini (); }
private: /* Hide */ private: /* Hide */
void init (void) {} void init (void) {}

View File

@ -243,6 +243,7 @@ struct CmapSubtableFormat4
glyphIdArray = idRangeOffset + segCount; glyphIdArray = idRangeOffset + segCount;
glyphIdArrayLength = (subtable->length - 16 - 8 * segCount) / 2; glyphIdArrayLength = (subtable->length - 16 - 8 * segCount) / 2;
} }
inline void fini (void) {}
inline bool get_glyph (hb_codepoint_t codepoint, hb_codepoint_t *glyph) const inline bool get_glyph (hb_codepoint_t codepoint, hb_codepoint_t *glyph) const
{ {
@ -313,14 +314,12 @@ struct CmapSubtableFormat4
inline bool get_glyph (hb_codepoint_t codepoint, hb_codepoint_t *glyph) const inline bool get_glyph (hb_codepoint_t codepoint, hb_codepoint_t *glyph) const
{ {
accelerator_t accel; hb_auto_t<accelerator_t> accel (this);
accel.init (this);
return accel.get_glyph_func (&accel, codepoint, glyph); return accel.get_glyph_func (&accel, codepoint, glyph);
} }
inline void collect_unicodes (hb_set_t *out) const inline void collect_unicodes (hb_set_t *out) const
{ {
accelerator_t accel; hb_auto_t<accelerator_t> accel (this);
accel.init (this);
accel.collect_unicodes (out); accel.collect_unicodes (out);
} }