mirror of
https://github.com/harfbuzz/harfbuzz.git
synced 2025-04-04 21:15:06 +00:00
[varStore] Add clear_cache()
This commit is contained in:
parent
da0c459dd4
commit
7da049ed42
1 changed files with 12 additions and 5 deletions
|
@ -3187,16 +3187,23 @@ struct ItemVariationStore
|
||||||
#ifdef HB_NO_VAR
|
#ifdef HB_NO_VAR
|
||||||
return nullptr;
|
return nullptr;
|
||||||
#endif
|
#endif
|
||||||
auto &r = this+regions;
|
unsigned count = (this+regions).regionCount;
|
||||||
unsigned count = r.regionCount;
|
|
||||||
|
|
||||||
float *cache = (float *) hb_malloc (sizeof (float) * count);
|
float *cache = (float *) hb_malloc (sizeof (float) * count);
|
||||||
if (unlikely (!cache)) return nullptr;
|
|
||||||
|
clear_cache (cache);
|
||||||
|
|
||||||
|
return cache;
|
||||||
|
}
|
||||||
|
|
||||||
|
void clear_cache (cache_t *cache) const
|
||||||
|
{
|
||||||
|
if (unlikely (!cache)) return;
|
||||||
|
|
||||||
|
unsigned count = (this+regions).regionCount;
|
||||||
|
|
||||||
for (unsigned i = 0; i < count; i++)
|
for (unsigned i = 0; i < count; i++)
|
||||||
cache[i] = REGION_CACHE_ITEM_CACHE_INVALID;
|
cache[i] = REGION_CACHE_ITEM_CACHE_INVALID;
|
||||||
|
|
||||||
return cache;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void destroy_cache (cache_t *cache) { hb_free (cache); }
|
static void destroy_cache (cache_t *cache) { hb_free (cache); }
|
||||||
|
|
Loading…
Add table
Reference in a new issue