[Composites] Pre-alloc phantom-points space

This commit is contained in:
Behdad Esfahbod 2023-04-27 14:39:33 -06:00
parent 0c7cb57539
commit f90e3fc3f4
2 changed files with 2 additions and 0 deletions

View file

@ -108,6 +108,7 @@ 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[points.length - 1] = trans;
return true;

View file

@ -196,6 +196,7 @@ struct VarCompositeGlyphRecord
{
unsigned num_points = get_num_points ();
points.alloc (points.length + num_points + 4); // For phantom points
if (unlikely (!points.resize (points.length + num_points, false))) return false;
contour_point_t *rec_points = points.as_array ().sub_array (points.length - num_points).arrayZ;
memset (rec_points, 0, num_points * sizeof (rec_points[0]));