[cff, truetype] Rearrange variation range checks.
This should achieve quicker results for common cases. * src/cff/cffload.c (cff_blend_build_vector): Rearrange conditionals. * src/truetype/ttgxvar.c (tt_var_get_item_delta): Ditto.
This commit is contained in:
parent
347276c1f6
commit
99be2b3154
|
@ -1497,24 +1497,23 @@
|
||||||
CFF_AxisCoords* axis = &varRegion->axisList[j];
|
CFF_AxisCoords* axis = &varRegion->axisList[j];
|
||||||
|
|
||||||
|
|
||||||
/* compute the scalar contribution of this axis; */
|
/* compute the scalar contribution of this axis */
|
||||||
/* ignore invalid ranges */
|
/* while running mandatory range checks */
|
||||||
if ( axis->startCoord > axis->peakCoord ||
|
if ( axis->peakCoord == NDV[j] ||
|
||||||
axis->peakCoord > axis->endCoord )
|
axis->peakCoord == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
else if ( axis->startCoord < 0 &&
|
else if ( axis->startCoord < 0 &&
|
||||||
axis->endCoord > 0 &&
|
axis->endCoord > 0 )
|
||||||
axis->peakCoord != 0 )
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* peak of 0 means ignore this axis */
|
else if ( axis->startCoord > axis->peakCoord ||
|
||||||
else if ( axis->peakCoord == 0 )
|
axis->peakCoord > axis->endCoord )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* ignore this region if coords are out of range */
|
/* ignore this region if coords are out of range */
|
||||||
else if ( NDV[j] < axis->startCoord ||
|
else if ( NDV[j] <= axis->startCoord ||
|
||||||
NDV[j] > axis->endCoord )
|
NDV[j] >= axis->endCoord )
|
||||||
{
|
{
|
||||||
blend->BV[master] = 0;
|
blend->BV[master] = 0;
|
||||||
break;
|
break;
|
||||||
|
@ -1525,8 +1524,7 @@
|
||||||
blend->BV[master] = FT_MulDiv( blend->BV[master],
|
blend->BV[master] = FT_MulDiv( blend->BV[master],
|
||||||
NDV[j] - axis->startCoord,
|
NDV[j] - axis->startCoord,
|
||||||
axis->peakCoord - axis->startCoord );
|
axis->peakCoord - axis->startCoord );
|
||||||
|
else /* NDV[j] > axis->peakCoord ) */
|
||||||
else if ( NDV[j] > axis->peakCoord )
|
|
||||||
blend->BV[master] = FT_MulDiv( blend->BV[master],
|
blend->BV[master] = FT_MulDiv( blend->BV[master],
|
||||||
axis->endCoord - NDV[j],
|
axis->endCoord - NDV[j],
|
||||||
axis->endCoord - axis->peakCoord );
|
axis->endCoord - axis->peakCoord );
|
||||||
|
|
|
@ -1077,24 +1077,23 @@
|
||||||
FT_Fixed ncv = ttface->blend->normalizedcoords[j];
|
FT_Fixed ncv = ttface->blend->normalizedcoords[j];
|
||||||
|
|
||||||
|
|
||||||
/* compute the scalar contribution of this axis; */
|
/* compute the scalar contribution of this axis */
|
||||||
/* ignore invalid ranges */
|
/* while running mandatory range checks */
|
||||||
if ( axis->startCoord > axis->peakCoord ||
|
if ( axis->peakCoord == ncv ||
|
||||||
axis->peakCoord > axis->endCoord )
|
axis->peakCoord == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
else if ( axis->startCoord < 0 &&
|
else if ( axis->startCoord < 0 &&
|
||||||
axis->endCoord > 0 &&
|
axis->endCoord > 0 )
|
||||||
axis->peakCoord != 0 )
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* peak of 0 means ignore this axis */
|
else if ( axis->startCoord > axis->peakCoord ||
|
||||||
else if ( axis->peakCoord == 0 )
|
axis->peakCoord > axis->endCoord )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* ignore this region if coords are out of range */
|
/* ignore this region if coords are out of range */
|
||||||
else if ( ncv < axis->startCoord ||
|
else if ( ncv <= axis->startCoord ||
|
||||||
ncv > axis->endCoord )
|
ncv >= axis->endCoord )
|
||||||
{
|
{
|
||||||
scalar = 0;
|
scalar = 0;
|
||||||
break;
|
break;
|
||||||
|
@ -1105,7 +1104,7 @@
|
||||||
scalar = FT_MulDiv( scalar,
|
scalar = FT_MulDiv( scalar,
|
||||||
ncv - axis->startCoord,
|
ncv - axis->startCoord,
|
||||||
axis->peakCoord - axis->startCoord );
|
axis->peakCoord - axis->startCoord );
|
||||||
else if ( ncv > axis->peakCoord )
|
else /* ncv > axis->peakCoord */
|
||||||
scalar = FT_MulDiv( scalar,
|
scalar = FT_MulDiv( scalar,
|
||||||
axis->endCoord - ncv,
|
axis->endCoord - ncv,
|
||||||
axis->endCoord - axis->peakCoord );
|
axis->endCoord - axis->peakCoord );
|
||||||
|
|
Loading…
Reference in New Issue