[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2] anuj-distance-field e6a5a38 3/4: * src/sdf/ftsdf.c: Use FT_1
From: |
Anuj Verma |
Subject: |
[freetype2] anuj-distance-field e6a5a38 3/4: * src/sdf/ftsdf.c: Use FT_16D16 instead of FT_Fixed to avoid confusion. |
Date: |
Tue, 30 Jun 2020 09:06:29 -0400 (EDT) |
branch: anuj-distance-field
commit e6a5a38f4f70736bf76a4740df96bcc24b261ab5
Author: Anuj Verma <anujv@iitbhilai.ac.in>
Commit: Anuj Verma <anujv@iitbhilai.ac.in>
* src/sdf/ftsdf.c: Use FT_16D16 instead of FT_Fixed to avoid confusion.
---
[GSoC]ChangeLog | 5 +++++
src/sdf/ftsdf.c | 20 +++++++++++---------
2 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/[GSoC]ChangeLog b/[GSoC]ChangeLog
index 22c1fe1..47509fb 100644
--- a/[GSoC]ChangeLog
+++ b/[GSoC]ChangeLog
@@ -1,5 +1,10 @@
2020-06-30 Anuj Verma <anujv@iitbhilai.ac.in>
+ * src/sdf/ftsdf.c (square_root, cube_root, arc_cos):
+ Use FT_16D16 instead of FT_Fixed to avoid confusion.
+
+2020-06-30 Anuj Verma <anujv@iitbhilai.ac.in>
+
* src/sdf/ftsdf.c (cube_root, arc_cos): Added a few
essential math functions.
diff --git a/src/sdf/ftsdf.c b/src/sdf/ftsdf.c
index 6ee6bcc..ed20df9 100644
--- a/src/sdf/ftsdf.c
+++ b/src/sdf/ftsdf.c
@@ -600,8 +600,8 @@
*/
/* Original Algorithm: https://github.com/chmike/fpsqrt */
- static FT_Fixed
- square_root( FT_Fixed val )
+ static FT_16D16
+ square_root( FT_16D16 val )
{
FT_ULong t, q, b, r;
@@ -627,8 +627,8 @@
/* This function uses newton's iteration to find */
/* cube root of a fixed point integer. */
- static FT_Fixed
- cube_root( FT_Fixed val )
+ static FT_16D16
+ cube_root( FT_16D16 val )
{
/* [IMPORTANT]: This function is not good as it may */
/* not break, so use a lookup table instead. */
@@ -659,12 +659,14 @@
return val < 0 ? -g : g;
}
- /* returns cos inverse of a value */
- static FT_Fixed
- arc_cos( FT_Fixed val )
+ /* The function calculate the perpendicular */
+ /* using 1 - ( base ^ 2 ) and then use arc */
+ /* tan to compute the angle. */
+ static FT_16D16
+ arc_cos( FT_16D16 val )
{
- FT_Fixed p, b = val;
- FT_Fixed one = FT_INT_16D16( 1 );
+ FT_16D16 p, b = val;
+ FT_16D16 one = FT_INT_16D16( 1 );
if ( b > one ) b = one;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2] anuj-distance-field e6a5a38 3/4: * src/sdf/ftsdf.c: Use FT_16D16 instead of FT_Fixed to avoid confusion.,
Anuj Verma <=