[gvar] Error handling & micro-optimization

This commit is contained in:
Behdad Esfahbod 2023-04-26 13:19:27 -06:00
parent b6aa2d71f3
commit 0938673731
2 changed files with 4 additions and 3 deletions

View file

@ -270,7 +270,7 @@ struct TupleVariationHeader
if (shared_tuple_active_idx)
{
int v = (*shared_tuple_active_idx)[index];
int v = (*shared_tuple_active_idx).arrayZ[index];
if (v != -1)
{
start_idx = v;

View file

@ -227,7 +227,7 @@ struct gvar
hb_array_t<const F2DOT14> shared_tuples = (table+table->sharedTuples).as_array (table->sharedTupleCount * table->axisCount);
unsigned count = table->sharedTupleCount;
shared_tuple_active_idx.resize (count);
if (unlikely (!shared_tuple_active_idx.resize (count, false))) return;
unsigned axis_count = table->axisCount;
for (unsigned i = 0; i < count; i++)
{
@ -316,7 +316,8 @@ struct gvar
bool flush = false;
do
{
float scalar = iterator.current_tuple->calculate_scalar (coords, num_coords, shared_tuples, &shared_tuple_active_idx);
float scalar = iterator.current_tuple->calculate_scalar (coords, num_coords, shared_tuples,
shared_tuple_active_idx.in_error () ? nullptr : &shared_tuple_active_idx);
if (scalar == 0.f) continue;
const HBUINT8 *p = iterator.get_serialized_data ();
unsigned int length = iterator.current_tuple->get_data_size ();