[truetype] Speed up IUP.

* src/truetype/ttinterp.c (_iup_worker_interpolate): Separate trivial
snapping to the same position from true interpolation.
This commit is contained in:
Alexei Podtelezhnikov 2015-04-27 22:27:00 -04:00
parent b6c511d9d0
commit 40623a1f3a
2 changed files with 22 additions and 10 deletions

View File

@ -1,3 +1,10 @@
2015-04-27 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Speed up IUP.
* src/truetype/ttinterp.c (_iup_worker_interpolate): Separate trivial
snapping to the same position from true interpolation.
2015-04-21 Werner Lemberg <wl@gnu.org>
[autofit] By default, enable warping code but switch off warping.

View File

@ -6783,7 +6783,7 @@
FT_UInt ref2 )
{
FT_UInt i;
FT_F26Dot6 orus1, orus2, org1, org2, delta1, delta2;
FT_F26Dot6 orus1, orus2, org1, org2, cur1, cur2, delta1, delta2;
if ( p1 > p2 )
@ -6813,12 +6813,15 @@
org1 = worker->orgs[ref1].x;
org2 = worker->orgs[ref2].x;
delta1 = worker->curs[ref1].x - org1;
delta2 = worker->curs[ref2].x - org2;
cur1 = worker->curs[ref1].x;
cur2 = worker->curs[ref2].x;
delta1 = cur1 - org1;
delta2 = cur2 - org2;
if ( orus1 == orus2 )
if ( cur1 == cur2 || orus1 == orus2 )
{
/* simple shift of untouched points */
/* trivial snap or shift of untouched points */
for ( i = p1; i <= p2; i++ )
{
FT_F26Dot6 x = worker->orgs[i].x;
@ -6826,9 +6829,13 @@
if ( x <= org1 )
x += delta1;
else
else if ( x >= org2 )
x += delta2;
else
x = cur1;
worker->curs[i].x = x;
}
}
@ -6855,12 +6862,10 @@
if ( !scale_valid )
{
scale_valid = 1;
scale = FT_DivFix( org2 + delta2 - ( org1 + delta1 ),
orus2 - orus1 );
scale = FT_DivFix( cur2 - cur1, orus2 - orus1 );
}
x = ( org1 + delta1 ) +
FT_MulFix( worker->orus[i].x - orus1, scale );
x = cur1 + FT_MulFix( worker->orus[i].x - orus1, scale );
}
worker->curs[i].x = x;
}