From 031c0ec3e531c484cb4c7875fa73fdb191e54a68 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 27 Aug 2023 09:07:00 -0400 Subject: [PATCH] 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. --- gsk/gskpathpoint.c | 11 +++++++++++ gsk/gskpathpointprivate.h | 2 ++ 2 files changed, 13 insertions(+) diff --git a/gsk/gskpathpoint.c b/gsk/gskpathpoint.c index 345feeca6e..07e3bf77ce 100644 --- a/gsk/gskpathpoint.c +++ b/gsk/gskpathpoint.c @@ -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) { diff --git a/gsk/gskpathpointprivate.h b/gsk/gskpathpointprivate.h index 3fba916cd7..f065f043e0 100644 --- a/gsk/gskpathpointprivate.h +++ b/gsk/gskpathpointprivate.h @@ -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