From d47ebd388c72d8134e1684bd29b9415ab70a2edc Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Wed, 9 Dec 2020 20:02:05 +0100 Subject: [PATCH] path: Always decompose conics into at least 2 segments Conics are evil in that their parameter skews towards the center, and if it's a very flat conic (weight almost equal to 0), then we'd approximate it with a single segment and not subdivide, which would cause the parameter to be wildly off around 0.25 or 0.75. And that would cause offset calculations to fail. --- gsk/gskcurve.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/gsk/gskcurve.c b/gsk/gskcurve.c index 6e0332ab37..9556ad098d 100644 --- a/gsk/gskcurve.c +++ b/gsk/gskcurve.c @@ -725,13 +725,24 @@ gsk_conic_curve_decompose (const GskCurve *curve, gpointer user_data) { const GskConicCurve *self = &curve->conic; + graphene_point_t mid; gsk_conic_curve_ensure_coefficents (self); + gsk_conic_curve_eval_point (self, 0.5, &mid); + return gsk_conic_curve_decompose_subdivide (self, tolerance, &self->points[0], 0.0f, + &mid, + 0.5f, + add_line_func, + user_data) + && gsk_conic_curve_decompose_subdivide (self, + tolerance, + &mid, + 0.5f, &self->points[3], 1.0f, add_line_func,