[gvar] Don't try IUP if all points are specified

This commit is contained in:
Behdad Esfahbod 2022-11-22 13:21:01 -07:00
parent 27c4037e59
commit c34c77698c
1 changed files with 47 additions and 41 deletions

View File

@ -612,11 +612,13 @@ struct gvar
hb_memset (deltas.arrayZ, 0, deltas.length * sizeof (deltas.arrayZ[0]));
unsigned ref_points = 0;
if (scalar != 1.0f)
for (unsigned int i = 0; i < num_deltas; i++)
{
unsigned int pt_index = apply_to_all ? i : indices[i];
if (unlikely (pt_index >= deltas.length)) continue;
ref_points += !deltas.arrayZ[pt_index].flag;
deltas.arrayZ[pt_index].flag = 1; /* this point is referenced, i.e., explicit deltas specified */
deltas.arrayZ[pt_index].x += x_deltas.arrayZ[i] * scalar;
deltas.arrayZ[pt_index].y += y_deltas.arrayZ[i] * scalar;
@ -626,12 +628,15 @@ struct gvar
{
unsigned int pt_index = apply_to_all ? i : indices[i];
if (unlikely (pt_index >= deltas.length)) continue;
ref_points += !deltas.arrayZ[pt_index].flag;
deltas.arrayZ[pt_index].flag = 1; /* this point is referenced, i.e., explicit deltas specified */
deltas.arrayZ[pt_index].x += x_deltas.arrayZ[i];
deltas.arrayZ[pt_index].y += y_deltas.arrayZ[i];
}
/* infer deltas for unreferenced points */
if (ref_points < orig_points.length)
{
unsigned start_point = 0;
for (unsigned c = 0; c < end_points.length; c++)
{
@ -680,6 +685,7 @@ struct gvar
no_more_gaps:
start_point = end_point + 1;
}
}
/* apply specified / inferred deltas to points */
for (unsigned int i = 0; i < points.length; i++)