mirror of
https://github.com/harfbuzz/harfbuzz.git
synced 2025-04-05 05:25:05 +00:00
[ItemVariationStore] Make cache atomic floats
Doesn't work with intrinsic atomic implementations. Disabled that. Going through the C++11 atomics path now. Will fix in next commit.
This commit is contained in:
parent
810fbedf27
commit
9cae040bb4
4 changed files with 14 additions and 14 deletions
|
@ -392,7 +392,7 @@ VARC::get_path_at (const hb_varc_context_t &c,
|
|||
|
||||
hb_ubytes_t record = (this+glyphRecords)[idx];
|
||||
|
||||
float static_cache[sizeof (void *) * 16];
|
||||
VarRegionList::cache_t static_cache[sizeof (void *) * 16];
|
||||
VarRegionList::cache_t *cache = parent_cache ?
|
||||
parent_cache :
|
||||
(this+varStore).create_cache (hb_array (static_cache));
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
/* Defined externally, i.e. in config.h. */
|
||||
|
||||
|
||||
#elif !defined(HB_NO_MT) && defined(__ATOMIC_ACQUIRE)
|
||||
#elif !defined(HB_NO_MT) && defined(__ATOMIC_ACQUIRE) && 0
|
||||
|
||||
/* C++11-style GCC primitives. We prefer these as they don't require linking to libstdc++ / libc++. */
|
||||
|
||||
|
|
|
@ -2552,7 +2552,7 @@ struct SparseVarRegionAxis
|
|||
|
||||
struct VarRegionList
|
||||
{
|
||||
using cache_t = float;
|
||||
using cache_t = hb_atomic_t<float>;
|
||||
|
||||
float evaluate (unsigned int region_index,
|
||||
const int *coords, unsigned int coord_len,
|
||||
|
@ -2561,7 +2561,7 @@ struct VarRegionList
|
|||
if (unlikely (region_index >= regionCount))
|
||||
return 0.;
|
||||
|
||||
float *cached_value = nullptr;
|
||||
cache_t *cached_value = nullptr;
|
||||
if (cache)
|
||||
{
|
||||
cached_value = &(cache[region_index]);
|
||||
|
@ -2730,7 +2730,7 @@ struct SparseVariationRegion : Array16Of<SparseVarRegionAxis>
|
|||
|
||||
struct SparseVarRegionList
|
||||
{
|
||||
using cache_t = float;
|
||||
using cache_t = hb_atomic_t<float>;
|
||||
|
||||
float evaluate (unsigned int region_index,
|
||||
const int *coords, unsigned int coord_len,
|
||||
|
@ -2739,7 +2739,7 @@ struct SparseVarRegionList
|
|||
if (unlikely (region_index >= regions.len))
|
||||
return 0.;
|
||||
|
||||
float *cached_value = nullptr;
|
||||
hb_atomic_t<float> *cached_value = nullptr;
|
||||
if (cache)
|
||||
{
|
||||
cached_value = &(cache[region_index]);
|
||||
|
@ -3190,7 +3190,7 @@ struct ItemVariationStore
|
|||
unsigned count = (this+regions).regionCount;
|
||||
if (!count) return nullptr;
|
||||
|
||||
float *cache = (float *) hb_malloc (sizeof (float) * count);
|
||||
cache_t *cache = (cache_t *) hb_malloc (sizeof (float) * count);
|
||||
if (unlikely (!cache)) return nullptr;
|
||||
|
||||
for (unsigned i = 0; i < count; i++)
|
||||
|
@ -3440,7 +3440,7 @@ struct MultiItemVariationStore
|
|||
{
|
||||
using cache_t = SparseVarRegionList::cache_t;
|
||||
|
||||
cache_t *create_cache (hb_array_t<float> static_cache = hb_array_t<float> ()) const
|
||||
cache_t *create_cache (hb_array_t<cache_t> static_cache = hb_array_t<cache_t> ()) const
|
||||
{
|
||||
#ifdef HB_NO_VAR
|
||||
return nullptr;
|
||||
|
@ -3448,12 +3448,12 @@ struct MultiItemVariationStore
|
|||
auto &r = this+regions;
|
||||
unsigned count = r.regions.len;
|
||||
|
||||
float *cache;
|
||||
cache_t *cache;
|
||||
if (count <= static_cache.length)
|
||||
cache = static_cache.arrayZ;
|
||||
else
|
||||
{
|
||||
cache = (float *) hb_malloc (sizeof (float) * count);
|
||||
cache = (cache_t *) hb_malloc (sizeof (float) * count);
|
||||
if (unlikely (!cache)) return nullptr;
|
||||
}
|
||||
|
||||
|
@ -3464,7 +3464,7 @@ struct MultiItemVariationStore
|
|||
}
|
||||
|
||||
static void destroy_cache (cache_t *cache,
|
||||
hb_array_t<float> static_cache = hb_array_t<float> ())
|
||||
hb_array_t<cache_t> static_cache = hb_array_t<cache_t> ())
|
||||
{
|
||||
if (cache != static_cache.arrayZ)
|
||||
hb_free (cache);
|
||||
|
|
|
@ -408,7 +408,7 @@ _remap_variation_indices (const OT::ItemVariationStore &var_store,
|
|||
{
|
||||
if (&var_store == &Null (OT::ItemVariationStore)) return;
|
||||
unsigned subtable_count = var_store.get_sub_table_count ();
|
||||
float *store_cache = var_store.create_cache ();
|
||||
auto *store_cache = var_store.create_cache ();
|
||||
|
||||
unsigned new_major = 0, new_minor = 0;
|
||||
unsigned last_major = (variation_indices.get_min ()) >> 16;
|
||||
|
@ -1161,12 +1161,12 @@ _update_instance_metrics_map_from_cff2 (hb_subset_plan_t *plan)
|
|||
|
||||
hb_glyph_extents_t extents = {0x7FFF, -0x7FFF};
|
||||
OT::hmtx_accelerator_t _hmtx (plan->source);
|
||||
float *hvar_store_cache = nullptr;
|
||||
OT::ItemVariationStore::cache_t *hvar_store_cache = nullptr;
|
||||
if (_hmtx.has_data () && _hmtx.var_table.get_length ())
|
||||
hvar_store_cache = _hmtx.var_table->get_var_store ().create_cache ();
|
||||
|
||||
OT::vmtx_accelerator_t _vmtx (plan->source);
|
||||
float *vvar_store_cache = nullptr;
|
||||
OT::ItemVariationStore::cache_t *vvar_store_cache = nullptr;
|
||||
if (_vmtx.has_data () && _vmtx.var_table.get_length ())
|
||||
vvar_store_cache = _vmtx.var_table->get_var_store ().create_cache ();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue