freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] anuj-distance-field a4f82a2 45/95: [sdf] Added subdivision o


From: Anuj Verma
Subject: [freetype2] anuj-distance-field a4f82a2 45/95: [sdf] Added subdivision optimization.
Date: Sun, 2 Aug 2020 01:10:33 -0400 (EDT)

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

    [sdf] Added subdivision optimization.
    
    * src/sdf/ftsdfrend.c (sdf_generate_subdivision): The
      function generate SDF just like the `sdf_generate'
      function, but subdivide the curve into a number of
      lines and then use the `sdf_generate_bounding_box'
      function to generate SDF.
---
 [GSoC]ChangeLog | 10 ++++++++++
 src/sdf/ftsdf.c | 36 +++++++++++++++++++++++++++++++++---
 2 files changed, 43 insertions(+), 3 deletions(-)

diff --git a/[GSoC]ChangeLog b/[GSoC]ChangeLog
index 6daa543..ae3ba0c 100644
--- a/[GSoC]ChangeLog
+++ b/[GSoC]ChangeLog
@@ -1,5 +1,15 @@
 2020-07-09  Anuj Verma  <anujv@iitbhilai.ac.in>
 
+       [sdf] Added subdivision optimization.
+
+       * src/sdf/ftsdfrend.c (sdf_generate_subdivision): The
+         function generate SDF just like the `sdf_generate'
+         function, but subdivide the curve into a number of
+         lines and then use the `sdf_generate_bounding_box'
+         function to generate SDF.
+
+2020-07-09  Anuj Verma  <anujv@iitbhilai.ac.in>
+
        [sdf] Added functions to subdivide a cubic curve.
 
        * src/sdf/ftsdf.c (split_cubic, split_sdf_cubic):
diff --git a/src/sdf/ftsdf.c b/src/sdf/ftsdf.c
index 18e1699..3313556 100644
--- a/src/sdf/ftsdf.c
+++ b/src/sdf/ftsdf.c
@@ -2724,6 +2724,38 @@
 
   /**************************************************************************
    *
+   * @Function:
+   *   sdf_generate_bounding_box
+   *
+   * @Description:
+   *   This function subdivide the shape into a number of straight lines
+   *   and then simply use the above `sdf_generate_bounding_box' to generate
+   *   the SDF.
+   *   Note: After calling this function the `shape' will no longer have the
+   *         original edges, it will only contain lines.
+   *
+   * @Input:
+   *   [TODO]
+   *
+   * @Return:
+   *   [TODO]
+   */
+  static FT_Error
+  sdf_generate_subdivision( const SDF_Shape*  shape,
+                            FT_UInt           spread,
+                            const FT_Bitmap*  bitmap )
+  {
+    FT_Error   error = FT_Err_Ok;
+
+    FT_CALL( split_sdf_shape( shape ) );
+    FT_CALL( sdf_generate_bounding_box( shape, spread, bitmap ) );
+
+  Exit:
+    return error;
+  }
+
+  /**************************************************************************
+   *
    * interface functions
    *
    */
@@ -2840,9 +2872,7 @@
 
     FT_CALL( sdf_outline_decompose( outline, shape ) );
 
-    split_sdf_shape( shape );
-
-    FT_CALL( sdf_generate_bounding_box( shape, sdf_params->spread, 
+    FT_CALL( sdf_generate_subdivision( shape, sdf_params->spread, 
                            sdf_params->root.target ) );
 
   Exit:



reply via email to

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