* src/truetype/ttgxvar.c (tt_var_get_item_delta): Minor refactoring.

This commit is contained in:
Alexei Podtelezhnikov 2024-05-20 22:47:14 -04:00
parent 4ccdc9f982
commit 39f2fbf80c
1 changed files with 13 additions and 15 deletions

View File

@ -1074,6 +1074,9 @@
/* inner loop steps through axes in this region */ /* inner loop steps through axes in this region */
for ( j = 0; j < itemStore->axisCount; j++, axis++ ) for ( j = 0; j < itemStore->axisCount; j++, axis++ )
{ {
FT_Fixed ncv = ttface->blend->normalizedcoords[j];
/* compute the scalar contribution of this axis; */ /* compute the scalar contribution of this axis; */
/* ignore invalid ranges */ /* ignore invalid ranges */
if ( axis->startCoord > axis->peakCoord || if ( axis->startCoord > axis->peakCoord ||
@ -1089,28 +1092,23 @@
else if ( axis->peakCoord == 0 ) else if ( axis->peakCoord == 0 )
continue; continue;
else if ( ttface->blend->normalizedcoords[j] == axis->peakCoord )
continue;
/* ignore this region if coords are out of range */ /* ignore this region if coords are out of range */
else if ( ttface->blend->normalizedcoords[j] <= axis->startCoord || else if ( ncv <= axis->startCoord ||
ttface->blend->normalizedcoords[j] >= axis->endCoord ) ncv >= axis->endCoord )
{ {
scalar = 0; scalar = 0;
break; break;
} }
/* cumulative product of all the axis scalars */ /* cumulative product of all the axis scalars */
else if ( ttface->blend->normalizedcoords[j] < axis->peakCoord ) else if ( ncv < axis->peakCoord )
scalar = scalar = FT_MulDiv( scalar,
FT_MulDiv( scalar, ncv - axis->startCoord,
ttface->blend->normalizedcoords[j] - axis->startCoord, axis->peakCoord - axis->startCoord );
axis->peakCoord - axis->startCoord ); else if ( ncv > axis->peakCoord )
else scalar = FT_MulDiv( scalar,
scalar = axis->endCoord - ncv,
FT_MulDiv( scalar, axis->endCoord - axis->peakCoord );
axis->endCoord - ttface->blend->normalizedcoords[j],
axis->endCoord - axis->peakCoord );
} /* per-axis loop */ } /* per-axis loop */