Revert "[varc] Reuse x_deltas and y_deltas vectors"

This reverts commit 604f27b3069f2ef11b045cfb35e8c3a5fd99fb8b.

Not worth it.
This commit is contained in:
Behdad Esfahbod committed 2024-04-16 17:10:46 -06:00
1 parent f97d1ea235
commit e8139bea2e
5 files changed
+14 -48

No files matched your search

+2 -5
View File
@@ -135,9 +135,7 @@ VarComponent::get_path_at (hb_font_t *font,
hb_set_t *visited,
signed *edges_left,
signed depth_left,
VarRegionList::cache_t *cache,
hb_vector_t<int> *x_deltas_cache,
hb_vector_t<int> *y_deltas_cache) const
VarRegionList::cache_t *cache) const
{
auto &VARC = *font->face->table.VARC;
const unsigned char *end = total_record.arrayZ + total_record.length;
@@ -329,8 +327,7 @@ VarComponent::get_path_at (hb_font_t *font,
VARC.get_path_at (font, gid,
transformer_session, component_coords,
parent_gid,
visited, edges_left, depth_left - 1,
x_deltas_cache, y_deltas_cache);
visited, edges_left, depth_left - 1);
}
#undef PROCESS_TRANSFORM_COMPONENTS
+6 -21
View File
@@ -50,9 +50,7 @@ struct VarComponent
hb_set_t *visited,
signed *edges_left,
signed depth_left,
VarRegionList::cache_t *cache = nullptr,
hb_vector_t<int> *x_deltas_cache = nullptr,
hb_vector_t<int> *y_deltas_cache = nullptr) const;
VarRegionList::cache_t *cache = nullptr) const;
};
struct VarCompositeGlyph
@@ -66,25 +64,15 @@ struct VarCompositeGlyph
hb_set_t *visited,
signed *edges_left,
signed depth_left,
VarRegionList::cache_t *cache = nullptr,
hb_vector_t<int> *x_deltas_cache = nullptr,
hb_vector_t<int> *y_deltas_cache = nullptr)
VarRegionList::cache_t *cache = nullptr)
{
hb_vector_t<int> x_deltas_stack;
hb_vector_t<int> y_deltas_stack;
if (x_deltas_cache == nullptr)
x_deltas_cache = &x_deltas_stack;
if (y_deltas_cache == nullptr)
y_deltas_cache = &y_deltas_stack;
while (record)
{
const VarComponent &comp = * (const VarComponent *) (record.arrayZ);
record = comp.get_path_at (font, glyph,
draw_session, coords,
record,
visited, edges_left, depth_left,
cache, x_deltas_cache, y_deltas_cache);
visited, edges_left, depth_left, cache);
}
}
};
@@ -105,9 +93,7 @@ struct VARC
hb_codepoint_t parent_glyph = HB_CODEPOINT_INVALID,
hb_set_t *visited = nullptr,
signed *edges_left = nullptr,
signed depth_left = HB_MAX_NESTING_LEVEL,
hb_vector_t<int> *x_deltas_cache = nullptr,
hb_vector_t<int> *y_deltas_cache = nullptr) const
signed depth_left = HB_MAX_NESTING_LEVEL) const
{
hb_set_t stack_set;
if (visited == nullptr)
@@ -122,7 +108,7 @@ struct VARC
(this+coverage).get_coverage (glyph);
if (idx == NOT_COVERED)
{
if (!font->face->table.glyf->get_path_at (font, glyph, draw_session, coords, x_deltas_cache, y_deltas_cache))
if (!font->face->table.glyf->get_path_at (font, glyph, draw_session, coords))
#ifndef HB_NO_CFF
if (!font->face->table.cff2->get_path_at (font, glyph, draw_session, coords))
if (!font->face->table.cff1->get_path (font, glyph, draw_session)) // Doesn't have variations
@@ -152,8 +138,7 @@ struct VARC
draw_session, coords,
record,
visited, edges_left, depth_left,
cache,
x_deltas_cache, y_deltas_cache);
cache);
(this+varStore).destroy_cache (cache);
-5
View File
@@ -312,8 +312,6 @@ struct Glyph
bool use_my_metrics = true,
bool phantom_only = false,
hb_array_t<const int> coords = hb_array_t<const int> (),
hb_vector_t<int> *x_deltas_cache = nullptr,
hb_vector_t<int> *y_deltas_cache = nullptr,
hb_map_t *current_glyphs = nullptr,
unsigned int depth = 0,
unsigned *edge_count = nullptr) const
@@ -393,7 +391,6 @@ struct Glyph
glyf_accelerator.gvar->apply_deltas_to_points (gid,
coords,
points.as_array ().sub_array (old_length),
x_deltas_cache, y_deltas_cache,
phantom_only && type == SIMPLE);
#endif
@@ -436,8 +433,6 @@ struct Glyph
use_my_metrics,
phantom_only,
coords,
x_deltas_cache,
y_deltas_cache,
current_glyphs,
depth + 1,
edge_count)))
+4 -10
View File
@@ -206,9 +206,7 @@ struct glyf_accelerator_t
protected:
template<typename T>
bool get_points (hb_font_t *font, hb_codepoint_t gid, T consumer,
hb_array_t<const int> coords = hb_array_t<const int> (),
hb_vector_t<int> *x_deltas_cache = nullptr,
hb_vector_t<int> *y_deltas_cache = nullptr) const
hb_array_t<const int> coords = hb_array_t<const int> ()) const
{
if (!coords)
coords = hb_array (font->coords, font->num_coords);
@@ -222,8 +220,7 @@ struct glyf_accelerator_t
contour_point_vector_t all_points;
bool phantom_only = !consumer.is_consuming_contour_points ();
if (unlikely (!glyph_for_gid (gid).get_points (font, *this, all_points, nullptr, nullptr, nullptr, true, true, phantom_only, coords,
x_deltas_cache, y_deltas_cache)))
if (unlikely (!glyph_for_gid (gid).get_points (font, *this, all_points, nullptr, nullptr, nullptr, true, true, phantom_only, coords)))
return false;
unsigned count = all_points.length;
@@ -417,11 +414,8 @@ struct glyf_accelerator_t
bool
get_path_at (hb_font_t *font, hb_codepoint_t gid, hb_draw_session_t &draw_session,
hb_array_t<const int> coords,
hb_vector_t<int> *x_deltas_cache = nullptr,
hb_vector_t<int> *y_deltas_cache = nullptr) const
{ return get_points (font, gid, glyf_impl::path_builder_t (font, draw_session), coords,
x_deltas_cache, y_deltas_cache); }
hb_array_t<const int> coords) const
{ return get_points (font, gid, glyf_impl::path_builder_t (font, draw_session), coords); }
#ifndef HB_NO_VAR
const gvar_accelerator_t *gvar;
+2 -7
View File
@@ -623,17 +623,10 @@ struct gvar
bool apply_deltas_to_points (hb_codepoint_t glyph,
hb_array_t<const int> coords,
const hb_array_t<contour_point_t> points,
hb_vector_t<int> *x_deltas_cache = nullptr,
hb_vector_t<int> *y_deltas_cache = nullptr,
bool phantom_only = false) const
{
if (unlikely (glyph >= glyphCount)) return true;
hb_vector_t<int> x_deltas_stack;
hb_vector_t<int> y_deltas_stack;
hb_vector_t<int> &x_deltas = x_deltas_cache ? *x_deltas_cache : x_deltas_stack;
hb_vector_t<int> &y_deltas = y_deltas_cache ? *y_deltas_cache : y_deltas_stack;
hb_bytes_t var_data_bytes = table->get_glyph_var_data_bytes (table.get_blob (), glyphCount, glyph);
if (!var_data_bytes.as<GlyphVariationData> ()->has_data ()) return true;
hb_vector_t<unsigned int> shared_indices;
@@ -657,6 +650,8 @@ struct gvar
hb_array_t<const F2DOT14> shared_tuples = (table+table->sharedTuples).as_array (table->sharedTupleCount * num_coords);
hb_vector_t<unsigned int> private_indices;
hb_vector_t<int> x_deltas;
hb_vector_t<int> y_deltas;
unsigned count = points.length;
bool flush = false;
do