From 4e5e6be841ef7762e3374bab4a07c9f2da3a9221 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Fri, 16 Jun 2023 16:58:46 -0700 Subject: [PATCH] libsysprof-analyze: add API to read back the min/max ranges --- src/libsysprof-analyze/sysprof-xy-series.c | 22 ++++++++++++++++++++++ src/libsysprof-analyze/sysprof-xy-series.h | 8 +++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/libsysprof-analyze/sysprof-xy-series.c b/src/libsysprof-analyze/sysprof-xy-series.c index cf299c10..e66b7bdd 100644 --- a/src/libsysprof-analyze/sysprof-xy-series.c +++ b/src/libsysprof-analyze/sysprof-xy-series.c @@ -192,3 +192,25 @@ sysprof_xy_series_sort (SysprofXYSeries *self) sizeof (SysprofXYSeriesValue), compare_by_xy); } + +void +sysprof_xy_series_get_range (SysprofXYSeries *self, + float *min_x, + float *min_y, + float *max_x, + float *max_y) +{ + g_return_if_fail (self != NULL); + + if (min_x) + *min_x = self->min_x; + + if (max_x) + *max_x = self->max_x; + + if (min_y) + *min_y = self->min_y; + + if (max_y) + *max_y = self->max_y; +} diff --git a/src/libsysprof-analyze/sysprof-xy-series.h b/src/libsysprof-analyze/sysprof-xy-series.h index ac6b1c46..db61d584 100644 --- a/src/libsysprof-analyze/sysprof-xy-series.h +++ b/src/libsysprof-analyze/sysprof-xy-series.h @@ -61,7 +61,13 @@ SYSPROF_AVAILABLE_IN_ALL GListModel *sysprof_xy_series_get_model (SysprofXYSeries *self); SYSPROF_AVAILABLE_IN_ALL const SysprofXYSeriesValue *sysprof_xy_series_get_values (const SysprofXYSeries *self, - guint *n_values); + guint *n_values); +SYSPROF_AVAILABLE_IN_ALL +void sysprof_xy_series_get_range (SysprofXYSeries *self, + float *min_x, + float *min_y, + float *max_x, + float *max_y); G_DEFINE_AUTOPTR_CLEANUP_FUNC (SysprofXYSeries, sysprof_xy_series_unref)