Merge branch 'path-point-api-revision2' into 'main'

pathpoint: Revise argument order

See merge request GNOME/gtk!6287
This commit is contained in:
Matthias Clasen 2023-08-14 18:53:23 +00:00
commit 95ea6b2615
3 changed files with 25 additions and 25 deletions

View File

@ -139,8 +139,8 @@ gsk_path_point_compare (const GskPathPoint *point1,
/**
* gsk_path_point_get_position:
* @path: a `GskPath`
* @point: a `GskPathPoint` on @path
* @point: a `GskPathPoint`
* @path: the path that @point is on
* @position: (out caller-allocates): Return location for
* the coordinates of the point
*
@ -149,15 +149,15 @@ gsk_path_point_compare (const GskPathPoint *point1,
* Since: 4.14
*/
void
gsk_path_point_get_position (GskPath *path,
const GskPathPoint *point,
gsk_path_point_get_position (const GskPathPoint *point,
GskPath *path,
graphene_point_t *position)
{
GskRealPathPoint *self = (GskRealPathPoint *) point;
const GskContour *contour;
g_return_if_fail (self != NULL);
g_return_if_fail (path != NULL);
g_return_if_fail (point != NULL);
g_return_if_fail (position != NULL);
g_return_if_fail (self->contour < gsk_path_get_n_contours (path));
@ -167,8 +167,8 @@ gsk_path_point_get_position (GskPath *path,
/**
* gsk_path_point_get_tangent:
* @path: a `GskPath`
* @point: a `GskPathPoint` on @path
* @point: a `GskPathPoint`
* @path: the path that @point is on
* @direction: the direction for which to return the tangent
* @tangent: (out caller-allocates): Return location for
* the tangent at the point
@ -184,16 +184,16 @@ gsk_path_point_get_position (GskPath *path,
* Since: 4.14
*/
void
gsk_path_point_get_tangent (GskPath *path,
const GskPathPoint *point,
gsk_path_point_get_tangent (const GskPathPoint *point,
GskPath *path,
GskPathDirection direction,
graphene_vec2_t *tangent)
{
GskRealPathPoint *self = (GskRealPathPoint *) point;
const GskContour *contour;
g_return_if_fail (self != NULL);
g_return_if_fail (path != NULL);
g_return_if_fail (point != NULL);
g_return_if_fail (tangent != NULL);
g_return_if_fail (self->contour < gsk_path_get_n_contours (path));
@ -203,8 +203,8 @@ gsk_path_point_get_tangent (GskPath *path,
/**
* gsk_path_point_get_curvature:
* @path: a `GskPath`
* @point: a `GskPathPoint` on @path
* @point: a `GskPathPoint`
* @path: the path that @point is on
* @center: (out caller-allocates) (nullable): Return location for
* the center of the osculating circle
*
@ -220,15 +220,15 @@ gsk_path_point_get_tangent (GskPath *path,
* Since: 4.14
*/
float
gsk_path_point_get_curvature (GskPath *path,
const GskPathPoint *point,
gsk_path_point_get_curvature (const GskPathPoint *point,
GskPath *path,
graphene_point_t *center)
{
GskRealPathPoint *self = (GskRealPathPoint *) point;
const GskContour *contour;
g_return_val_if_fail (self != NULL, 0);
g_return_val_if_fail (path != NULL, 0);
g_return_val_if_fail (point != NULL, 0);
g_return_val_if_fail (self->contour < gsk_path_get_n_contours (path), 0);
contour = gsk_path_get_contour (path, self->contour);

View File

@ -57,19 +57,19 @@ int gsk_path_point_compare (const GskPathPoint *poin
const GskPathPoint *point2);
GDK_AVAILABLE_IN_4_14
void gsk_path_point_get_position (GskPath *path,
const GskPathPoint *point,
void gsk_path_point_get_position (const GskPathPoint *point,
GskPath *path,
graphene_point_t *position);
GDK_AVAILABLE_IN_4_14
void gsk_path_point_get_tangent (GskPath *path,
const GskPathPoint *point,
void gsk_path_point_get_tangent (const GskPathPoint *point,
GskPath *path,
GskPathDirection direction,
graphene_vec2_t *tangent);
GDK_AVAILABLE_IN_4_14
float gsk_path_point_get_curvature (GskPath *path,
const GskPathPoint *point,
float gsk_path_point_get_curvature (const GskPathPoint *point,
GskPath *path,
graphene_point_t *center);

View File

@ -465,10 +465,10 @@ test_path_point (void)
g_assert_true (rp->idx == 2);
g_assert_true (rp->t == 1);
gsk_path_point_get_position (path, &point, &pos);
gsk_path_point_get_tangent (path, &point, GSK_PATH_START, &t1);
gsk_path_point_get_tangent (path, &point, GSK_PATH_END, &t2);
curvature = gsk_path_point_get_curvature (path, &point, &center);
gsk_path_point_get_position (&point, path, &pos);
gsk_path_point_get_tangent (&point, path, GSK_PATH_START, &t1);
gsk_path_point_get_tangent (&point, path, GSK_PATH_END, &t2);
curvature = gsk_path_point_get_curvature (&point, path, &center);
g_assert_true (graphene_point_equal (&pos, &GRAPHENE_POINT_INIT (100, 100)));
g_assert_true (graphene_vec2_equal (&t1, graphene_vec2_y_axis ()));