mirror of https://github.com/freetype/freetype
[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];
|
||||
|
||||
|
||||
/* compute the scalar contribution of this axis; */
|
||||
/* ignore invalid ranges */
|
||||
if ( axis->startCoord > axis->peakCoord ||
|
||||
axis->peakCoord > axis->endCoord )
|
||||
/* compute the scalar contribution of this axis */
|
||||
/* while running mandatory range checks */
|
||||
if ( axis->peakCoord == NDV[j] ||
|
||||
axis->peakCoord == 0 )
|
||||
continue;
|
||||
|
||||
else if ( axis->startCoord < 0 &&
|
||||
axis->endCoord > 0 &&
|
||||
axis->peakCoord != 0 )
|
||||
axis->endCoord > 0 )
|
||||
continue;
|
||||
|
||||
/* peak of 0 means ignore this axis */
|
||||
else if ( axis->peakCoord == 0 )
|
||||
else if ( axis->startCoord > axis->peakCoord ||
|
||||
axis->peakCoord > axis->endCoord )
|
||||
continue;
|
||||
|
||||
/* ignore this region if coords are out of range */
|
||||
else if ( NDV[j] < axis->startCoord ||
|
||||
NDV[j] > axis->endCoord )
|
||||
else if ( NDV[j] <= axis->startCoord ||
|
||||
NDV[j] >= axis->endCoord )
|
||||
{
|
||||
blend->BV[master] = 0;
|
||||
break;
|
||||
|
@ -1525,8 +1524,7 @@
|
|||
blend->BV[master] = FT_MulDiv( blend->BV[master],
|
||||
NDV[j] - axis->startCoord,
|
||||
axis->peakCoord - axis->startCoord );
|
||||
|
||||
else if ( NDV[j] > axis->peakCoord )
|
||||
else /* NDV[j] > axis->peakCoord ) */
|
||||
blend->BV[master] = FT_MulDiv( blend->BV[master],
|
||||
axis->endCoord - NDV[j],
|
||||
axis->endCoord - axis->peakCoord );
|
||||
|
|
|
@ -1077,24 +1077,23 @@
|
|||
FT_Fixed ncv = ttface->blend->normalizedcoords[j];
|
||||
|
||||
|
||||
/* compute the scalar contribution of this axis; */
|
||||
/* ignore invalid ranges */
|
||||
if ( axis->startCoord > axis->peakCoord ||
|
||||
axis->peakCoord > axis->endCoord )
|
||||
/* compute the scalar contribution of this axis */
|
||||
/* while running mandatory range checks */
|
||||
if ( axis->peakCoord == ncv ||
|
||||
axis->peakCoord == 0 )
|
||||
continue;
|
||||
|
||||
else if ( axis->startCoord < 0 &&
|
||||
axis->endCoord > 0 &&
|
||||
axis->peakCoord != 0 )
|
||||
axis->endCoord > 0 )
|
||||
continue;
|
||||
|
||||
/* peak of 0 means ignore this axis */
|
||||
else if ( axis->peakCoord == 0 )
|
||||
else if ( axis->startCoord > axis->peakCoord ||
|
||||
axis->peakCoord > axis->endCoord )
|
||||
continue;
|
||||
|
||||
/* ignore this region if coords are out of range */
|
||||
else if ( ncv < axis->startCoord ||
|
||||
ncv > axis->endCoord )
|
||||
else if ( ncv <= axis->startCoord ||
|
||||
ncv >= axis->endCoord )
|
||||
{
|
||||
scalar = 0;
|
||||
break;
|
||||
|
@ -1105,7 +1104,7 @@
|
|||
scalar = FT_MulDiv( scalar,
|
||||
ncv - axis->startCoord,
|
||||
axis->peakCoord - axis->startCoord );
|
||||
else if ( ncv > axis->peakCoord )
|
||||
else /* ncv > axis->peakCoord */
|
||||
scalar = FT_MulDiv( scalar,
|
||||
axis->endCoord - ncv,
|
||||
axis->endCoord - axis->peakCoord );
|
||||
|
|
Loading…
Reference in New Issue