[clutter] Add initializer utilities for ClutterVertex



commit 82bc7285847ef50aae3d4e48907309ec509105ad
Author: Emmanuele Bassi <ebassi linux intel com>
Date:   Sat Mar 17 16:29:09 2012 +0000

    Add initializer utilities for ClutterVertex
    
    Similar to what we did for ClutterActorBox.

 clutter/clutter-actor.c                    |   26 ++++++++++++++++++++++++--
 clutter/clutter-types.h                    |   20 ++++++++++++++++++++
 clutter/clutter.symbols                    |    1 +
 doc/reference/clutter/clutter-sections.txt |    2 ++
 4 files changed, 47 insertions(+), 2 deletions(-)
---
diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c
index 78f3006..5556be7 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 f9cda74..a3092ce 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 3b4f8b1..339d8a0 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 09ca289..87f166e 100644
--- a/doc/reference/clutter/clutter-sections.txt
+++ b/doc/reference/clutter/clutter-sections.txt
@@ -546,7 +546,9 @@ clutter_actor_box_union
 
 <SUBSECTION>
 ClutterVertex
+CLUTTER_VERTEX_INIT
 clutter_vertex_new
+clutter_vertex_init
 clutter_vertex_copy
 clutter_vertex_free
 clutter_vertex_equal



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]