[gvar] Simplify ref_points logic

This commit is contained in:
Behdad Esfahbod 2023-04-25 14:03:52 -06:00
parent 78a0216a03
commit 808a21f8de

View file

@ -333,14 +333,12 @@ struct gvar
hb_memset (deltas.arrayZ, 0, deltas.get_size ());
}
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;
auto &delta = deltas.arrayZ[pt_index];
ref_points += !delta.flag;
delta.flag = 1; /* this point is referenced, i.e., explicit deltas specified */
delta.x += x_deltas.arrayZ[i] * scalar;
delta.y += y_deltas.arrayZ[i] * scalar;
@ -351,14 +349,13 @@ struct gvar
unsigned int pt_index = apply_to_all ? i : indices[i];
if (unlikely (pt_index >= deltas.length)) continue;
auto &delta = deltas.arrayZ[pt_index];
ref_points += !delta.flag;
delta.flag = 1; /* this point is referenced, i.e., explicit deltas specified */
delta.x += x_deltas.arrayZ[i];
delta.y += y_deltas.arrayZ[i];
}
/* infer deltas for unreferenced points */
if (ref_points && ref_points < points.length)
if (!apply_to_all)
{
if (!end_points)
for (unsigned i = 0; i < points.length; ++i)