Commit 55bf1ff016ab6e659188dca7935b5c7ff426035d

sammy 2008-05-08T17:03:07

* Small optimisation in FTContour::ComputeOutsetPoint().

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
diff --git a/src/FTContour.cpp b/src/FTContour.cpp
index 86c59d4..177986c 100644
--- a/src/FTContour.cpp
+++ b/src/FTContour.cpp
@@ -109,11 +109,9 @@ FTPoint FTContour::ComputeOutsetPoint(FTPoint A, FTPoint B, FTPoint C)
                 bc.X() * ba.Y() + bc.Y() * -ba.X());
 
     /* Compute the vector bisecting 'abc' */
-    FTGL_DOUBLE sgn = -64.0;
     FTGL_DOUBLE norm = sqrt(tmp.X() * tmp.X() + tmp.Y() * tmp.Y());
-    if((tmp.Y() / norm) < 0)
-        sgn = 64.0;
-    tmp.X(sgn * sqrt((norm - tmp.X()) / (norm + tmp.X())));
+    FTGL_DOUBLE dist = 64.0 * sqrt((norm - tmp.X()) / (norm + tmp.X()));
+    tmp.X(tmp.Y() < 0.0 ? dist : -dist);
     tmp.Y(64.0);
 
     /* Rotate the new bc to the right */