[subset-glyf] Reduce roundf calls
Saves 7% on MPLUS1-Variable/6000 benchmark.
This commit is contained in:
parent
463ae07e99
commit
356d135ed6
|
@ -113,25 +113,25 @@ struct Glyph
|
||||||
if (unlikely (!glyph_header)) return false;
|
if (unlikely (!glyph_header)) return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int xMin = 0, xMax = 0;
|
float xMin = 0, xMax = 0;
|
||||||
int yMin = 0, yMax = 0;
|
float yMin = 0, yMax = 0;
|
||||||
if (all_points.length > 4)
|
if (all_points.length > 4)
|
||||||
{
|
{
|
||||||
xMin = xMax = roundf (all_points[0].x);
|
xMin = xMax = all_points[0].x;
|
||||||
yMin = yMax = roundf (all_points[0].y);
|
yMin = yMax = all_points[0].y;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned i = 1; i < all_points.length - 4; i++)
|
for (unsigned i = 1; i < all_points.length - 4; i++)
|
||||||
{
|
{
|
||||||
float rounded_x = roundf (all_points[i].x);
|
float x = all_points[i].x;
|
||||||
float rounded_y = roundf (all_points[i].y);
|
float y = all_points[i].y;
|
||||||
xMin = hb_min (xMin, rounded_x);
|
xMin = hb_min (xMin, x);
|
||||||
xMax = hb_max (xMax, rounded_x);
|
xMax = hb_max (xMax, x);
|
||||||
yMin = hb_min (yMin, rounded_y);
|
yMin = hb_min (yMin, y);
|
||||||
yMax = hb_max (yMax, rounded_y);
|
yMax = hb_max (yMax, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
update_mtx (plan, xMin, yMax, all_points);
|
update_mtx (plan, roundf (xMin), roundf (yMax), all_points);
|
||||||
|
|
||||||
/*for empty glyphs: all_points only include phantom points.
|
/*for empty glyphs: all_points only include phantom points.
|
||||||
*just update metrics and then return */
|
*just update metrics and then return */
|
||||||
|
@ -139,10 +139,10 @@ struct Glyph
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
glyph_header->numberOfContours = header->numberOfContours;
|
glyph_header->numberOfContours = header->numberOfContours;
|
||||||
glyph_header->xMin = xMin;
|
glyph_header->xMin = roundf (xMin);
|
||||||
glyph_header->yMin = yMin;
|
glyph_header->yMin = roundf (yMin);
|
||||||
glyph_header->xMax = xMax;
|
glyph_header->xMax = roundf (xMax);
|
||||||
glyph_header->yMax = yMax;
|
glyph_header->yMax = roundf (yMax);
|
||||||
|
|
||||||
dest_bytes = hb_bytes_t ((const char *)glyph_header, GlyphHeader::static_size);
|
dest_bytes = hb_bytes_t ((const char *)glyph_header, GlyphHeader::static_size);
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue