[CompositeGlyph] Micro-optimize translate()

pull/4150/merge
Behdad Esfahbod 1 year ago
parent 229db9735e
commit 04809ede8e
  1. 18
      src/OT/glyf/CompositeGlyph.hh

@ -105,10 +105,28 @@ struct CompositeGlyphRecord
auto arrayZ = points.arrayZ;
unsigned count = points.length;
if (HB_OPTIMIZE_SIZE_VAL)
{
if (trans.x != 0.f || trans.y != 0.f)
for (unsigned i = 0; i < count; i++)
arrayZ[i].translate (trans);
}
else
{
if (trans.x != 0.f && trans.y != 0.f)
for (unsigned i = 0; i < count; i++)
arrayZ[i].translate (trans);
else
{
if (trans.x != 0.f)
for (unsigned i = 0; i < count; i++)
arrayZ[i].x += trans.x;
else if (trans.y != 0.f)
for (unsigned i = 0; i < count; i++)
arrayZ[i].y += trans.y;
}
}
}
void transform_points (hb_array_t<contour_point_t> points,
const float (&matrix)[4],

Loading…
Cancel
Save