freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2] anuj-distance-field 0751d5f 26/95: * src/sdf/ftsdf.c (get_mi


From: Anuj Verma
Subject: [freetype2] anuj-distance-field 0751d5f 26/95: * src/sdf/ftsdf.c (get_min_distance_conic): Use 0, 1 in case of 0 roots.
Date: Sun, 2 Aug 2020 01:10:29 -0400 (EDT)

branch: anuj-distance-field
commit 0751d5f1e7e96c00c2ea2c42b35d2e2af08a0cf4
Author: Anuj Verma <anujv@iitbhilai.ac.in>
Commit: Anuj Verma <anujv@iitbhilai.ac.in>

    * src/sdf/ftsdf.c (get_min_distance_conic): Use 0, 1 in case of 0 roots.
---
 [GSoC]ChangeLog | 6 ++++++
 src/sdf/ftsdf.c | 7 +++++++
 2 files changed, 13 insertions(+)

diff --git a/[GSoC]ChangeLog b/[GSoC]ChangeLog
index a9f13fd..64775cc 100644
--- a/[GSoC]ChangeLog
+++ b/[GSoC]ChangeLog
@@ -1,5 +1,11 @@
 2020-07-01     Anuj Verma  <anujv@iitbhilai.ac.in>
 
+       * src/sdf/ftsdf.c (get_min_distance_conic): In case
+         the cubic equation returns zero root, use endpoints
+         for calculating the shortest distance.
+
+2020-07-01     Anuj Verma  <anujv@iitbhilai.ac.in>
+
        [sdf] Added function to find shortest distance from a
        point to a conic bezier. Now the sdf module can render
        ttf fonts or fonts with line and conic segments.
diff --git a/src/sdf/ftsdf.c b/src/sdf/ftsdf.c
index c5e9932..5826979 100644
--- a/src/sdf/ftsdf.c
+++ b/src/sdf/ftsdf.c
@@ -1223,6 +1223,13 @@
     /* find the roots */
     num_roots = solve_cubic_equation( a, b, c, d, roots );
 
+    if ( num_roots == 0 )
+    {
+      roots[0] = 0;
+      roots[1] = FT_INT_16D16( 1 );
+      num_roots = 2;
+    }
+
     /* convert these values to 16.16 for further computation */
     aA.x = FT_26D6_16D16( aA.x );
     aA.y = FT_26D6_16D16( aA.y );



reply via email to

[Prev in Thread] Current Thread [Next in Thread]