diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index 78f3006e5..5556be704 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -13297,11 +13297,33 @@ clutter_vertex_new (gfloat x, ClutterVertex *vertex; vertex = g_slice_new (ClutterVertex); + clutter_vertex_init (vertex, x, y, z); + + return vertex; +} + +/** + * clutter_vertex_init: + * @vertex: a #ClutterVertex + * @x: X coordinate + * @y: Y coordinate + * @z: Z coordinate + * + * Initializes @vertex with the given coordinates. + * + * Since: 1.10 + */ +void +clutter_vertex_init (ClutterVertex *vertex, + gfloat x, + gfloat y, + gfloat z) +{ + g_return_if_fail (vertex != NULL); + vertex->x = x; vertex->y = y; vertex->z = z; - - return vertex; } /** diff --git a/clutter/clutter-types.h b/clutter/clutter-types.h index f9cda7450..a3092ce3f 100644 --- a/clutter/clutter-types.h +++ b/clutter/clutter-types.h @@ -122,10 +122,30 @@ struct _ClutterVertex gfloat z; }; +/** + * CLUTTER_VERTEX_INIT: + * @x: the X coordinate of the vertex + * @y: the Y coordinate of the vertex + * @z: the Z coordinate of the vertex + * + * A simple macro for initializing a #ClutterVertex when declaring it, e.g.: + * + * |[ + * ClutterVertext v = CLUTTER_VERTEX_INIT (x, y, z); + * ]| + * + * Since: 1.10 + */ +#define CLUTTER_VERTEX_INIT(x,y,z) { (x), (y), (z) } + GType clutter_vertex_get_type (void) G_GNUC_CONST; ClutterVertex *clutter_vertex_new (gfloat x, gfloat y, gfloat z); +void clutter_vertex_init (ClutterVertex *vertex, + gfloat x, + gfloat y, + gfloat z); ClutterVertex *clutter_vertex_copy (const ClutterVertex *vertex); void clutter_vertex_free (ClutterVertex *vertex); gboolean clutter_vertex_equal (const ClutterVertex *vertex_a, diff --git a/clutter/clutter.symbols b/clutter/clutter.symbols index 3b4f8b13f..339d8a097 100644 --- a/clutter/clutter.symbols +++ b/clutter/clutter.symbols @@ -1413,6 +1413,7 @@ clutter_vertex_copy clutter_vertex_equal clutter_vertex_free clutter_vertex_get_type +clutter_vertex_init clutter_vertex_new #ifdef CLUTTER_WINDOWING_WAYLAND clutter_wayland_get_egl_display diff --git a/doc/reference/clutter/clutter-sections.txt b/doc/reference/clutter/clutter-sections.txt index 09ca289b6..87f166ef4 100644 --- a/doc/reference/clutter/clutter-sections.txt +++ b/doc/reference/clutter/clutter-sections.txt @@ -546,7 +546,9 @@ clutter_actor_box_union ClutterVertex +CLUTTER_VERTEX_INIT clutter_vertex_new +clutter_vertex_init clutter_vertex_copy clutter_vertex_free clutter_vertex_equal