freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] anuj-distance-field 80c5bed 49/93: [sdf] Completed the coars


From: Anuj Verma
Subject: [freetype2] anuj-distance-field 80c5bed 49/93: [sdf] Completed the coarse grid optimization.
Date: Sun, 2 Aug 2020 07:04:20 -0400 (EDT)

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

    [sdf] Completed the coarse grid optimization.
    
    * src/sdf/ftsdf.c (sdf_generate_coarse_grid): Fixed
      an issue with position calculation and upside down
      images.
---
 [GSoC]ChangeLog |  8 ++++++++
 src/sdf/ftsdf.c | 24 +++++++++++-------------
 2 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/[GSoC]ChangeLog b/[GSoC]ChangeLog
index cc84e51..713eada 100644
--- a/[GSoC]ChangeLog
+++ b/[GSoC]ChangeLog
@@ -1,3 +1,11 @@
+2020-07-11  Anuj Verma  <anujv@iitbhilai.ac.in>
+
+       [sdf] Completed the coarse grid optimization.
+
+       * src/sdf/ftsdf.c (sdf_generate_coarse_grid): Fixed
+         an issue with position calculation and upside down
+         images.
+
 2020-07-10  Anuj Verma  <anujv@iitbhilai.ac.in>
 
        [sdf] Partially completed the coarse grid optimization.
diff --git a/src/sdf/ftsdf.c b/src/sdf/ftsdf.c
index 6b187ff..f8ae7b2 100644
--- a/src/sdf/ftsdf.c
+++ b/src/sdf/ftsdf.c
@@ -45,7 +45,7 @@
   /* then they will be checked for corner if they have ambiguity.         */
   #define CORNER_CHECK_EPSILON   32
 
-  #define CG_DIMEN        8
+  #define CG_DIMEN               10
 
   /**************************************************************************
    *
@@ -2816,8 +2816,8 @@
         FT_26D6_Vec   cpoint;
 
         coarse_grid[cindex] = NULL;
-        cpoint.x = FT_INT_26D6( i ) + FT_INT_26D6( c_width / 2 );
-        cpoint.y = FT_INT_26D6( j ) + FT_INT_26D6( c_rows / 2 );
+        cpoint.x = FT_INT_26D6( i * c_width ) + FT_INT_26D6( c_width / 2 );
+        cpoint.y = FT_INT_26D6( j * c_rows ) + FT_INT_26D6( c_rows / 2 );
 
         while ( cont )
         {
@@ -2831,18 +2831,16 @@
 
             FT_CALL( sdf_edge_get_min_distance( edge, cpoint, &dist ) );
 
-            if ( dist.distance > cg_sq )
+
+            if ( dist.distance < cg_sq )
             {
-              edge = edge->next;
-              continue;
+              FT_CALL( sdf_edge_new( memory, &temp ) );
+              ft_memcpy( temp, edge, sizeof( *edge ) );
+              
+              temp->next = coarse_grid[cindex];
+              coarse_grid[cindex] = temp;
             }
 
-            FT_CALL( sdf_edge_new( memory, &temp ) );
-            ft_memcpy( temp, edge, sizeof( *edge ) );
-
-            temp->next = coarse_grid[cindex];
-            coarse_grid[cindex] = temp;
-
             edge = edge->next;
           }
 
@@ -2904,7 +2902,7 @@
 
             min_dist.distance /= 64;
 
-            buffer[ y * width + x ] = min_dist.distance;
+            buffer[ ( rows - y - 1 ) * width + x ] = min_dist.distance;
 
           }
         }



reply via email to

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