From 700975f732be2eb9b31d538e43a4909311851f55 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 29 Apr 2023 11:23:56 -0600 Subject: [PATCH] [gvar/glyf] Minor save a variable --- src/OT/glyf/Glyph.hh | 3 ++- src/hb-ot-var-gvar-table.hh | 11 ++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/OT/glyf/Glyph.hh b/src/OT/glyf/Glyph.hh index 05bcd5093..e517851e8 100644 --- a/src/OT/glyf/Glyph.hh +++ b/src/OT/glyf/Glyph.hh @@ -157,7 +157,8 @@ struct Glyph yMin = yMax = all_points[0].y; } - for (unsigned i = 1; i < all_points.length - 4; i++) + unsigned count = all_points.length - 4; + for (unsigned i = 1; i < count; i++) { float x = all_points[i].x; float y = all_points[i].y; diff --git a/src/hb-ot-var-gvar-table.hh b/src/hb-ot-var-gvar-table.hh index 90b9d58e2..f9dc4e59a 100644 --- a/src/hb-ot-var-gvar-table.hh +++ b/src/hb-ot-var-gvar-table.hh @@ -341,7 +341,8 @@ struct gvar if (flush) { - for (unsigned int i = 0; i < points.length; i++) + unsigned count = points.length; + for (unsigned int i = 0; i < count; i++) points.arrayZ[i].translate (deltas.arrayZ[i]); flush = false; @@ -421,7 +422,8 @@ struct gvar { if (!end_points) { - for (unsigned i = 0; i < points.length; ++i) + unsigned count = points.length; + for (unsigned i = 0; i < count; ++i) if (points.arrayZ[i].is_end_point) end_points.push (i); if (unlikely (end_points.in_error ())) return false; @@ -481,8 +483,11 @@ struct gvar } while (iterator.move_to_next ()); if (flush) - for (unsigned int i = 0; i < points.length; i++) + { + unsigned count = points.length; + for (unsigned int i = 0; i < count; i++) points.arrayZ[i].translate (deltas.arrayZ[i]); + } return true; }