From ee9873b5ede5ee14a542dd1d4bc470695487c5f4 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 22 Nov 2022 10:23:17 -0700 Subject: [PATCH] [gvar] Disable initializing vectors when not necessary --- src/hb-ot-var-gvar-table.hh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/hb-ot-var-gvar-table.hh b/src/hb-ot-var-gvar-table.hh index 1dee8d188..2977e84ac 100644 --- a/src/hb-ot-var-gvar-table.hh +++ b/src/hb-ot-var-gvar-table.hh @@ -56,7 +56,7 @@ struct contour_point_vector_t : hb_vector_t void extend (const hb_array_t &a) { unsigned int old_len = length; - if (unlikely (!resize (old_len + a.length))) + if (unlikely (!resize (old_len + a.length, false))) return; auto arrayZ = this->arrayZ + old_len; unsigned count = a.length; @@ -287,7 +287,7 @@ struct GlyphVariationData if (unlikely (p + 1 > end)) return false; count = ((count & POINT_RUN_COUNT_MASK) << 8) | *p++; } - if (unlikely (!points.resize (count))) return false; + if (unlikely (!points.resize (count, false))) return false; unsigned int n = 0; uint16_t i = 0; @@ -565,12 +565,12 @@ struct gvar /* Save original points for inferred delta calculation */ contour_point_vector_t orig_points; - if (unlikely (!orig_points.resize (points.length))) return false; + if (unlikely (!orig_points.resize (points.length, false))) return false; for (unsigned int i = 0; i < orig_points.length; i++) orig_points.arrayZ[i] = points.arrayZ[i]; contour_point_vector_t deltas; /* flag is used to indicate referenced point */ - if (unlikely (!deltas.resize (points.length))) return false; + if (unlikely (!deltas.resize (points.length, false))) return false; hb_vector_t end_points; for (unsigned i = 0; i < points.length; ++i) @@ -603,13 +603,13 @@ struct gvar bool apply_to_all = (indices.length == 0); unsigned int num_deltas = apply_to_all ? points.length : indices.length; - if (unlikely (!x_deltas.resize (num_deltas))) return false; + if (unlikely (!x_deltas.resize (num_deltas, false))) return false; if (unlikely (!GlyphVariationData::unpack_deltas (p, x_deltas, end))) return false; - if (unlikely (!y_deltas.resize (num_deltas))) return false; + if (unlikely (!y_deltas.resize (num_deltas, false))) return false; if (unlikely (!GlyphVariationData::unpack_deltas (p, y_deltas, end))) return false; for (unsigned int i = 0; i < deltas.length; i++) - deltas[i].init (); + deltas.arrayZ[i].init (); for (unsigned int i = 0; i < num_deltas; i++) { unsigned int pt_index = apply_to_all ? i : indices[i];