[varc] Remove one vector allocation

This commit is contained in:
Behdad Esfahbod committed 2024-04-16 17:10:46 -06:00
1 parent 761468c66f
commit 49c5ed38e4
2 files changed
+5 -5

No files matched your search

+3 -4
View File
@@ -188,18 +188,17 @@ VarComponent::get_path_at (hb_font_t *font,
// Axis values
hb_vector_t<unsigned> axisIndices;
hb_vector_t<signed> axisValuesInt;
hb_vector_t<float> axisValues;
if (flags & (unsigned) flags_t::HAVE_AXES)
{
unsigned axisIndicesIndex;
READ_UINT32VAR (axisIndicesIndex);
axisIndices = (&VARC+VARC.axisIndicesList)[axisIndicesIndex];
axisValuesInt.resize (axisIndices.length);
axisValues.resize (axisIndices.length);
const HBUINT8 *p = (const HBUINT8 *) record;
TupleValues::decompile (p, axisValuesInt, (const HBUINT8 *) end);
TupleValues::decompile (p, axisValues, (const HBUINT8 *) end);
record += (const unsigned char *) p - record;
}
hb_vector_t<float> axisValues (axisValuesInt);
// Apply variations if any
if (flags & (unsigned) flags_t::AXIS_VALUES_HAVE_VARIATION)
+2 -1
View File
@@ -1715,8 +1715,9 @@ struct TupleValues
return encoded_len;
}
template <typename T>
static bool decompile (const HBUINT8 *&p /* IN/OUT */,
hb_vector_t<int> &values /* IN/OUT */,
hb_vector_t<T> &values /* IN/OUT */,
const HBUINT8 *end,
bool consume_all = false)
{