[gtk/wip/matthiasc/lottie-stroke] wip: Support conics in the stroker
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/matthiasc/lottie-stroke] wip: Support conics in the stroker
- Date: Thu, 3 Dec 2020 12:46:20 +0000 (UTC)
commit f83c2aa8fc92a072090d16197cc66505e3a8db75
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Dec 3 01:44:39 2020 -0500
wip: Support conics in the stroker
gsk/gskpathstroke.c | 31 ++++++++++++++++++++++++-------
1 file changed, 24 insertions(+), 7 deletions(-)
---
diff --git a/gsk/gskpathstroke.c b/gsk/gskpathstroke.c
index 4704652195..49f5f14bbc 100644
--- a/gsk/gskpathstroke.c
+++ b/gsk/gskpathstroke.c
@@ -1178,6 +1178,7 @@ compute_intersections (PathOpData *op1,
static PathOpData *
path_op_data_new (GskPathOperation op,
const graphene_point_t *pts,
+ float w,
gsize n_pts)
{
PathOpData *d;
@@ -1188,6 +1189,7 @@ path_op_data_new (GskPathOperation op,
for (i = 0; i < n_pts; i++)
d->pts[i] = pts[i];
d->n_pts = n_pts;
+ d->w = w;
#if STROKE_DEBUG
/* detect uninitialized values */
@@ -1216,7 +1218,7 @@ subdivide_and_add (const graphene_point_t pts[4],
{
if (level == 0 || cubic_is_simple (pts))
data->ops = g_list_prepend (data->ops,
- path_op_data_new (GSK_PATH_CURVE, pts, 4));
+ path_op_data_new (GSK_PATH_CURVE, pts, 0, 4));
else
{
graphene_point_t left[4];
@@ -1267,7 +1269,7 @@ add_op_to_list (GskPathOperation op,
case GSK_PATH_CLOSE:
case GSK_PATH_LINE:
- data->ops = g_list_prepend (data->ops, path_op_data_new (op, pts, n_pts));
+ data->ops = g_list_prepend (data->ops, path_op_data_new (op, pts, weight, n_pts));
break;
case GSK_PATH_CURVE:
@@ -1275,10 +1277,13 @@ add_op_to_list (GskPathOperation op,
break;
case GSK_PATH_CONIC:
+ data->ops = g_list_prepend (data->ops, path_op_data_new (op, pts, weight, n_pts));
+#if 0
gsk_spline_decompose_conic ((graphene_point_t[4]) { pts[0], pts[1], { weight, }, pts[2] },
0.0001,
conic_add_point,
data);
+#endif
break;
default:
@@ -1505,7 +1510,7 @@ gsk_contour_stroke (const GskContour *contour,
}
}
-#ifdef STROKE_DEBUG
+#if 0
for (l = ops; l; l = l->next)
{
int i;
@@ -1571,8 +1576,14 @@ gsk_contour_stroke (const GskContour *contour,
break;
case GSK_PATH_CONIC:
- g_warning ("FIXME: support conics in the stroker");
- g_assert_not_reached ();
+ if (op->angle[1] >= 181)
+ gsk_path_builder_conic_to (builder, op->r[1].x, op->r[1].y,
+ op->re[1].x, op->re[1].y,
+ op->w);
+ else
+ gsk_path_builder_conic_to (builder, op->r[1].x, op->r[1].y,
+ op->r[2].x, op->r[2].y,
+ op->w);
break;
default:
@@ -1704,8 +1715,14 @@ gsk_contour_stroke (const GskContour *contour,
break;
case GSK_PATH_CONIC:
- g_warning ("FIXME: support conics in the stroker");
- g_assert_not_reached ();
+ if (op->angle[0] <= 179)
+ gsk_path_builder_conic_to (builder, op->l[1].x, op->l[1].y,
+ op->le[0].x, op->le[0].y,
+ op->w);
+ else
+ gsk_path_builder_conic_to (builder, op->l[1].x, op->l[1].y,
+ op->l[0].x, op->l[0].y,
+ op->w);
break;
default:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]