From 957d49409035480feac029e0c19fbecff63e566e Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 17 Sep 2023 19:34:17 -0400 Subject: [PATCH] contour: Make circles and rounded rects match Make sure that we print the weights in the same way (as floats). Update affected tests. --- gsk/gskcontour.c | 9 +++++---- testsuite/gsk/path-special-cases.c | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/gsk/gskcontour.c b/gsk/gskcontour.c index 9d12e18595..96d7681701 100644 --- a/gsk/gskcontour.c +++ b/gsk/gskcontour.c @@ -1347,6 +1347,7 @@ gsk_circle_contour_print (const GskContour *contour, { const GskCircleContour *self = (const GskCircleContour *) contour; float radius, radius_neg; + float weight = M_SQRT1_2; if (self->radius > 0) { @@ -1363,16 +1364,16 @@ gsk_circle_contour_print (const GskContour *contour, _g_string_append_point (string, "M ", &GRAPHENE_POINT_INIT (self->center.x + radius, self->center.y)); _g_string_append_point (string, " o ", &GRAPHENE_POINT_INIT (0, radius)); _g_string_append_point (string, ", ", &GRAPHENE_POINT_INIT (radius_neg, radius)); - _g_string_append_double (string, ", ", M_SQRT1_2); + _g_string_append_double (string, ", ", weight); _g_string_append_point (string, " o ", &GRAPHENE_POINT_INIT (radius_neg, 0)); _g_string_append_point (string, ", ", &GRAPHENE_POINT_INIT (radius_neg, radius_neg)); - _g_string_append_double (string, ", ", M_SQRT1_2); + _g_string_append_double (string, ", ", weight); _g_string_append_point (string, " o ", &GRAPHENE_POINT_INIT (0, radius_neg)); _g_string_append_point (string, ", ", &GRAPHENE_POINT_INIT (radius, radius_neg)); - _g_string_append_double (string, ", ", M_SQRT1_2); + _g_string_append_double (string, ", ", weight); _g_string_append_point (string, " o ", &GRAPHENE_POINT_INIT (radius, 0)); _g_string_append_point (string, ", ", &GRAPHENE_POINT_INIT (radius, radius)); - _g_string_append_double (string, ", ", M_SQRT1_2); + _g_string_append_double (string, ", ", weight); g_string_append (string, " z"); } diff --git a/testsuite/gsk/path-special-cases.c b/testsuite/gsk/path-special-cases.c index 10c54ada17..09531bef88 100644 --- a/testsuite/gsk/path-special-cases.c +++ b/testsuite/gsk/path-special-cases.c @@ -1589,7 +1589,7 @@ test_circle_plain (void) path = gsk_path_builder_free_to_path (builder); s = gsk_path_to_string (path); - g_assert_cmpstr (s, ==, "M 110 100 o 0 10, -10 10, 0.70710678118654757 o -10 0, -10 -10, 0.70710678118654757 o 0 -10, 10 -10, 0.70710678118654757 o 10 0, 10 10, 0.70710678118654757 z"); + g_assert_cmpstr (s, ==, "M 110 100 o 0 10, -10 10, 0.70710676908493042 o -10 0, -10 -10, 0.70710676908493042 o 0 -10, 10 -10, 0.70710676908493042 o 10 0, 10 10, 0.70710676908493042 z"); g_free (s); measure = gsk_path_measure_new (path); @@ -1642,7 +1642,7 @@ test_circle_zero (void) path = gsk_path_builder_free_to_path (builder); s = gsk_path_to_string (path); - g_assert_cmpstr (s, ==, "M 100 100 o 0 0, 0 0, 0.70710678118654757 o 0 0, 0 0, 0.70710678118654757 o 0 0, 0 0, 0.70710678118654757 o 0 0, 0 0, 0.70710678118654757 z"); + g_assert_cmpstr (s, ==, "M 100 100 o 0 0, 0 0, 0.70710676908493042 o 0 0, 0 0, 0.70710676908493042 o 0 0, 0 0, 0.70710676908493042 o 0 0, 0 0, 0.70710676908493042 z"); g_free (s); measure = gsk_path_measure_new (path);