[gtk/wip/otte/lottie: 36/43] path: Make all private contour APIs take a GskContour
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/otte/lottie: 36/43] path: Make all private contour APIs take a GskContour
- Date: Sun, 6 Dec 2020 17:57:16 +0000 (UTC)
commit 95b71d47c97acf5d443b70d3590f9dd96d11f552
Author: Benjamin Otte <otte redhat com>
Date: Mon Nov 30 18:05:49 2020 +0100
path: Make all private contour APIs take a GskContour
... instead of a path, index tuple.
gsk/gskpath.c | 26 +++++++-------------------
gsk/gskpathmeasure.c | 12 ++++++------
gsk/gskpathprivate.h | 28 ++++++++++++----------------
3 files changed, 25 insertions(+), 41 deletions(-)
---
diff --git a/gsk/gskpath.c b/gsk/gskpath.c
index 38c0b6a75a..8f7c23366b 100644
--- a/gsk/gskpath.c
+++ b/gsk/gskpath.c
@@ -1656,23 +1656,17 @@ gsk_contour_foreach (const GskContour *contour,
}
gpointer
-gsk_contour_init_measure (GskPath *path,
- gsize i,
- float tolerance,
- float *out_length)
+gsk_contour_init_measure (const GskContour *self,
+ float tolerance,
+ float *out_length)
{
- GskContour *self = path->contours[i];
-
return self->klass->init_measure (self, tolerance, out_length);
}
void
-gsk_contour_free_measure (GskPath *path,
- gsize i,
- gpointer data)
+gsk_contour_free_measure (const GskContour *self,
+ gpointer data)
{
- GskContour *self = path->contours[i];
-
self->klass->free_measure (self, data);
}
@@ -1685,21 +1679,17 @@ gsk_contour_get_start_end (const GskContour *self,
}
void
-gsk_contour_get_point (GskPath *path,
- gsize i,
+gsk_contour_get_point (const GskContour *self,
gpointer measure_data,
float distance,
graphene_point_t *pos,
graphene_vec2_t *tangent)
{
- GskContour *self = path->contours[i];
-
self->klass->get_point (self, measure_data, distance, pos, tangent);
}
gboolean
-gsk_contour_get_closest_point (GskPath *path,
- gsize i,
+gsk_contour_get_closest_point (const GskContour *self,
gpointer measure_data,
float tolerance,
const graphene_point_t *point,
@@ -1709,8 +1699,6 @@ gsk_contour_get_closest_point (GskPath *path,
float *out_offset,
graphene_vec2_t *out_tangent)
{
- GskContour *self = path->contours[i];
-
return self->klass->get_closest_point (self,
measure_data,
tolerance,
diff --git a/gsk/gskpathmeasure.c b/gsk/gskpathmeasure.c
index aed9008d29..3f2b8890fc 100644
--- a/gsk/gskpathmeasure.c
+++ b/gsk/gskpathmeasure.c
@@ -109,7 +109,7 @@ gsk_path_measure_new_with_tolerance (GskPath *path,
for (i = 0; i < n_contours; i++)
{
- self->measures[i].contour_data = gsk_contour_init_measure (path, i,
+ self->measures[i].contour_data = gsk_contour_init_measure (gsk_path_get_contour (path, i),
self->tolerance,
&self->measures[i].length);
self->length += self->measures[i].length;
@@ -157,7 +157,8 @@ gsk_path_measure_unref (GskPathMeasure *self)
for (i = 0; i < self->n_contours; i++)
{
- gsk_contour_free_measure (self->path, i, self->measures[i].contour_data);
+ gsk_contour_free_measure (gsk_path_get_contour (self->path, i),
+ self->measures[i].contour_data);
}
gsk_path_unref (self->path);
@@ -252,8 +253,7 @@ gsk_path_measure_get_point (GskPathMeasure *self,
distance = self->measures[i].length;
}
- gsk_contour_get_point (self->path,
- i,
+ gsk_contour_get_point (gsk_path_get_contour (self->path, i),
self->measures[i].contour_data,
distance,
pos,
@@ -345,8 +345,7 @@ gsk_path_measure_get_closest_point_full (GskPathMeasure *self,
for (i = 0; i < self->n_contours; i++)
{
- if (gsk_contour_get_closest_point (self->path,
- i,
+ if (gsk_contour_get_closest_point (gsk_path_get_contour (self->path, i),
self->measures[i].contour_data,
self->tolerance,
point,
@@ -475,3 +474,4 @@ gsk_path_measure_add_segment (GskPathMeasure *self,
}
}
}
+
diff --git a/gsk/gskpathprivate.h b/gsk/gskpathprivate.h
index 310fa38b45..7027267764 100644
--- a/gsk/gskpathprivate.h
+++ b/gsk/gskpathprivate.h
@@ -66,25 +66,21 @@ gboolean gsk_path_foreach_with_tolerance (GskPath
GskPathForeachFunc func,
gpointer user_data);
-GskContour * gsk_contour_dup (const GskContour *src);
-gpointer gsk_contour_init_measure (GskPath *path,
- gsize i,
- float tolerance,
- float *out_length);
-void gsk_contour_free_measure (GskPath *path,
- gsize i,
- gpointer data);
+GskContour * gsk_contour_dup (const GskContour *src);
+gpointer gsk_contour_init_measure (const GskContour *self,
+ float tolerance,
+ float *out_length);
+void gsk_contour_free_measure (const GskContour *self,
+ gpointer data);
void gsk_contour_get_start_end (const GskContour *self,
graphene_point_t *start,
graphene_point_t *end);
-void gsk_contour_get_point (GskPath *path,
- gsize i,
- gpointer measure_data,
- float distance,
- graphene_point_t *pos,
- graphene_vec2_t *tangent);
-gboolean gsk_contour_get_closest_point (GskPath *path,
- gsize i,
+void gsk_contour_get_point (const GskContour *self,
+ gpointer measure_data,
+ float distance,
+ graphene_point_t *pos,
+ graphene_vec2_t *tangent);
+gboolean gsk_contour_get_closest_point (const GskContour *self,
gpointer measure_data,
float tolerance,
const graphene_point_t *point,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]