[varc] Use a varStore cache

pull/4578/head
Behdad Esfahbod 11 months ago
parent 9489c85651
commit a7fd55569e
  1. 7
      src/OT/Var/VARC/VARC.cc
  2. 15
      src/OT/Var/VARC/VARC.hh

@ -134,7 +134,8 @@ VarComponent::get_path_at (hb_font_t *font,
hb_ubytes_t total_record,
hb_set_t *visited,
signed *edges_left,
signed depth_left) const
signed depth_left,
VarRegionList::cache_t *cache) const
{
auto &VARC = *font->face->table.VARC;
const unsigned char *end = total_record.arrayZ + total_record.length;
@ -206,7 +207,7 @@ VarComponent::get_path_at (hb_font_t *font,
uint32_t axisValuesVarIdx;
READ_UINT32VAR (axisValuesVarIdx);
if (show && coords && !axisValues.in_error ())
varStore.get_delta (axisValuesVarIdx, coords, axisValues.as_array ());
varStore.get_delta (axisValuesVarIdx, coords, axisValues.as_array (), cache);
}
auto component_coords = coords;
@ -269,7 +270,7 @@ VarComponent::get_path_at (hb_font_t *font,
transformValues[numTransformValues++] = transform.name;
PROCESS_TRANSFORM_COMPONENTS;
#undef PROCESS_TRANSFORM_COMPONENT
varStore.get_delta (transformVarIdx, coords, hb_array (transformValues, numTransformValues));
varStore.get_delta (transformVarIdx, coords, hb_array (transformValues, numTransformValues), cache);
numTransformValues = 0;
#define PROCESS_TRANSFORM_COMPONENT(type, flag, name) \
if (flags & (unsigned) flags_t::flag) \

@ -49,7 +49,8 @@ struct VarComponent
hb_ubytes_t record,
hb_set_t *visited,
signed *edges_left,
signed depth_left) const;
signed depth_left,
VarRegionList::cache_t *cache = nullptr) const;
};
struct VarCompositeGlyph
@ -62,7 +63,8 @@ struct VarCompositeGlyph
hb_ubytes_t record,
hb_set_t *visited,
signed *edges_left,
signed depth_left)
signed depth_left,
VarRegionList::cache_t *cache = nullptr)
{
while (record)
{
@ -70,7 +72,7 @@ struct VarCompositeGlyph
record = comp.get_path_at (font, glyph,
draw_session, coords,
record,
visited, edges_left, depth_left);
visited, edges_left, depth_left, cache);
}
}
};
@ -126,11 +128,16 @@ struct VARC
return true;
visited->add (glyph);
VarRegionList::cache_t *cache = (this+varStore).create_cache ();
hb_ubytes_t record = (this+glyphRecords)[idx];
VarCompositeGlyph::get_path_at (font, glyph,
draw_session, coords,
record,
visited, edges_left, depth_left);
visited, edges_left, depth_left,
cache);
(this+varStore).destroy_cache (cache);
visited->del (glyph);

Loading…
Cancel
Save