contour: Make circles and rounded rects match

Make sure that we print the weights in the
same way (as floats).

Update affected tests.
This commit is contained in:
Matthias Clasen
2023-09-17 19:34:17 -04:00
parent 968b4237a9
commit 957d494090
2 changed files with 7 additions and 6 deletions

View File

@@ -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");
}

View File

@@ -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);