Add gsk_path_point_print

Another private debug API.
This commit is contained in:
Matthias Clasen
2023-08-27 19:05:25 -04:00
parent ad9fb1e101
commit a40282b2fb
2 changed files with 16 additions and 7 deletions

View File

@@ -54,15 +54,23 @@ G_DEFINE_BOXED_TYPE (GskPathPoint, gsk_path_point,
gsk_path_point_free)
const char *
char *
gsk_path_point_to_string (GskPathPoint *point)
{
GskRealPathPoint *p = (GskRealPathPoint *) point;
static char buf[128];
g_snprintf (buf, sizeof (buf),
"{ .contour = %lu, .idx = %lu, .t = %.9f }",
p->contour, p->idx, p->t);
return buf;
return g_strdup_printf ("{ .contour = %lu, .idx = %lu, .t = %.9f }",
p->contour, p->idx, p->t);
}
void
gsk_path_point_print (GskPathPoint *point)
{
char *s;
s = gsk_path_point_to_string (point);
g_print ("%s\n", s);
g_free (s);
}
GskPathPoint *

View File

@@ -14,7 +14,8 @@ struct _GskRealPathPoint
G_STATIC_ASSERT (sizeof (GskRealPathPoint) <= sizeof (GskPathPoint));
const char * gsk_path_point_to_string (GskPathPoint *point);
char * gsk_path_point_to_string (GskPathPoint *point);
void gsk_path_point_print (GskPathPoint *point);
G_END_DECLS