[gtk/wip/otte/lottie: 29/42] Add gsk_path_measure_get_{path, tolerance}




commit 694b9a2d72e2812f1a58094b8c316d5d407a473b
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Dec 6 13:31:28 2020 -0500

    Add gsk_path_measure_get_{path,tolerance}
    
    These are just nice apis to have and avoid having to carry
    these around as extra arguments in many places.
    
    This was showing up as inconvenience in writing tests
    for the measure apis.

 docs/reference/gsk/gsk4-sections.txt |  2 ++
 gsk/gskpathmeasure.c                 | 28 ++++++++++++++++++++++++++++
 gsk/gskpathmeasure.h                 |  5 +++++
 3 files changed, 35 insertions(+)
---
diff --git a/docs/reference/gsk/gsk4-sections.txt b/docs/reference/gsk/gsk4-sections.txt
index cc734745b0..6c600954ed 100644
--- a/docs/reference/gsk/gsk4-sections.txt
+++ b/docs/reference/gsk/gsk4-sections.txt
@@ -380,6 +380,8 @@ gsk_path_measure_new_with_tolerance
 gsk_path_measure_ref
 gsk_path_measure_unref
 <SUBSECTION>
+gsk_path_measure_get_path
+gsk_path_measure_get_tolerance
 gsk_path_measure_get_length
 gsk_path_measure_get_point
 gsk_path_measure_get_closest_point
diff --git a/gsk/gskpathmeasure.c b/gsk/gskpathmeasure.c
index 73bc567edc..4062ab45a9 100644
--- a/gsk/gskpathmeasure.c
+++ b/gsk/gskpathmeasure.c
@@ -166,6 +166,34 @@ gsk_path_measure_unref (GskPathMeasure *self)
   g_free (self);
 }
 
+/**
+ * gsk_path_measure_get_path:
+ * @self: a #GskPathMeasure
+ *
+ * Returns the path that the measure was created for.
+ *
+ * Returns: (transfer none): the path of @self
+ */
+GskPath *
+gsk_path_measure_get_path (GskPathMeasure *self)
+{
+  return self->path;
+}
+
+/**
+ * gsk_path_measure_get_tolerance:
+ * @self: a #GskPathMeasure
+ *
+ * Returns the tolerance that the measure was created with.
+ *
+ * Returns: the tolerance of @self
+ */
+float
+gsk_path_measure_get_tolerance (GskPathMeasure *self)
+{
+  return self->tolerance;
+}
+
 /**
  * gsk_path_measure_get_length:
  * @self: a #GskPathMeasure
diff --git a/gsk/gskpathmeasure.h b/gsk/gskpathmeasure.h
index 3cc4f74224..d899b01f7d 100644
--- a/gsk/gskpathmeasure.h
+++ b/gsk/gskpathmeasure.h
@@ -44,6 +44,11 @@ GskPathMeasure *        gsk_path_measure_ref                    (GskPathMeasure
 GDK_AVAILABLE_IN_ALL
 void                    gsk_path_measure_unref                  (GskPathMeasure         *self);
 
+GDK_AVAILABLE_IN_ALL
+GskPath *               gsk_path_measure_get_path               (GskPathMeasure         *self) G_GNUC_PURE;
+GDK_AVAILABLE_IN_ALL
+float                   gsk_path_measure_get_tolerance          (GskPathMeasure         *self) G_GNUC_PURE;
+
 GDK_AVAILABLE_IN_ALL
 float                   gsk_path_measure_get_length             (GskPathMeasure         *self);
 GDK_AVAILABLE_IN_ALL


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]