freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] anuj-distance-field c569d9f 24/95: * src/sdf/ftsdf.c (get_mi


From: Anuj Verma
Subject: [freetype2] anuj-distance-field c569d9f 24/95: * src/sdf/ftsdf.c (get_min_distance_line): Minor bug
Date: Sun, 2 Aug 2020 01:10:28 -0400 (EDT)

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

    * src/sdf/ftsdf.c (get_min_distance_line): Minor bug
---
 [GSoC]ChangeLog |  5 +++++
 src/sdf/ftsdf.c | 14 +++++++++-----
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/[GSoC]ChangeLog b/[GSoC]ChangeLog
index 7a5171e..c61d472 100644
--- a/[GSoC]ChangeLog
+++ b/[GSoC]ChangeLog
@@ -1,3 +1,8 @@
+2020-07-01     Anuj Verma  <anujv@iitbhilai.ac.in>
+
+       * src/sdf/ftsdf.c (get_min_distance_line): First check
+         pointer before using or dereferencing them.
+
 2020-06-30  Anuj Verma  <anujv@iitbhilai.ac.in>
 
        * src/sdf/ftsdf.c: Avoid parentheses if there is only
diff --git a/src/sdf/ftsdf.c b/src/sdf/ftsdf.c
index a95ae23..4ec5bdc 100644
--- a/src/sdf/ftsdf.c
+++ b/src/sdf/ftsdf.c
@@ -1014,9 +1014,9 @@
 
     FT_Error     error = FT_Err_Ok;
 
-    const FT_Vector   a = line->start_pos;
-    const FT_Vector   b = line->end_pos;
-    const FT_Vector   p = point;
+    FT_Vector    a;                 /* start position */
+    FT_Vector    b;                 /* end position   */
+    FT_Vector    p;                 /* current point  */
 
     FT_26D6_Vec  line_segment;      /* `b' - `a'*/
     FT_26D6_Vec  p_sub_a;           /* `p' - `a' */
@@ -1025,8 +1025,8 @@
     FT_16D16     factor;            /* factor of the nearest point      */
     FT_26D6      cross;             /* used to determine sign           */
 
-    FT_16D16_Vec nearest_point;  /* point on the line nearest to `point' */
-    FT_16D16_Vec nearest_vector; /* `p' - `nearest_point' */
+    FT_16D16_Vec nearest_point;     /* `point_on_line'       */
+    FT_16D16_Vec nearest_vector;    /* `p' - `nearest_point' */
 
     if ( !line || !out )
     {
@@ -1040,6 +1040,10 @@
       goto Exit;
     }
 
+    a = line->start_pos;
+    b = line->end_pos;
+    p = point;
+
     line_segment.x = b.x - a.x;
     line_segment.y = b.y - a.y;
 



reply via email to

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