diff --git a/ChangeLog b/ChangeLog index 0de61b536..8bac04c14 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2015-04-27 Alexei Podtelezhnikov + + [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 [autofit] By default, enable warping code but switch off warping. diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index 31c7bfa8b..b9ae0453f 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -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; }