Merge branch 'matthiasc/for-main' into 'main'

Rename an internal function

See merge request GNOME/gtk!6301
This commit is contained in:
Matthias Clasen 2023-08-16 20:40:12 +00:00
commit 08c064d79a
4 changed files with 26 additions and 17 deletions

View File

@ -61,7 +61,7 @@ struct _GskContourClass
GskContour * (* reverse) (const GskContour *contour);
int (* get_winding) (const GskContour *contour,
const graphene_point_t *point);
gsize (* get_n_points) (const GskContour *contour);
gsize (* get_n_ops) (const GskContour *contour);
gboolean (* get_closest_point) (const GskContour *contour,
const graphene_point_t *point,
float threshold,
@ -410,7 +410,7 @@ gsk_standard_contour_get_winding (const GskContour *contour,
}
static gsize
gsk_standard_contour_get_n_points (const GskContour *contour)
gsk_standard_contour_get_n_ops (const GskContour *contour)
{
GskStandardContour *self = (GskStandardContour *) contour;
@ -592,6 +592,8 @@ gsk_standard_contour_add_segment (const GskContour *contour,
GskStandardContour *self = (GskStandardContour *) contour;
GskCurve c, c1, c2;
g_assert (start->idx < self->n_ops);
gsk_curve_init (&c, self->ops[start->idx]);
if (start->idx == end->idx)
@ -645,7 +647,7 @@ static const GskContourClass GSK_STANDARD_CONTOUR_CLASS =
gsk_standard_contour_foreach,
gsk_standard_contour_reverse,
gsk_standard_contour_get_winding,
gsk_standard_contour_get_n_points,
gsk_standard_contour_get_n_ops,
gsk_standard_contour_get_closest_point,
gsk_standard_contour_get_position,
gsk_standard_contour_get_tangent,
@ -798,9 +800,9 @@ gsk_contour_get_closest_point (const GskContour *self,
}
gsize
gsk_contour_get_n_points (const GskContour *self)
gsk_contour_get_n_ops (const GskContour *self)
{
return self->klass->get_n_points (self);
return self->klass->get_n_ops (self);
}
void

View File

@ -57,7 +57,7 @@ void gsk_contour_get_start_end (const GskContou
graphene_point_t *end);
int gsk_contour_get_winding (const GskContour *self,
const graphene_point_t *point);
gsize gsk_contour_get_n_points (const GskContour *self);
gsize gsk_contour_get_n_ops (const GskContour *self);
gboolean gsk_contour_get_closest_point (const GskContour *self,
const graphene_point_t *point,
float threshold,

View File

@ -559,7 +559,7 @@ gsk_path_get_end_point (GskPath *self,
return FALSE;
res->contour = self->n_contours - 1;
res->idx = gsk_contour_get_n_points (self->contours[self->n_contours - 1]) - 1;
res->idx = gsk_contour_get_n_ops (self->contours[self->n_contours - 1]) - 1;
res->t = 1;
return TRUE;

View File

@ -1115,6 +1115,7 @@ gsk_path_builder_add_segment (GskPathBuilder *self,
const GskContour *contour;
gsize n_contours = gsk_path_get_n_contours (path);
graphene_point_t current;
gsize n_ops;
g_return_if_fail (self != NULL);
g_return_if_fail (path != NULL);
@ -1126,6 +1127,7 @@ gsk_path_builder_add_segment (GskPathBuilder *self,
current = self->current_point;
contour = gsk_path_get_contour (path, s->contour);
n_ops = gsk_contour_get_n_ops (contour);
if (s->contour == e->contour)
{
@ -1136,27 +1138,32 @@ gsk_path_builder_add_segment (GskPathBuilder *self,
}
else if (n_contours == 1)
{
gsk_contour_add_segment (contour, self, TRUE,
s,
&(GskRealPathPoint) { s->contour, gsk_contour_get_n_points (contour) - 1, 1 });
gsk_contour_add_segment (contour, self, FALSE,
if (n_ops > 1)
gsk_contour_add_segment (contour, self, TRUE,
s,
&(GskRealPathPoint) { s->contour, n_ops - 1, 1 });
gsk_contour_add_segment (contour, self, n_ops <= 1,
&(GskRealPathPoint) { s->contour, 1, 0 },
e);
goto out;
}
}
gsk_contour_add_segment (contour, self, TRUE,
s,
&(GskRealPathPoint) { s->contour, gsk_contour_get_n_points (contour) - 1, 1 });
if (n_ops > 1)
gsk_contour_add_segment (contour, self, TRUE,
s,
&(GskRealPathPoint) { s->contour, n_ops - 1, 1. });
for (gsize i = (s->contour + 1) % n_contours; i != e->contour; i = (i + 1) % n_contours)
gsk_path_builder_add_contour (self, gsk_contour_dup (gsk_path_get_contour (path, i)));
contour = gsk_path_get_contour (path, e->contour);
gsk_contour_add_segment (contour, self, FALSE,
&(GskRealPathPoint) { e->contour, 1, 0 },
e);
n_ops = gsk_contour_get_n_ops (contour);
if (n_ops > 1)
gsk_contour_add_segment (contour, self, TRUE,
&(GskRealPathPoint) { e->contour, 1, 0 },
e);
out:
gsk_path_builder_end_current (self);