From a0bb93e3249f7c4aa8be5505bcda28d0686c7ae2 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 21 Feb 2025 18:21:59 -0700 Subject: [PATCH] [hvgl] Optimize is_translate_only --- src/hb-aat-var-hvgl-table.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/hb-aat-var-hvgl-table.cc b/src/hb-aat-var-hvgl-table.cc index 18bdac313..8b782ac98 100644 --- a/src/hb-aat-var-hvgl-table.cc +++ b/src/hb-aat-var-hvgl-table.cc @@ -418,6 +418,7 @@ PartComposite::apply_to_transforms (hb_array_t> transform break; hb_transform_t transform; + bool is_translate_only = true; if (master_rotation_count && *master_rotation_indices == row) @@ -428,6 +429,7 @@ PartComposite::apply_to_transforms (hb_array_t> transform transform = hb_transform_t::rotation ((double) *master_rotation_deltas); else transform.rotate ((double) *master_rotation_deltas, true); + is_translate_only = false; master_rotation_count--; master_rotation_indices++; master_rotation_deltas++; @@ -497,16 +499,21 @@ PartComposite::apply_to_transforms (hb_array_t> transform transform2.rotate ((double) extremum_rotation_delta * scalar, true); transform2.translate (eigen_x, eigen_y, true); transform.transform (transform2); + is_translate_only = false; } else { // No rotation, just scale the translate transform.translate ((double) extremum_translation_delta.x * scalar, - (double) extremum_translation_delta.y * scalar); + (double) extremum_translation_delta.y * scalar, + is_translate_only); } } - transforms[row].transform (transform, true); + if (is_translate_only) + transforms[row].translate (transform.x0, transform.y0, true); + else + transforms[row].transform (transform, true); } }