[glyf] Regain speed if variations are all zero

We always have coords array populated now... Check for non-zero.
This commit is contained in:
Behdad Esfahbod committed 2025-03-02 17:03:15 -07:00
1 parent 181b2ed946
commit d4bf8a7734
5 files changed
+5 -16

No files matched your search

+1 -1
View File
@@ -223,7 +223,7 @@ VarComponent::get_path_at (hb_font_t *font,
* limit on the max number of coords for now. */
if ((flags & (unsigned) flags_t::RESET_UNSPECIFIED_AXES) ||
coords.length > HB_VAR_COMPOSITE_MAX_AXES)
component_coords = hb_array<int> (font->coords, font->num_coords);
component_coords = hb_array (font->coords, font->num_coords);
// Transform
+2 -2
View File
@@ -328,7 +328,7 @@ struct Glyph
head_maxp_info->maxComponentDepth = hb_max (head_maxp_info->maxComponentDepth, depth);
}
if (!coords)
if (!coords && font->has_nonzero_coords)
coords = hb_array (font->coords, font->num_coords);
contour_point_vector_t &points = type == SIMPLE ? all_points : scratch.comp_points;
@@ -383,7 +383,7 @@ struct Glyph
}
#ifndef HB_NO_VAR
if (coords)
if (hb_any (coords))
{
#ifndef HB_NO_BEYOND_64K
if (glyf_accelerator.GVAR->has_data ())
+1 -1
View File
@@ -434,7 +434,7 @@ struct glyf_accelerator_t
hb_codepoint_t gid,
hb_glyph_extents_t *extents) const
{ return get_extents_at (font, gid, extents, hb_array (font->coords,
font->has_nonzer_coords ? font->num_coords : 0)); }
font->has_nonzero_coords ? font->num_coords : 0)); }
bool get_extents_at (hb_font_t *font,
hb_codepoint_t gid,
+1 -8
View File
@@ -1886,14 +1886,7 @@ _hb_font_adopt_var_coords (hb_font_t *font,
font->coords = coords;
font->design_coords = design_coords;
font->num_coords = coords_length;
font->has_nonzero_coords = false;
for (unsigned int i = 0; i < coords_length; i++)
if (coords[i])
{
font->has_nonzero_coords = true;
break;
}
font->has_nonzero_coords = hb_any (hb_array (coords, coords_length));
font->mults_changed (); // Easiest to call this to drop cached data
}
-4
View File
@@ -33,16 +33,12 @@ template <typename Float = float>
struct hb_extents_t
{
hb_extents_t () {}
<<<<<<< HEAD
hb_extents_t (const hb_glyph_extents_t &extents) :
xmin (hb_min (extents.x_bearing, extents.x_bearing + extents.width)),
ymin (hb_min (extents.y_bearing, extents.y_bearing + extents.height)),
xmax (hb_max (extents.x_bearing, extents.x_bearing + extents.width)),
ymax (hb_max (extents.y_bearing, extents.y_bearing + extents.height)) {}
hb_extents_t (float xmin, float ymin, float xmax, float ymax) :
=======
hb_extents_t (Float xmin, Float ymin, Float xmax, Float ymax) :
>>>>>>> a5e4453dd ([hvgl] Use double instead of float for coords & transforms)
xmin (xmin), ymin (ymin), xmax (xmax), ymax (ymax) {}
bool is_empty () const { return xmin >= xmax || ymin >= ymax; }