From c912690d22ab16d772328396c27c47075924b012 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Mon, 30 Sep 2019 22:45:34 -0400 Subject: [PATCH] * src/base/ftstroke.c (ft_stroker_inside): Speed up. --- ChangeLog | 4 ++++ src/base/ftstroke.c | 19 ++++++++++--------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index cd71686a2..c65dcb855 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2019-10-01 Alexei Podtelezhnikov + + * src/base/ftstroke.c (ft_stroker_inside): Speed up. + 2019-10-01 Werner Lemberg * src/sfnt/sfwoff2 (woff2_open_font): Initialize `woff2.ttc_fonts'. diff --git a/src/base/ftstroke.c b/src/base/ftstroke.c index bbbb40713..315276e1c 100644 --- a/src/base/ftstroke.c +++ b/src/base/ftstroke.c @@ -974,8 +974,8 @@ { FT_StrokeBorder border = stroker->borders + side; FT_Angle phi, theta, rotate; - FT_Fixed length, thcos; - FT_Vector delta; + FT_Fixed length; + FT_Vector sigma, delta; FT_Error error = FT_Err_Ok; FT_Bool intersect; /* use intersection of lines? */ @@ -993,10 +993,13 @@ else { /* compute minimum required length of lines */ - FT_Fixed min_length = ft_pos_abs( FT_MulFix( stroker->radius, - FT_Tan( theta ) ) ); + FT_Fixed min_length; + FT_Vector_Unit( &sigma, theta ); + min_length = + ft_pos_abs( FT_MulDiv( stroker->radius, sigma.y, sigma.x ) ); + intersect = FT_BOOL( min_length && stroker->line_length >= min_length && line_length >= min_length ); @@ -1014,13 +1017,11 @@ else { /* compute median angle */ - phi = stroker->angle_in + theta; + phi = stroker->angle_in + theta + rotate; - thcos = FT_Cos( theta ); + length = FT_DivFix( stroker->radius, sigma.x ); - length = FT_DivFix( stroker->radius, thcos ); - - FT_Vector_From_Polar( &delta, length, phi + rotate ); + FT_Vector_From_Polar( &delta, length, phi ); delta.x += stroker->center.x; delta.y += stroker->center.y; }