[gvar] Micro-optize vector extend

This commit is contained in:
Behdad Esfahbod 2022-11-22 11:27:05 -07:00
parent 49d4f62135
commit e630a65e60
1 changed files with 3 additions and 5 deletions

View File

@ -60,8 +60,7 @@ struct contour_point_vector_t : hb_vector_t<contour_point_t>
return; return;
auto arrayZ = this->arrayZ + old_len; auto arrayZ = this->arrayZ + old_len;
unsigned count = a.length; unsigned count = a.length;
for (unsigned int i = 0; i < count; i++) hb_memcpy (arrayZ, a.arrayZ, count * sizeof (arrayZ[0]));
arrayZ[i] = a.arrayZ[i];
} }
void transform (const float (&matrix)[4]) void transform (const float (&matrix)[4])
@ -566,9 +565,8 @@ struct gvar
/* Save original points for inferred delta calculation */ /* Save original points for inferred delta calculation */
contour_point_vector_t orig_points; contour_point_vector_t orig_points;
if (unlikely (!orig_points.resize (points.length, false))) return false; orig_points.extend (points);
for (unsigned int i = 0; i < orig_points.length; i++) if (unlikely (orig_points.in_error ())) return false;
orig_points.arrayZ[i] = points.arrayZ[i];
contour_point_vector_t deltas; /* flag is used to indicate referenced point */ contour_point_vector_t deltas; /* flag is used to indicate referenced point */
if (unlikely (!deltas.resize (points.length, false))) return false; if (unlikely (!deltas.resize (points.length, false))) return false;