summaryrefslogtreecommitdiffstats
path: root/thirdparty/harfbuzz/src/OT/glyf/CompositeGlyph.hh
diff options
context:
space:
mode:
Diffstat (limited to 'thirdparty/harfbuzz/src/OT/glyf/CompositeGlyph.hh')
-rw-r--r--thirdparty/harfbuzz/src/OT/glyf/CompositeGlyph.hh41
1 files changed, 26 insertions, 15 deletions
diff --git a/thirdparty/harfbuzz/src/OT/glyf/CompositeGlyph.hh b/thirdparty/harfbuzz/src/OT/glyf/CompositeGlyph.hh
index d81fadf7c8..60858a5a58 100644
--- a/thirdparty/harfbuzz/src/OT/glyf/CompositeGlyph.hh
+++ b/thirdparty/harfbuzz/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;
}
@@ -382,7 +393,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;
}