From 0fd3c5f7cac2a45b37feeef829d57193a57cae12 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 26 Sep 2024 15:07:00 -0600 Subject: [PATCH] [HVAC] Micro-optimize --- src/hb-ot-var-hvac-table.hh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/hb-ot-var-hvac-table.hh b/src/hb-ot-var-hvac-table.hh index c1bab52a8..69f3f0d54 100644 --- a/src/hb-ot-var-hvac-table.hh +++ b/src/hb-ot-var-hvac-table.hh @@ -49,23 +49,26 @@ struct GlyphVariationDelta hb_array_t points, const SparseVarRegionList &varRegionList) const { - float scalar = varRegionList.evaluate (regionIndex, coords, coords.length); + float scalar = varRegionList.evaluate (regionIndex, coords.arrayZ, coords.length); if (scalar == 0) return; + if (unlikely (points.length < deltasCount)) + return; + const float *x = deltasZ; const float *y = deltasZ + deltasCount; if (scalar == 1) for (unsigned i = 0; i < deltasCount; i++) { - auto &point = points[i]; + auto &point = points.arrayZ[i]; point.x += x[i]; point.y += y[i]; } else for (unsigned i = 0; i < deltasCount; i++) { - auto &point = points[i]; + auto &point = points.arrayZ[i]; point.x += x[i] * scalar; point.y += y[i] * scalar; }