Add UnsizedArrayOf::as_array() instead of hb_array() template
This commit is contained in:
parent
1cf075ecb6
commit
72462eb765
|
@ -55,7 +55,7 @@ struct TrackTableEntry
|
|||
unsigned int index,
|
||||
unsigned int nSizes) const
|
||||
{
|
||||
return hb_array (base+valuesZ, nSizes)[index];
|
||||
return (base+valuesZ).as_array (nSizes)[index];
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
|
@ -572,8 +572,6 @@ struct hb_array_t
|
|||
T *arrayZ;
|
||||
unsigned int len;
|
||||
};
|
||||
template <typename T> static inline
|
||||
hb_array_t<T> hb_array (T *array, unsigned int len) { return hb_array_t<T> (array, len); }
|
||||
|
||||
|
||||
struct HbOpOr
|
||||
|
|
|
@ -330,7 +330,7 @@ struct ResourceTypeRecord
|
|||
inline const ResourceRecord& get_resource_record (unsigned int i,
|
||||
const void *type_base) const
|
||||
{
|
||||
return hb_array (type_base+resourcesZ, get_resource_count ())[i];
|
||||
return (type_base+resourcesZ).as_array (get_resource_count ())[i];
|
||||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c,
|
||||
|
|
|
@ -346,6 +346,9 @@ struct UnsizedArrayOf
|
|||
inline unsigned int get_size (unsigned int len) const
|
||||
{ return len * Type::static_size; }
|
||||
|
||||
inline hb_array_t<Type> as_array (unsigned int len) { return hb_array_t<Type> (arrayZ, len); }
|
||||
inline hb_array_t<const Type> as_array (unsigned int len) const { return hb_array_t<const Type> (arrayZ, len); }
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c, unsigned int count) const
|
||||
{
|
||||
TRACE_SANITIZE (this);
|
||||
|
@ -393,14 +396,6 @@ struct UnsizedArrayOf
|
|||
public:
|
||||
DEFINE_SIZE_ARRAY (0, arrayZ);
|
||||
};
|
||||
} /* namespace OT */
|
||||
template <typename T> static inline
|
||||
hb_array_t<T> hb_array (OT::UnsizedArrayOf<T> &array, unsigned int len)
|
||||
{ return hb_array (array.arrayZ, len); }
|
||||
template <typename T> static inline
|
||||
hb_array_t<const T> hb_array (const OT::UnsizedArrayOf<T> &array, unsigned int len)
|
||||
{ return hb_array (array.arrayZ, len); }
|
||||
namespace OT {
|
||||
|
||||
/* Unsized array of offset's */
|
||||
template <typename Type, typename OffsetType, bool has_null=true>
|
||||
|
|
|
@ -55,7 +55,7 @@ struct CPALV1Tail
|
|||
{
|
||||
if (!paletteFlagsZ) return HB_OT_COLOR_PALETTE_FLAG_DEFAULT;
|
||||
return (hb_ot_color_palette_flags_t) (uint32_t)
|
||||
hb_array (base+paletteFlagsZ, palette_count)[palette_index];
|
||||
(base+paletteFlagsZ).as_array (palette_count)[palette_index];
|
||||
}
|
||||
|
||||
inline hb_ot_name_id_t
|
||||
|
@ -64,7 +64,7 @@ struct CPALV1Tail
|
|||
unsigned int palette_count) const
|
||||
{
|
||||
if (!paletteLabelsZ) return HB_OT_NAME_ID_INVALID;
|
||||
return hb_array (base+paletteLabelsZ, palette_count)[palette_index];
|
||||
return (base+paletteLabelsZ).as_array (palette_count)[palette_index];
|
||||
}
|
||||
|
||||
inline hb_ot_name_id_t
|
||||
|
@ -73,7 +73,7 @@ struct CPALV1Tail
|
|||
unsigned int color_count) const
|
||||
{
|
||||
if (!colorLabelsZ) return HB_OT_NAME_ID_INVALID;
|
||||
return hb_array (base+colorLabelsZ, color_count)[color_index];
|
||||
return (base+colorLabelsZ).as_array (color_count)[color_index];
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
Loading…
Reference in New Issue