[base] Speed up emboldening. * src/base/ftoutln.c (FT_Outline_EmboldenXY): Use `FT_Vector_NormLen'.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
diff --git a/ChangeLog b/ChangeLog
index af25864..8a68824 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2015-06-29 Alexei Podtelezhnikov <apodtele@gmail.com>
+ [base] Speed up emboldening.
+
+ * src/base/ftoutln.c (FT_Outline_EmboldenXY): Use `FT_Vector_NormLen'.
+
+2015-06-29 Alexei Podtelezhnikov <apodtele@gmail.com>
+
[base] Implement fast vector normalization.
The function uses Newton's iterations instead of dividing vector
diff --git a/src/base/ftoutln.c b/src/base/ftoutln.c
index d821c49..066eb7e 100644
--- a/src/base/ftoutln.c
+++ b/src/base/ftoutln.c
@@ -946,12 +946,7 @@
/* compute incoming normalized vector */
in.x = v_cur.x - v_prev.x;
in.y = v_cur.y - v_prev.y;
- l_in = FT_Vector_Length( &in );
- if ( l_in )
- {
- in.x = FT_DivFix( in.x, l_in );
- in.y = FT_DivFix( in.y, l_in );
- }
+ l_in = FT_Vector_NormLen( &in );
for ( n = first; n <= last; n++ )
{
@@ -963,12 +958,7 @@
/* compute outgoing normalized vector */
out.x = v_next.x - v_cur.x;
out.y = v_next.y - v_cur.y;
- l_out = FT_Vector_Length( &out );
- if ( l_out )
- {
- out.x = FT_DivFix( out.x, l_out );
- out.y = FT_DivFix( out.y, l_out );
- }
+ l_out = FT_Vector_NormLen( &out );
d = FT_MulFix( in.x, out.x ) + FT_MulFix( in.y, out.y );