pathpoint: Add some debug API

Add a private gsk_path_point_to_string that
can be called in the debugger if you want
to see the contents of a GskPathPoint and
are too lazy to cast it to GskRealPathPoint
yourself.
This commit is contained in:
Matthias Clasen 2023-08-27 09:07:00 -04:00
parent 43b6822eb0
commit 031c0ec3e5
2 changed files with 13 additions and 0 deletions

View File

@ -54,6 +54,17 @@ G_DEFINE_BOXED_TYPE (GskPathPoint, gsk_path_point,
gsk_path_point_free)
const 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;
}
GskPathPoint *
gsk_path_point_copy (GskPathPoint *point)
{

View File

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