[gtk/path-work-rebased: 65/118] path: Always decompose conics into at least 2 segments
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/path-work-rebased: 65/118] path: Always decompose conics into at least 2 segments
- Date: Sat, 4 Dec 2021 07:28:36 +0000 (UTC)
commit 5973e283c27e1ca4595bc4e619dce1bc11872b6a
Author: Benjamin Otte <otte redhat com>
Date: Wed Dec 9 20:02:05 2020 +0100
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 b2f2ce96b6..09e678c80a 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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]