[gtk/wip/matthiasc/lottie-stroke: 51/51] stroke: Add minimal support for conics




commit 77c1a87e6949c0c355330c200772d2b2d671af24
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Dec 1 12:26:58 2020 -0500

    stroke: Add minimal support for conics
    
    Just decompose conics into lines, for now.

 gsk/gskpathstroke.c | 27 +++++++++++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)
---
diff --git a/gsk/gskpathstroke.c b/gsk/gskpathstroke.c
index 6d2b22a015..7f3f28581d 100644
--- a/gsk/gskpathstroke.c
+++ b/gsk/gskpathstroke.c
@@ -826,6 +826,27 @@ subdivide_and_add (const graphene_point_t  pts[4],
     }
 }
 
+static gboolean
+add_op_to_list (GskPathOperation        op,
+                const graphene_point_t *pts,
+                gsize                   n_pts,
+                float                   weight,
+                gpointer                user_data);
+
+static void
+conic_add_point (const graphene_point_t *from,
+                 const graphene_point_t *to,
+                 float                   from_progress,
+                 float                   to_progress,
+                 gpointer                user_data)
+{
+  add_op_to_list (GSK_PATH_LINE,
+                  (graphene_point_t[2]) { *from, *to },
+                  2,
+                  0.0f,
+                  user_data);
+}
+
 static gboolean
 add_op_to_list (GskPathOperation        op,
                 const graphene_point_t *pts,
@@ -851,8 +872,10 @@ add_op_to_list (GskPathOperation        op,
       break;
 
     case GSK_PATH_CONIC:
-      g_warning ("FIXME: support conics in the stroker");
-      g_assert_not_reached ();
+      gsk_spline_decompose_conic ((graphene_point_t[4]) { pts[0], pts[1], { weight, }, pts[2] },
+                                  0.0001,
+                                  conic_add_point,
+                                  data);
       break;
 
     default:


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