Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-07-07 02:48:28 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-07-07 02:48:28 +0400
commit3a0593cc3d5de33248b3a7b913a45729c37dc1b4 (patch)
tree88fcddc5e3c060c87a6313d853315f0efa484a52 /source/blender/blenlib/intern/freetypefont.c
parent2336aadb80f8602f001b2c5b0bcaacf3ad858f83 (diff)
code cleanup: dont use function calls like dot_v3v3, pow and sqrt within macros which results in calling the function multiple times needlessly.
also added some comments.
Diffstat (limited to 'source/blender/blenlib/intern/freetypefont.c')
-rw-r--r--source/blender/blenlib/intern/freetypefont.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/source/blender/blenlib/intern/freetypefont.c b/source/blender/blenlib/intern/freetypefont.c
index eb2070bce76..10eeda96b5d 100644
--- a/source/blender/blenlib/intern/freetypefont.c
+++ b/source/blender/blenlib/intern/freetypefont.c
@@ -266,17 +266,19 @@ static void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vf
}
}
- // get the handles that are aligned, tricky...
- // dist_to_line_v2, check if the three beztriple points are on one line
- // len_squared_v2v2, see if there's a distance between the three points
- // len_squared_v2v2 again, to check the angle between the handles
- // finally, check if one of them is a vector handle
- if ((dist_to_line_v2(bezt->vec[0], bezt->vec[1], bezt->vec[2]) < 0.001f) &&
+ /* get the handles that are aligned, tricky...
+ * dist_to_line_v2, check if the three beztriple points are on one line
+ * len_squared_v2v2, see if there's a distance between the three points
+ * len_squared_v2v2 again, to check the angle between the handles
+ * finally, check if one of them is a vector handle */
+ if ((bezt->h1 != HD_VECT && bezt->h2 != HD_VECT) &&
+ (dist_to_line_v2(bezt->vec[0], bezt->vec[1], bezt->vec[2]) < 0.001f) &&
(len_squared_v2v2(bezt->vec[0], bezt->vec[1]) > 0.0001f * 0.0001f) &&
(len_squared_v2v2(bezt->vec[1], bezt->vec[2]) > 0.0001f * 0.0001f) &&
(len_squared_v2v2(bezt->vec[0], bezt->vec[2]) > 0.0002f * 0.0001f) &&
- (len_squared_v2v2(bezt->vec[0], bezt->vec[2]) > MAX2(len_squared_v2v2(bezt->vec[0], bezt->vec[1]), len_squared_v2v2(bezt->vec[1], bezt->vec[2]))) &&
- bezt->h1 != HD_VECT && bezt->h2 != HD_VECT)
+ (len_squared_v2v2(bezt->vec[0], bezt->vec[2]) >
+ maxf(len_squared_v2v2(bezt->vec[0], bezt->vec[1]),
+ len_squared_v2v2(bezt->vec[1], bezt->vec[2]))))
{
bezt->h1 = bezt->h2 = HD_ALIGN;
}