diff options
Diffstat (limited to 'src/3rdparty/harfbuzz-ng/src/OT/glyf/CompositeGlyph.hh')
-rw-r--r-- | src/3rdparty/harfbuzz-ng/src/OT/glyf/CompositeGlyph.hh | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/src/3rdparty/harfbuzz-ng/src/OT/glyf/CompositeGlyph.hh b/src/3rdparty/harfbuzz-ng/src/OT/glyf/CompositeGlyph.hh index d81fadf7c8..5c0ecd5133 100644 --- a/src/3rdparty/harfbuzz-ng/src/OT/glyf/CompositeGlyph.hh +++ b/src/3rdparty/harfbuzz-ng/src/OT/glyf/CompositeGlyph.hh @@ -90,24 +90,36 @@ struct CompositeGlyphRecord static void transform (const float (&matrix)[4], hb_array_t<contour_point_t> points) { - auto arrayZ = points.arrayZ; - unsigned count = points.length; - if (matrix[0] != 1.f || matrix[1] != 0.f || matrix[2] != 0.f || matrix[3] != 1.f) - for (unsigned i = 0; i < count; i++) - arrayZ[i].transform (matrix); + for (auto &point : points) + point.transform (matrix); } static void translate (const contour_point_t &trans, hb_array_t<contour_point_t> points) { - auto arrayZ = points.arrayZ; - unsigned count = points.length; - - if (trans.x != 0.f || trans.y != 0.f) - for (unsigned i = 0; i < count; i++) - arrayZ[i].translate (trans); + if (HB_OPTIMIZE_SIZE_VAL) + { + if (trans.x != 0.f || trans.y != 0.f) + for (auto &point : points) + point.translate (trans); + } + else + { + if (trans.x != 0.f && trans.y != 0.f) + for (auto &point : points) + point.translate (trans); + else + { + if (trans.x != 0.f) + for (auto &point : points) + point.x += trans.x; + else if (trans.y != 0.f) + for (auto &point : points) + point.y += trans.y; + } + } } void transform_points (hb_array_t<contour_point_t> points, @@ -131,9 +143,8 @@ struct CompositeGlyphRecord float matrix[4]; contour_point_t trans; get_transformation (matrix, trans); - points.alloc (points.length + 4); // For phantom points - if (unlikely (!points.resize (points.length + 1))) return false; - points.arrayZ[points.length - 1] = trans; + if (unlikely (!points.alloc (points.length + 4))) return false; // For phantom points + points.push (trans); return true; } @@ -229,7 +240,8 @@ struct CompositeGlyphRecord } if (is_anchored ()) tx = ty = 0; - trans.init ((float) tx, (float) ty); + /* set is_end_point flag to true, used by IUP delta optimization */ + trans.init ((float) tx, (float) ty, true); { const F2DOT14 *points = (const F2DOT14 *) p; @@ -382,7 +394,7 @@ struct CompositeGlyph { /* last 4 points in points_with_deltas are phantom points and should not be included */ if (i >= points_with_deltas.length - 4) { - free (o); + hb_free (o); return false; } |