[mutter/gbsneto/graphene: 13/18] Replace ClutterVertex by graphene_point3d_t



commit a5d0cfe8fbbb466297563721bd3837a0d743fd5f
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Wed Feb 20 10:18:48 2019 -0300

    Replace ClutterVertex by graphene_point3d_t
    
    Pretty direct and straightforward port. This requires a
    GNOME Shell counterpart. In addition to that, include a
    progress function.
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/458

 clutter/clutter/cally/cally-actor.c            |   2 +-
 clutter/clutter/cally/cally-text.c             |   4 +-
 clutter/clutter/clutter-actor-box.c            |   6 +-
 clutter/clutter/clutter-actor-private.h        |   4 +-
 clutter/clutter/clutter-actor.c                |  98 ++++++-------
 clutter/clutter/clutter-actor.h                |  12 +-
 clutter/clutter/clutter-autocleanups.h         |   1 -
 clutter/clutter/clutter-base-types.c           | 196 ++-----------------------
 clutter/clutter/clutter-bind-constraint.c      |   4 +-
 clutter/clutter/clutter-blur-effect.c          |   2 +-
 clutter/clutter/clutter-graphene.c             |  54 +++++++
 clutter/clutter/clutter-graphene.h             |  30 ++++
 clutter/clutter/clutter-main.c                 |   3 +
 clutter/clutter/clutter-offscreen-effect.c     |   6 +-
 clutter/clutter/clutter-paint-volume-private.h |   2 +-
 clutter/clutter/clutter-paint-volume.c         |  26 ++--
 clutter/clutter/clutter-private.h              |  18 +--
 clutter/clutter/clutter-text.c                 |   6 +-
 clutter/clutter/clutter-types.h                |  75 +---------
 clutter/clutter/clutter-util.c                 |  86 ++++-------
 clutter/clutter/clutter-zoom-action.c          |   2 +-
 clutter/clutter/deprecated/clutter-animation.c |   2 +-
 clutter/clutter/deprecated/clutter-texture.c   |   2 +-
 clutter/clutter/meson.build                    |   2 +
 src/compositor/clutter-utils.c                 |  14 +-
 src/compositor/clutter-utils.h                 |  10 +-
 src/compositor/meta-window-actor.c             |   2 +-
 src/tests/clutter/conform/actor-anchors.c      |   8 +-
 src/tests/clutter/interactive/test-layout.c    |   2 +-
 src/wayland/meta-wayland-surface.c             |   4 +-
 30 files changed, 252 insertions(+), 431 deletions(-)
---
diff --git a/clutter/clutter/cally/cally-actor.c b/clutter/clutter/cally/cally-actor.c
index d97357de4..07eaea67d 100644
--- a/clutter/clutter/cally/cally-actor.c
+++ b/clutter/clutter/cally/cally-actor.c
@@ -657,7 +657,7 @@ cally_actor_get_extents (AtkComponent *component,
   ClutterActor *actor      = NULL;
   gint          top_level_x, top_level_y;
   gfloat        f_width, f_height;
-  ClutterVertex verts[4];
+  graphene_point3d_t verts[4];
   ClutterActor  *stage = NULL;
 
   g_return_if_fail (CALLY_IS_ACTOR (component));
diff --git a/clutter/clutter/cally/cally-text.c b/clutter/clutter/cally/cally-text.c
index 6375a3855..cbdec8496 100644
--- a/clutter/clutter/cally/cally-text.c
+++ b/clutter/clutter/cally/cally-text.c
@@ -1438,7 +1438,7 @@ static void cally_text_get_character_extents (AtkText *text,
   PangoLayout *layout;
   PangoRectangle extents;
   const gchar *text_value;
-  ClutterVertex verts[4];
+  graphene_point3d_t verts[4];
 
   actor = CALLY_GET_CLUTTER_ACTOR (text);
   if (actor == NULL) /* State is defunct */
@@ -2294,7 +2294,7 @@ _cally_misc_get_index_at_point (ClutterText *clutter_text,
   gint index, x_window, y_window, x_toplevel, y_toplevel;
   gint x_temp, y_temp;
   gboolean ret;
-  ClutterVertex verts[4];
+  graphene_point3d_t verts[4];
   PangoLayout *layout;
   gint x_layout, y_layout;
 
diff --git a/clutter/clutter/clutter-actor-box.c b/clutter/clutter/clutter-actor-box.c
index 6871274c5..a2308ac31 100644
--- a/clutter/clutter/clutter-actor-box.c
+++ b/clutter/clutter/clutter-actor-box.c
@@ -340,7 +340,7 @@ clutter_actor_box_contains (const ClutterActorBox *box,
 /**
  * clutter_actor_box_from_vertices:
  * @box: a #ClutterActorBox
- * @verts: (array fixed-size=4): array of four #ClutterVertex
+ * @verts: (array fixed-size=4): array of four #graphene_point3d_t
  *
  * Calculates the bounding box represented by the four vertices; for details
  * of the vertex array see clutter_actor_get_abs_allocation_vertices().
@@ -348,8 +348,8 @@ clutter_actor_box_contains (const ClutterActorBox *box,
  * Since: 1.0
  */
 void
-clutter_actor_box_from_vertices (ClutterActorBox     *box,
-                                 const ClutterVertex  verts[])
+clutter_actor_box_from_vertices (ClutterActorBox          *box,
+                                 const graphene_point3d_t  verts[])
 {
   gfloat x_1, x_2, y_1, y_2;
 
diff --git a/clutter/clutter/clutter-actor-private.h b/clutter/clutter/clutter-actor-private.h
index fa2d4c328..be81f0d6c 100644
--- a/clutter/clutter/clutter-actor-private.h
+++ b/clutter/clutter/clutter-actor-private.h
@@ -135,7 +135,7 @@ struct _AnchorCoord
     } fraction;
 
     /* Use when is_fractional == FALSE */
-    ClutterVertex units;
+    graphene_point3d_t units;
   } v;
 };
 
@@ -203,7 +203,7 @@ struct _ClutterTransformInfo
   AnchorCoord anchor;
 
   /* translation */
-  ClutterVertex translation;
+  graphene_point3d_t translation;
 
   /* z_position */
   gfloat z_position;
diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c
index b1bbf97ec..f34e8cd30 100644
--- a/clutter/clutter/clutter-actor.c
+++ b/clutter/clutter/clutter-actor.c
@@ -2890,8 +2890,8 @@ clutter_actor_real_queue_relayout (ClutterActor *self)
  * @self: A #ClutterActor
  * @ancestor: (allow-none): A #ClutterActor ancestor, or %NULL to use the
  *   default #ClutterStage
- * @point: A point as #ClutterVertex
- * @vertex: (out caller-allocates): The translated #ClutterVertex
+ * @point: A point as #graphene_point3d_t
+ * @vertex: (out caller-allocates): The translated #graphene_point3d_t
  *
  * Transforms @point in coordinates relative to the actor into
  * ancestor-relative coordinates using the relevant transform
@@ -2905,10 +2905,10 @@ clutter_actor_real_queue_relayout (ClutterActor *self)
  * Since: 0.6
  */
 void
-clutter_actor_apply_relative_transform_to_point (ClutterActor        *self,
-                                                ClutterActor        *ancestor,
-                                                const ClutterVertex *point,
-                                                ClutterVertex       *vertex)
+clutter_actor_apply_relative_transform_to_point (ClutterActor             *self,
+                                                 ClutterActor             *ancestor,
+                                                 const graphene_point3d_t *point,
+                                                 graphene_point3d_t       *vertex)
 {
   gfloat w;
   CoglMatrix matrix;
@@ -2935,10 +2935,10 @@ clutter_actor_apply_relative_transform_to_point (ClutterActor        *self,
 }
 
 static gboolean
-_clutter_actor_fully_transform_vertices (ClutterActor *self,
-                                         const ClutterVertex *vertices_in,
-                                         ClutterVertex *vertices_out,
-                                         int n_vertices)
+_clutter_actor_fully_transform_vertices (ClutterActor             *self,
+                                         const graphene_point3d_t *vertices_in,
+                                         graphene_point3d_t       *vertices_out,
+                                         int                       n_vertices)
 {
   ClutterActor *stage;
   CoglMatrix modelview;
@@ -2980,8 +2980,8 @@ _clutter_actor_fully_transform_vertices (ClutterActor *self,
 /**
  * clutter_actor_apply_transform_to_point:
  * @self: A #ClutterActor
- * @point: A point as #ClutterVertex
- * @vertex: (out caller-allocates): The translated #ClutterVertex
+ * @point: A point as #graphene_point3d_t
+ * @vertex: (out caller-allocates): The translated #graphene_point3d_t
  *
  * Transforms @point in coordinates relative to the actor
  * into screen-relative coordinates with the current actor
@@ -2990,9 +2990,9 @@ _clutter_actor_fully_transform_vertices (ClutterActor *self,
  * Since: 0.4
  **/
 void
-clutter_actor_apply_transform_to_point (ClutterActor        *self,
-                                        const ClutterVertex *point,
-                                        ClutterVertex       *vertex)
+clutter_actor_apply_transform_to_point (ClutterActor             *self,
+                                        const graphene_point3d_t *point,
+                                        graphene_point3d_t       *vertex)
 {
   g_return_if_fail (point != NULL);
   g_return_if_fail (vertex != NULL);
@@ -3042,10 +3042,10 @@ _clutter_actor_get_relative_transformation_matrix (ClutterActor *self,
  * transformed vertices to @verts[]. */
 static gboolean
 _clutter_actor_transform_and_project_box (ClutterActor          *self,
-                                         const ClutterActorBox *box,
-                                         ClutterVertex          verts[])
+                                          const ClutterActorBox *box,
+                                          graphene_point3d_t    *verts)
 {
-  ClutterVertex box_vertices[4];
+  graphene_point3d_t box_vertices[4];
 
   box_vertices[0].x = box->x1;
   box_vertices[0].y = box->y1;
@@ -3069,8 +3069,8 @@ _clutter_actor_transform_and_project_box (ClutterActor          *self,
  * @self: A #ClutterActor
  * @ancestor: (allow-none): A #ClutterActor to calculate the vertices
  *   against, or %NULL to use the #ClutterStage
- * @verts: (out) (array fixed-size=4) (element-type Clutter.Vertex): return
- *   location for an array of 4 #ClutterVertex in which to store the result
+ * @verts: (out) (array fixed-size=4): return
+ *   location for an array of 4 #graphene_point3d_t in which to store the result
  *
  * Calculates the transformed coordinates of the four corners of the
  * actor in the plane of @ancestor. The returned vertices relate to
@@ -3089,13 +3089,13 @@ _clutter_actor_transform_and_project_box (ClutterActor          *self,
  * Since: 0.6
  */
 void
-clutter_actor_get_allocation_vertices (ClutterActor  *self,
-                                       ClutterActor  *ancestor,
-                                       ClutterVertex  verts[])
+clutter_actor_get_allocation_vertices (ClutterActor       *self,
+                                       ClutterActor       *ancestor,
+                                       graphene_point3d_t *verts)
 {
   ClutterActorPrivate *priv;
   ClutterActorBox box;
-  ClutterVertex vertices[4];
+  graphene_point3d_t vertices[4];
   CoglMatrix modelview;
 
   g_return_if_fail (CLUTTER_IS_ACTOR (self));
@@ -3147,9 +3147,9 @@ clutter_actor_get_allocation_vertices (ClutterActor  *self,
 
   cogl_matrix_transform_points (&modelview,
                                 3,
-                                sizeof (ClutterVertex),
+                                sizeof (graphene_point3d_t),
                                 vertices,
-                                sizeof (ClutterVertex),
+                                sizeof (graphene_point3d_t),
                                 vertices,
                                 4);
 }
@@ -3158,7 +3158,7 @@ clutter_actor_get_allocation_vertices (ClutterActor  *self,
  * clutter_actor_get_abs_allocation_vertices:
  * @self: A #ClutterActor
  * @verts: (out) (array fixed-size=4): Pointer to a location of an array
- *   of 4 #ClutterVertex where to store the result.
+ *   of 4 #graphene_point3d_t where to store the result.
  *
  * Calculates the transformed screen coordinates of the four corners of
  * the actor; the returned vertices relate to the #ClutterActorBox
@@ -3172,8 +3172,8 @@ clutter_actor_get_allocation_vertices (ClutterActor  *self,
  * Since: 0.4
  */
 void
-clutter_actor_get_abs_allocation_vertices (ClutterActor  *self,
-                                           ClutterVertex  verts[])
+clutter_actor_get_abs_allocation_vertices (ClutterActor       *self,
+                                           graphene_point3d_t *verts)
 {
   ClutterActorPrivate *priv;
   ClutterActorBox actor_space_allocation;
@@ -3414,7 +3414,7 @@ _clutter_actor_draw_paint_volume_full (ClutterActor *self,
 {
   static CoglPipeline *outline = NULL;
   CoglPrimitive *prim;
-  ClutterVertex line_ends[12 * 2];
+  graphene_point3d_t line_ends[12 * 2];
   int n_vertices;
   CoglContext *ctx =
     clutter_backend_get_cogl_context (clutter_get_default_backend ());
@@ -4473,7 +4473,7 @@ static const ClutterTransformInfo default_transform_info = {
 
   { 0, },                       /* anchor XXX:2.0 - remove*/
 
-  CLUTTER_VERTEX_INIT_ZERO,     /* translation */
+  GRAPHENE_POINT3D_INIT_ZERO,   /* translation */
 
   0.f,                          /* z-position */
 
@@ -4862,11 +4862,11 @@ clutter_actor_get_rotation_angle (ClutterActor      *self,
  * rotation angle.
  */
 static inline void
-clutter_actor_set_rotation_center_internal (ClutterActor        *self,
-                                            ClutterRotateAxis    axis,
-                                            const ClutterVertex *center)
+clutter_actor_set_rotation_center_internal (ClutterActor             *self,
+                                            ClutterRotateAxis         axis,
+                                            const graphene_point3d_t *center)
 {
-  ClutterVertex v = CLUTTER_VERTEX_INIT_ZERO; 
+  graphene_point3d_t v = GRAPHENE_POINT3D_INIT_ZERO;
   GObject *obj = G_OBJECT (self);
   ClutterTransformInfo *info;
 
@@ -5781,7 +5781,7 @@ clutter_actor_get_property (GObject    *object,
 
     case PROP_ROTATION_CENTER_X: /* XXX:2.0 - remove */
       {
-        ClutterVertex center;
+        graphene_point3d_t center;
 
         clutter_actor_get_rotation (actor, CLUTTER_X_AXIS,
                                     &center.x,
@@ -5794,7 +5794,7 @@ clutter_actor_get_property (GObject    *object,
 
     case PROP_ROTATION_CENTER_Y: /* XXX:2.0 - remove */
       {
-        ClutterVertex center;
+        graphene_point3d_t center;
 
         clutter_actor_get_rotation (actor, CLUTTER_Y_AXIS,
                                     &center.x,
@@ -5807,7 +5807,7 @@ clutter_actor_get_property (GObject    *object,
 
     case PROP_ROTATION_CENTER_Z: /* XXX:2.0 - remove */
       {
-        ClutterVertex center;
+        graphene_point3d_t center;
 
         clutter_actor_get_rotation (actor, CLUTTER_Z_AXIS,
                                     &center.x,
@@ -6224,7 +6224,7 @@ clutter_actor_update_default_paint_volume (ClutterActor       *self,
           priv->clip.size.width >= 0 &&
           priv->clip.size.height >= 0)
         {
-          ClutterVertex origin;
+          graphene_point3d_t origin;
 
           origin.x = priv->clip.origin.x;
           origin.y = priv->clip.origin.y;
@@ -7277,7 +7277,7 @@ clutter_actor_class_init (ClutterActorClass *klass)
     g_param_spec_boxed ("rotation-center-x",
                         P_("Rotation Center X"),
                         P_("The rotation center on the X axis"),
-                        CLUTTER_TYPE_VERTEX,
+                        GRAPHENE_TYPE_POINT3D,
                         G_PARAM_READWRITE |
                         G_PARAM_STATIC_STRINGS |
                         G_PARAM_DEPRECATED);
@@ -7295,7 +7295,7 @@ clutter_actor_class_init (ClutterActorClass *klass)
     g_param_spec_boxed ("rotation-center-y",
                         P_("Rotation Center Y"),
                         P_("The rotation center on the Y axis"),
-                        CLUTTER_TYPE_VERTEX,
+                        GRAPHENE_TYPE_POINT3D,
                         G_PARAM_READWRITE |
                         G_PARAM_STATIC_STRINGS |
                         G_PARAM_DEPRECATED);
@@ -7313,7 +7313,7 @@ clutter_actor_class_init (ClutterActorClass *klass)
     g_param_spec_boxed ("rotation-center-z",
                         P_("Rotation Center Z"),
                         P_("The rotation center on the Z axis"),
-                        CLUTTER_TYPE_VERTEX,
+                        GRAPHENE_TYPE_POINT3D,
                         G_PARAM_READWRITE |
                         G_PARAM_STATIC_STRINGS |
                         G_PARAM_DEPRECATED);
@@ -8968,7 +8968,7 @@ _clutter_actor_queue_redraw_full (ClutterActor             *self,
   if (flags & CLUTTER_REDRAW_CLIPPED_TO_ALLOCATION)
     {
       ClutterActorBox allocation_clip;
-      ClutterVertex origin;
+      graphene_point3d_t origin;
 
       /* If the actor doesn't have a valid allocation then we will
        * queue a full stage redraw. */
@@ -9172,7 +9172,7 @@ clutter_actor_queue_redraw_with_clip (ClutterActor                *self,
                                       const cairo_rectangle_int_t *clip)
 {
   ClutterPaintVolume volume;
-  ClutterVertex origin;
+  graphene_point3d_t origin;
 
   g_return_if_fail (CLUTTER_IS_ACTOR (self));
 
@@ -10994,8 +10994,8 @@ clutter_actor_get_transformed_position (ClutterActor *self,
                                         gfloat       *x,
                                         gfloat       *y)
 {
-  ClutterVertex v1;
-  ClutterVertex v2;
+  graphene_point3d_t v1;
+  graphene_point3d_t v2;
 
   v1.x = v1.y = v1.z = 0;
   clutter_actor_apply_transform_to_point (self, &v1, &v2);
@@ -11041,7 +11041,7 @@ clutter_actor_get_transformed_size (ClutterActor *self,
                                     gfloat       *height)
 {
   ClutterActorPrivate *priv;
-  ClutterVertex v[4];
+  graphene_point3d_t v[4];
   gfloat x_min, x_max, y_min, y_max;
   gint i;
 
@@ -12353,7 +12353,7 @@ clutter_actor_set_rotation (ClutterActor      *self,
                             gfloat             y,
                             gfloat             z)
 {
-  ClutterVertex v;
+  graphene_point3d_t v;
 
   g_return_if_fail (CLUTTER_IS_ACTOR (self));
 
@@ -15332,7 +15332,7 @@ clutter_actor_transform_stage_point (ClutterActor *self,
                                     gfloat       *x_out,
                                     gfloat       *y_out)
 {
-  ClutterVertex v[4];
+  graphene_point3d_t v[4];
   double ST[3][3];
   double RQ[3][3];
   int du, dv;
diff --git a/clutter/clutter/clutter-actor.h b/clutter/clutter/clutter-actor.h
index b1abff86d..dd09546ec 100644
--- a/clutter/clutter/clutter-actor.h
+++ b/clutter/clutter/clutter-actor.h
@@ -431,7 +431,7 @@ void                            clutter_actor_get_allocation_box
 CLUTTER_EXPORT
 void                            clutter_actor_get_allocation_vertices           (ClutterActor                
*self,
                                                                                  ClutterActor                
*ancestor,
-                                                                                 ClutterVertex               
 verts[]);
+                                                                                 graphene_point3d_t          
*verts);
 CLUTTER_EXPORT
 gboolean                        clutter_actor_has_allocation                    (ClutterActor                
*self);
 CLUTTER_EXPORT
@@ -817,16 +817,16 @@ gboolean                        clutter_actor_transform_stage_point
                                                                                  gfloat                     
*y_out);
 CLUTTER_EXPORT
 void                            clutter_actor_get_abs_allocation_vertices       (ClutterActor               
*self,
-                                                                                 ClutterVertex               
verts[]);
+                                                                                 graphene_point3d_t         
*verts);
 CLUTTER_EXPORT
 void                            clutter_actor_apply_transform_to_point          (ClutterActor               
*self,
-                                                                                 const ClutterVertex        
*point,
-                                                                                 ClutterVertex              
*vertex);
+                                                                                 const graphene_point3d_t   
*point,
+                                                                                 graphene_point3d_t         
*vertex);
 CLUTTER_EXPORT
 void                            clutter_actor_apply_relative_transform_to_point (ClutterActor               
*self,
                                                                                  ClutterActor               
*ancestor,
-                                                                                 const ClutterVertex        
*point,
-                                                                                 ClutterVertex              
*vertex);
+                                                                                 const graphene_point3d_t   
*point,
+                                                                                 graphene_point3d_t         
*vertex);
 
 /* Implicit animations */
 CLUTTER_EXPORT
diff --git a/clutter/clutter/clutter-autocleanups.h b/clutter/clutter/clutter-autocleanups.h
index 0a68c0505..5472cbdd0 100644
--- a/clutter/clutter/clutter-autocleanups.h
+++ b/clutter/clutter/clutter-autocleanups.h
@@ -96,7 +96,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPathNode, clutter_path_node_free)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPoint, clutter_point_free)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterRect, clutter_rect_free)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterSize, clutter_size_free)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterVertex, clutter_vertex_free)
 
 #endif /* __GI_SCANNER__ */
 
diff --git a/clutter/clutter/clutter-base-types.c b/clutter/clutter/clutter-base-types.c
index 61e6fcd26..0524c95e0 100644
--- a/clutter/clutter/clutter-base-types.c
+++ b/clutter/clutter/clutter-base-types.c
@@ -149,178 +149,6 @@ G_DEFINE_BOXED_TYPE_WITH_CODE (ClutterGeometry, clutter_geometry,
 
 
 
-/*
- * ClutterVertices
- */
-
-/**
- * clutter_vertex_new:
- * @x: X coordinate
- * @y: Y coordinate
- * @z: Z coordinate
- *
- * Creates a new #ClutterVertex for the point in 3D space
- * identified by the 3 coordinates @x, @y, @z.
- *
- * This function is the logical equivalent of:
- *
- * |[
- *   clutter_vertex_init (clutter_vertex_alloc (), x, y, z);
- * ]|
- *
- * Return value: (transfer full): the newly allocated #ClutterVertex.
- *   Use clutter_vertex_free() to free the resources
- *
- * Since: 1.0
- */
-ClutterVertex *
-clutter_vertex_new (gfloat x,
-                    gfloat y,
-                    gfloat z)
-{
-  return clutter_vertex_init (clutter_vertex_alloc (), x, y, z);
-}
-
-/**
- * clutter_vertex_alloc: (constructor)
- *
- * Allocates a new, empty #ClutterVertex.
- *
- * Return value: (transfer full): the newly allocated #ClutterVertex.
- *   Use clutter_vertex_free() to free its resources
- *
- * Since: 1.12
- */
-ClutterVertex *
-clutter_vertex_alloc (void)
-{
-  return g_slice_new0 (ClutterVertex);
-}
-
-/**
- * clutter_vertex_init:
- * @vertex: a #ClutterVertex
- * @x: X coordinate
- * @y: Y coordinate
- * @z: Z coordinate
- *
- * Initializes @vertex with the given coordinates.
- *
- * Return value: (transfer none): the initialized #ClutterVertex
- *
- * Since: 1.10
- */
-ClutterVertex *
-clutter_vertex_init (ClutterVertex *vertex,
-                     gfloat         x,
-                     gfloat         y,
-                     gfloat         z)
-{
-  g_return_val_if_fail (vertex != NULL, NULL);
-
-  vertex->x = x;
-  vertex->y = y;
-  vertex->z = z;
-
-  return vertex;
-}
-
-/**
- * clutter_vertex_copy:
- * @vertex: a #ClutterVertex
- *
- * Copies @vertex
- *
- * Return value: (transfer full): a newly allocated copy of #ClutterVertex.
- *   Use clutter_vertex_free() to free the allocated resources
- *
- * Since: 1.0
- */
-ClutterVertex *
-clutter_vertex_copy (const ClutterVertex *vertex)
-{
-  if (G_LIKELY (vertex != NULL))
-    return g_slice_dup (ClutterVertex, vertex);
-
-  return NULL;
-}
-
-/**
- * clutter_vertex_free:
- * @vertex: a #ClutterVertex
- *
- * Frees a #ClutterVertex allocated using clutter_vertex_alloc() or
- * clutter_vertex_copy().
- *
- * Since: 1.0
- */
-void
-clutter_vertex_free (ClutterVertex *vertex)
-{
-  if (G_UNLIKELY (vertex != NULL))
-    g_slice_free (ClutterVertex, vertex);
-}
-
-/**
- * clutter_vertex_equal:
- * @vertex_a: a #ClutterVertex
- * @vertex_b: a #ClutterVertex
- *
- * Compares @vertex_a and @vertex_b for equality
- *
- * Return value: %TRUE if the passed #ClutterVertex are equal
- *
- * Since: 1.0
- */
-gboolean
-clutter_vertex_equal (const ClutterVertex *vertex_a,
-                      const ClutterVertex *vertex_b)
-{
-  g_return_val_if_fail (vertex_a != NULL && vertex_b != NULL, FALSE);
-
-  if (vertex_a == vertex_b)
-    return TRUE;
-
-  return fabsf (vertex_a->x - vertex_b->x) < FLOAT_EPSILON &&
-         fabsf (vertex_a->y - vertex_b->y) < FLOAT_EPSILON &&
-         fabsf (vertex_a->z - vertex_b->z) < FLOAT_EPSILON;
-}
-
-static void
-clutter_vertex_interpolate (const ClutterVertex *a,
-                            const ClutterVertex *b,
-                            double               progress,
-                            ClutterVertex       *res)
-{
-  res->x = a->x + (b->x - a->x) * progress;
-  res->y = a->y + (b->y - a->y) * progress;
-  res->z = a->z + (b->z - a->z) * progress;
-}
-
-static gboolean
-clutter_vertex_progress (const GValue *a,
-                         const GValue *b,
-                         gdouble       progress,
-                         GValue       *retval)
-{
-  const ClutterVertex *av = g_value_get_boxed (a);
-  const ClutterVertex *bv = g_value_get_boxed (b);
-  ClutterVertex res;
-
-  clutter_vertex_interpolate (av, bv, progress, &res);
-
-  g_value_set_boxed (retval, &res);
-
-  return TRUE;
-}
-
-G_DEFINE_BOXED_TYPE_WITH_CODE (ClutterVertex, clutter_vertex,
-                               clutter_vertex_copy,
-                               clutter_vertex_free,
-                               CLUTTER_REGISTER_INTERVAL_PROGRESS (clutter_vertex_progress));
-
-
-
 /*
  * ClutterMargin
  */
@@ -1393,20 +1221,20 @@ clutter_matrix_progress (const GValue *a,
 {
   const ClutterMatrix *matrix1 = g_value_get_boxed (a);
   const ClutterMatrix *matrix2 = g_value_get_boxed (b);
-  ClutterVertex scale1 = CLUTTER_VERTEX_INIT (1.f, 1.f, 1.f);
+  graphene_point3d_t scale1 = GRAPHENE_POINT3D_INIT (1.f, 1.f, 1.f);
   float shear1[3] = { 0.f, 0.f, 0.f };
-  ClutterVertex rotate1 = CLUTTER_VERTEX_INIT_ZERO;
-  ClutterVertex translate1 = CLUTTER_VERTEX_INIT_ZERO;
+  graphene_point3d_t rotate1 = GRAPHENE_POINT3D_INIT_ZERO;
+  graphene_point3d_t translate1 = GRAPHENE_POINT3D_INIT_ZERO;
   ClutterVertex4 perspective1 = { 0.f, 0.f, 0.f, 0.f };
-  ClutterVertex scale2 = CLUTTER_VERTEX_INIT (1.f, 1.f, 1.f);
+  graphene_point3d_t scale2 = GRAPHENE_POINT3D_INIT (1.f, 1.f, 1.f);
   float shear2[3] = { 0.f, 0.f, 0.f };
-  ClutterVertex rotate2 = CLUTTER_VERTEX_INIT_ZERO;
-  ClutterVertex translate2 = CLUTTER_VERTEX_INIT_ZERO;
+  graphene_point3d_t rotate2 = GRAPHENE_POINT3D_INIT_ZERO;
+  graphene_point3d_t translate2 = GRAPHENE_POINT3D_INIT_ZERO;
   ClutterVertex4 perspective2 = { 0.f, 0.f, 0.f, 0.f };
-  ClutterVertex scale_res = CLUTTER_VERTEX_INIT (1.f, 1.f, 1.f);
+  graphene_point3d_t scale_res = GRAPHENE_POINT3D_INIT (1.f, 1.f, 1.f);
   float shear_res = 0.f;
-  ClutterVertex rotate_res = CLUTTER_VERTEX_INIT_ZERO;
-  ClutterVertex translate_res = CLUTTER_VERTEX_INIT_ZERO;
+  graphene_point3d_t rotate_res = GRAPHENE_POINT3D_INIT_ZERO;
+  graphene_point3d_t translate_res = GRAPHENE_POINT3D_INIT_ZERO;
   ClutterVertex4 perspective_res = { 0.f, 0.f, 0.f, 0.f };
   ClutterMatrix res;
 
@@ -1427,11 +1255,11 @@ clutter_matrix_progress (const GValue *a,
   res.ww = perspective_res.w;
 
   /* translation */
-  clutter_vertex_interpolate (&translate1, &translate2, progress, &translate_res);
+  graphene_point3d_interpolate (&translate1, &translate2, progress, &translate_res);
   cogl_matrix_translate (&res, translate_res.x, translate_res.y, translate_res.z);
 
   /* rotation */
-  clutter_vertex_interpolate (&rotate1, &rotate2, progress, &rotate_res);
+  graphene_point3d_interpolate (&rotate1, &rotate2, progress, &rotate_res);
   cogl_matrix_rotate (&res, rotate_res.x, 1.0f, 0.0f, 0.0f);
   cogl_matrix_rotate (&res, rotate_res.y, 0.0f, 1.0f, 0.0f);
   cogl_matrix_rotate (&res, rotate_res.z, 0.0f, 0.0f, 1.0f);
@@ -1450,7 +1278,7 @@ clutter_matrix_progress (const GValue *a,
     _clutter_util_matrix_skew_xy (&res, shear_res);
 
   /* scale */
-  clutter_vertex_interpolate (&scale1, &scale2, progress, &scale_res);
+  graphene_point3d_interpolate (&scale1, &scale2, progress, &scale_res);
   cogl_matrix_scale (&res, scale_res.x, scale_res.y, scale_res.z);
 
   g_value_set_boxed (retval, &res);
diff --git a/clutter/clutter/clutter-bind-constraint.c b/clutter/clutter/clutter-bind-constraint.c
index 138866882..3443599e6 100644
--- a/clutter/clutter/clutter-bind-constraint.c
+++ b/clutter/clutter/clutter-bind-constraint.c
@@ -152,7 +152,9 @@ clutter_bind_constraint_update_allocation (ClutterConstraint *constraint,
   ClutterBindConstraint *bind = CLUTTER_BIND_CONSTRAINT (constraint);
   gfloat source_width, source_height;
   gfloat actor_width, actor_height;
-  ClutterVertex source_position = { 0., };
+  graphene_point3d_t source_position;
+
+  source_position = GRAPHENE_POINT3D_INIT (0.f, 0.f, 0.f);
 
   if (bind->source == NULL)
     return;
diff --git a/clutter/clutter/clutter-blur-effect.c b/clutter/clutter/clutter-blur-effect.c
index 1ffb99c0f..06a7b2d4b 100644
--- a/clutter/clutter/clutter-blur-effect.c
+++ b/clutter/clutter/clutter-blur-effect.c
@@ -182,7 +182,7 @@ clutter_blur_effect_modify_paint_volume (ClutterEffect      *effect,
                                          ClutterPaintVolume *volume)
 {
   gfloat cur_width, cur_height;
-  ClutterVertex origin;
+  graphene_point3d_t origin;
 
   clutter_paint_volume_get_origin (volume, &origin);
   cur_width = clutter_paint_volume_get_width (volume);
diff --git a/clutter/clutter/clutter-graphene.c b/clutter/clutter/clutter-graphene.c
new file mode 100644
index 000000000..a480ecc87
--- /dev/null
+++ b/clutter/clutter/clutter-graphene.c
@@ -0,0 +1,54 @@
+/*
+ * Clutter.
+ *
+ * An OpenGL based 'interactive canvas' library.
+ *
+ * Authored By Georges Basile Stavracas Neto <georges stavracas gmail com>
+ *
+ * Copyright (C) 2019 Endless, Inc
+ * Copyright (C) 2009, 2010 Intel Corp
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "clutter-build-config.h"
+
+#include "clutter-graphene.h"
+
+#include "clutter-private.h"
+#include "clutter-types.h"
+
+static gboolean
+graphene_point3d_progress (const GValue *a,
+                           const GValue *b,
+                           double        progress,
+                           GValue       *retval)
+{
+  const graphene_point3d_t *av = g_value_get_boxed (a);
+  const graphene_point3d_t *bv = g_value_get_boxed (b);
+  graphene_point3d_t res;
+
+  graphene_point3d_interpolate (av, bv, progress, &res);
+
+  g_value_set_boxed (retval, &res);
+
+  return TRUE;
+}
+
+void
+clutter_graphene_init (void)
+{
+  clutter_interval_register_progress_func (GRAPHENE_TYPE_POINT3D,
+                                           graphene_point3d_progress);
+}
diff --git a/clutter/clutter/clutter-graphene.h b/clutter/clutter/clutter-graphene.h
new file mode 100644
index 000000000..ddea3ca4a
--- /dev/null
+++ b/clutter/clutter/clutter-graphene.h
@@ -0,0 +1,30 @@
+/*
+ * Clutter.
+ *
+ * An OpenGL based 'interactive canvas' library.
+ *
+ * Authored By Georges Basile Stavracas Neto <georges stavracas gmail com>
+ *
+ * Copyright (C) 2019 Endless, Inc
+ * Copyright (C) 2009, 2010 Intel Corp
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef CLUTTER_GRAPHENE_H
+#define CLUTTER_GRAPHENE_H
+
+void clutter_graphene_init (void);
+
+#endif
diff --git a/clutter/clutter/clutter-main.c b/clutter/clutter/clutter-main.c
index 2bb5bd2c8..3b1eec459 100644
--- a/clutter/clutter/clutter-main.c
+++ b/clutter/clutter/clutter-main.c
@@ -59,6 +59,7 @@
 #include "clutter-event-private.h"
 #include "clutter-feature.h"
 #include "clutter-input-pointer-a11y-private.h"
+#include "clutter-graphene.h"
 #include "clutter-main.h"
 #include "clutter-master-clock.h"
 #include "clutter-mutter.h"
@@ -2194,6 +2195,8 @@ clutter_base_init (void)
 
       /* initialise the Big Clutter Lockā„¢ if necessary */
       clutter_threads_init_default ();
+
+      clutter_graphene_init ();
     }
 }
 
diff --git a/clutter/clutter/clutter-offscreen-effect.c b/clutter/clutter/clutter-offscreen-effect.c
index 9e3756765..55be338a3 100644
--- a/clutter/clutter/clutter-offscreen-effect.c
+++ b/clutter/clutter/clutter-offscreen-effect.c
@@ -86,7 +86,7 @@ struct _ClutterOffscreenEffectPrivate
   ClutterActor *actor;
   ClutterActor *stage;
 
-  ClutterVertex position;
+  graphene_point3d_t position;
 
   int fbo_offset_x;
   int fbo_offset_y;
@@ -250,9 +250,11 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect)
   gfloat target_width = -1, target_height = -1;
   gfloat resource_scale;
   gfloat ceiled_resource_scale;
-  ClutterVertex local_offset = { 0.f, 0.f, 0.f };
+  graphene_point3d_t local_offset;
   gfloat old_viewport[4];
 
+  local_offset = GRAPHENE_POINT3D_INIT (0.0f, 0.0f, 0.0f);
+
   if (!clutter_actor_meta_get_enabled (CLUTTER_ACTOR_META (effect)))
     return FALSE;
 
diff --git a/clutter/clutter/clutter-paint-volume-private.h b/clutter/clutter/clutter-paint-volume-private.h
index 72bc7aee3..21e35c202 100644
--- a/clutter/clutter/clutter-paint-volume-private.h
+++ b/clutter/clutter/clutter-paint-volume-private.h
@@ -58,7 +58,7 @@ struct _ClutterPaintVolume
    * elements 4, 5, 6 and 7 most of the time for 2D actors when
    * calculating the projected paint box.
    */
-  ClutterVertex vertices[8];
+  graphene_point3d_t vertices[8];
 
   /* As an optimization for internally managed PaintVolumes we allow
    * initializing ClutterPaintVolume variables allocated on the stack
diff --git a/clutter/clutter/clutter-paint-volume.c b/clutter/clutter/clutter-paint-volume.c
index 0a197cdf6..09edeb6f0 100644
--- a/clutter/clutter/clutter-paint-volume.c
+++ b/clutter/clutter/clutter-paint-volume.c
@@ -63,7 +63,7 @@ _clutter_paint_volume_new (ClutterActor *actor)
 
   pv->actor = actor;
 
-  memset (pv->vertices, 0, 8 * sizeof (ClutterVertex));
+  memset (pv->vertices, 0, 8 * sizeof (graphene_point3d_t));
 
   pv->is_static = FALSE;
   pv->is_empty = TRUE;
@@ -96,7 +96,7 @@ _clutter_paint_volume_init_static (ClutterPaintVolume *pv,
 {
   pv->actor = actor;
 
-  memset (pv->vertices, 0, 8 * sizeof (ClutterVertex));
+  memset (pv->vertices, 0, 8 * sizeof (graphene_point3d_t));
 
   pv->is_static = TRUE;
   pv->is_empty = TRUE;
@@ -170,7 +170,7 @@ clutter_paint_volume_free (ClutterPaintVolume *pv)
 /**
  * clutter_paint_volume_set_origin:
  * @pv: a #ClutterPaintVolume
- * @origin: a #ClutterVertex
+ * @origin: a #graphene_point3d_t
  *
  * Sets the origin of the paint volume.
  *
@@ -182,8 +182,8 @@ clutter_paint_volume_free (ClutterPaintVolume *pv)
  * Since: 1.6
  */
 void
-clutter_paint_volume_set_origin (ClutterPaintVolume  *pv,
-                                 const ClutterVertex *origin)
+clutter_paint_volume_set_origin (ClutterPaintVolume       *pv,
+                                 const graphene_point3d_t *origin)
 {
   static const int key_vertices[4] = { 0, 1, 3, 4 };
   float dx, dy, dz;
@@ -210,7 +210,7 @@ clutter_paint_volume_set_origin (ClutterPaintVolume  *pv,
 /**
  * clutter_paint_volume_get_origin:
  * @pv: a #ClutterPaintVolume
- * @vertex: (out): the return location for a #ClutterVertex
+ * @vertex: (out): the return location for a #graphene_point3d_t
  *
  * Retrieves the origin of the #ClutterPaintVolume.
  *
@@ -218,7 +218,7 @@ clutter_paint_volume_set_origin (ClutterPaintVolume  *pv,
  */
 void
 clutter_paint_volume_get_origin (const ClutterPaintVolume *pv,
-                                 ClutterVertex            *vertex)
+                                 graphene_point3d_t       *vertex)
 {
   g_return_if_fail (pv != NULL);
   g_return_if_fail (vertex != NULL);
@@ -659,7 +659,7 @@ clutter_paint_volume_union_box (ClutterPaintVolume    *pv,
                                 const ClutterActorBox *box)
 {
   ClutterPaintVolume volume;
-  ClutterVertex origin;
+  graphene_point3d_t origin;
 
   g_return_if_fail (pv != NULL);
   g_return_if_fail (box != NULL);
@@ -757,7 +757,7 @@ _clutter_paint_volume_get_bounding_box (ClutterPaintVolume *pv,
                                         ClutterActorBox *box)
 {
   gfloat x_min, y_min, x_max, y_max;
-  ClutterVertex *vertices;
+  graphene_point3d_t *vertices;
   int count;
   gint i;
 
@@ -878,9 +878,9 @@ _clutter_paint_volume_transform (ClutterPaintVolume *pv,
 
   cogl_matrix_transform_points (matrix,
                                 3,
-                                sizeof (ClutterVertex),
+                                sizeof (graphene_point3d_t),
                                 pv->vertices,
-                                sizeof (ClutterVertex),
+                                sizeof (graphene_point3d_t),
                                 pv->vertices,
                                 transform_count);
 
@@ -896,7 +896,7 @@ _clutter_paint_volume_axis_align (ClutterPaintVolume *pv)
 {
   int count;
   int i;
-  ClutterVertex origin;
+  graphene_point3d_t origin;
   float max_x;
   float max_y;
   float max_z;
@@ -1075,7 +1075,7 @@ _clutter_paint_volume_cull (ClutterPaintVolume *pv,
                             const ClutterPlane *planes)
 {
   int vertex_count;
-  ClutterVertex *vertices = pv->vertices;
+  graphene_point3d_t *vertices = pv->vertices;
   gboolean partial = FALSE;
   int i;
   int j;
diff --git a/clutter/clutter/clutter-private.h b/clutter/clutter/clutter-private.h
index 24ada7247..a89c61b37 100644
--- a/clutter/clutter/clutter-private.h
+++ b/clutter/clutter/clutter-private.h
@@ -220,12 +220,12 @@ void _clutter_run_repaint_functions (ClutterRepaintFlags flags);
 
 GType _clutter_layout_manager_get_child_meta_type (ClutterLayoutManager *manager);
 
-void  _clutter_util_fully_transform_vertices (const CoglMatrix    *modelview,
-                                              const CoglMatrix    *projection,
-                                              const float         *viewport,
-                                              const ClutterVertex *vertices_in,
-                                              ClutterVertex       *vertices_out,
-                                              int                  n_vertices);
+void  _clutter_util_fully_transform_vertices (const CoglMatrix         *modelview,
+                                              const CoglMatrix         *projection,
+                                              const float              *viewport,
+                                              const graphene_point3d_t *vertices_in,
+                                              graphene_point3d_t       *vertices_out,
+                                              int                       n_vertices);
 
 void _clutter_util_rect_from_rectangle (const cairo_rectangle_int_t *src,
                                         ClutterRect                 *dest);
@@ -278,10 +278,10 @@ void    _clutter_util_matrix_skew_yz            (ClutterMatrix *matrix,
                                                  float          factor);
 
 gboolean        _clutter_util_matrix_decompose  (const ClutterMatrix *src,
-                                                 ClutterVertex       *scale_p,
+                                                 graphene_point3d_t  *scale_p,
                                                  float                shear_p[3],
-                                                 ClutterVertex       *rotate_p,
-                                                 ClutterVertex       *translate_p,
+                                                 graphene_point3d_t  *rotate_p,
+                                                 graphene_point3d_t  *translate_p,
                                                  ClutterVertex4      *perspective_p);
 
 CLUTTER_EXPORT
diff --git a/clutter/clutter/clutter-text.c b/clutter/clutter/clutter-text.c
index f8e5efa38..1684a2bd2 100644
--- a/clutter/clutter/clutter-text.c
+++ b/clutter/clutter/clutter-text.c
@@ -2799,7 +2799,7 @@ add_selection_to_paint_volume (ClutterText           *text,
 {
   ClutterPaintVolume *total_volume = user_data;
   ClutterPaintVolume rect_volume;
-  ClutterVertex vertex;
+  graphene_point3d_t vertex;
 
   _clutter_paint_volume_init_static (&rect_volume, CLUTTER_ACTOR (text));
 
@@ -2821,7 +2821,7 @@ clutter_text_get_paint_volume_for_cursor (ClutterText        *text,
                                           ClutterPaintVolume *volume)
 {
   ClutterTextPrivate *priv = text->priv;
-  ClutterVertex origin;
+  graphene_point3d_t origin;
 
   clutter_text_ensure_cursor_position (text, resource_scale);
 
@@ -2864,7 +2864,7 @@ clutter_text_get_paint_volume (ClutterActor       *self,
     {
       PangoLayout *layout;
       PangoRectangle ink_rect;
-      ClutterVertex origin;
+      graphene_point3d_t origin;
       float resource_scale;
 
       /* If the text is single line editable then it gets clipped to
diff --git a/clutter/clutter/clutter-types.h b/clutter/clutter/clutter-types.h
index 80e4f6768..12db171da 100644
--- a/clutter/clutter/clutter-types.h
+++ b/clutter/clutter/clutter-types.h
@@ -33,6 +33,8 @@
 #include <clutter/clutter-macros.h>
 #include <clutter/clutter-enums.h>
 
+#include <graphene-gobject.h>
+
 G_BEGIN_DECLS
 
 #define CLUTTER_TYPE_ACTOR_BOX          (clutter_actor_box_get_type ())
@@ -42,7 +44,6 @@ G_BEGIN_DECLS
 #define CLUTTER_TYPE_MATRIX             (clutter_matrix_get_type ())
 #define CLUTTER_TYPE_PAINT_VOLUME       (clutter_paint_volume_get_type ())
 #define CLUTTER_TYPE_PERSPECTIVE        (clutter_perspective_get_type ())
-#define CLUTTER_TYPE_VERTEX             (clutter_vertex_get_type ())
 #define CLUTTER_TYPE_POINT              (clutter_point_get_type ())
 #define CLUTTER_TYPE_SIZE               (clutter_size_get_type ())
 #define CLUTTER_TYPE_RECT               (clutter_rect_get_type ())
@@ -85,7 +86,6 @@ typedef struct _ClutterPerspective              ClutterPerspective;
 typedef struct _ClutterPoint                    ClutterPoint;
 typedef struct _ClutterRect                     ClutterRect;
 typedef struct _ClutterSize                     ClutterSize;
-typedef struct _ClutterVertex                   ClutterVertex;
 
 typedef struct _ClutterAlpha                   ClutterAlpha;
 typedef struct _ClutterAnimation                ClutterAnimation;
@@ -376,69 +376,6 @@ float                   clutter_rect_get_width          (ClutterRect       *rect
 CLUTTER_EXPORT
 float                   clutter_rect_get_height         (ClutterRect       *rect);
 
-/**
- * ClutterVertex:
- * @x: X coordinate of the vertex
- * @y: Y coordinate of the vertex
- * @z: Z coordinate of the vertex
- *
- * A point in 3D space, expressed in pixels
- *
- * Since: 0.4
- */
-struct _ClutterVertex
-{
-  gfloat x;
-  gfloat y;
-  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.:
- *
- * |[
- *   ClutterVertex v = CLUTTER_VERTEX_INIT (x, y, z);
- * ]|
- *
- * Since: 1.10
- */
-#define CLUTTER_VERTEX_INIT(x,y,z)      { (x), (y), (z) }
-
-/**
- * CLUTTER_VERTEX_INIT_ZERO:
- *
- * A simple macro for initializing a #ClutterVertex to (0, 0, 0).
- *
- * Since: 1.12
- */
-#define CLUTTER_VERTEX_INIT_ZERO        CLUTTER_VERTEX_INIT (0.f, 0.f, 0.f)
-
-CLUTTER_EXPORT
-GType          clutter_vertex_get_type (void) G_GNUC_CONST;
-CLUTTER_EXPORT
-ClutterVertex *clutter_vertex_new      (gfloat               x,
-                                        gfloat               y,
-                                        gfloat               z);
-CLUTTER_EXPORT
-ClutterVertex *clutter_vertex_alloc    (void);
-CLUTTER_EXPORT
-ClutterVertex *clutter_vertex_init     (ClutterVertex       *vertex,
-                                        gfloat               x,
-                                        gfloat               y,
-                                        gfloat               z);
-CLUTTER_EXPORT
-ClutterVertex *clutter_vertex_copy     (const ClutterVertex *vertex);
-CLUTTER_EXPORT
-void           clutter_vertex_free     (ClutterVertex       *vertex);
-CLUTTER_EXPORT
-gboolean       clutter_vertex_equal    (const ClutterVertex *vertex_a,
-                                        const ClutterVertex *vertex_b);
-
 /**
  * ClutterActorBox:
  * @x1: X coordinate of the top left corner
@@ -542,8 +479,8 @@ gboolean         clutter_actor_box_contains      (const ClutterActorBox *box,
                                                   gfloat                 x,
                                                   gfloat                 y);
 CLUTTER_EXPORT
-void             clutter_actor_box_from_vertices (ClutterActorBox       *box,
-                                                  const ClutterVertex    verts[]);
+void             clutter_actor_box_from_vertices (ClutterActorBox          *box,
+                                                  const graphene_point3d_t  verts[]);
 CLUTTER_EXPORT
 void             clutter_actor_box_interpolate   (const ClutterActorBox *initial,
                                                   const ClutterActorBox *final,
@@ -675,10 +612,10 @@ void                clutter_paint_volume_free                (ClutterPaintVolume
 
 CLUTTER_EXPORT
 void                clutter_paint_volume_set_origin          (ClutterPaintVolume       *pv,
-                                                              const ClutterVertex      *origin);
+                                                              const graphene_point3d_t *origin);
 CLUTTER_EXPORT
 void                clutter_paint_volume_get_origin          (const ClutterPaintVolume *pv,
-                                                              ClutterVertex            *vertex);
+                                                              graphene_point3d_t       *vertex);
 CLUTTER_EXPORT
 void                clutter_paint_volume_set_width           (ClutterPaintVolume       *pv,
                                                               gfloat                    width);
diff --git a/clutter/clutter/clutter-util.c b/clutter/clutter/clutter-util.c
index 917da76be..c233ef273 100644
--- a/clutter/clutter/clutter-util.c
+++ b/clutter/clutter/clutter-util.c
@@ -51,8 +51,8 @@ void
 _clutter_util_fully_transform_vertices (const CoglMatrix *modelview,
                                         const CoglMatrix *projection,
                                         const float *viewport,
-                                        const ClutterVertex *vertices_in,
-                                        ClutterVertex *vertices_out,
+                                        const graphene_point3d_t *vertices_in,
+                                        graphene_point3d_t *vertices_out,
                                         int n_vertices)
 {
   CoglMatrix modelview_projection;
@@ -69,7 +69,7 @@ _clutter_util_fully_transform_vertices (const CoglMatrix *modelview,
                             modelview);
       cogl_matrix_project_points (&modelview_projection,
                                   3,
-                                  sizeof (ClutterVertex),
+                                  sizeof (graphene_point3d_t),
                                   vertices_in,
                                   sizeof (ClutterVertex4),
                                   vertices_tmp,
@@ -79,7 +79,7 @@ _clutter_util_fully_transform_vertices (const CoglMatrix *modelview,
     {
       cogl_matrix_transform_points (modelview,
                                     3,
-                                    sizeof (ClutterVertex),
+                                    sizeof (graphene_point3d_t),
                                     vertices_in,
                                     sizeof (ClutterVertex4),
                                     vertices_tmp,
@@ -97,7 +97,7 @@ _clutter_util_fully_transform_vertices (const CoglMatrix *modelview,
   for (i = 0; i < n_vertices; i++)
     {
       ClutterVertex4 vertex_tmp = vertices_tmp[i];
-      ClutterVertex *vertex_out = &vertices_out[i];
+      graphene_point3d_t *vertex_out = &vertices_out[i];
       /* Finally translate from OpenGL coords to window coords */
       vertex_out->x = MTX_GL_SCALE_X (vertex_tmp.x, vertex_tmp.w,
                                       viewport[2], viewport[0]);
@@ -299,48 +299,12 @@ _clutter_util_matrix_skew_yz (ClutterMatrix *matrix,
   matrix->zw += matrix->yw * factor;
 }
 
-static float
-_clutter_util_vertex_length (const ClutterVertex *vertex)
-{
-  return sqrtf (vertex->x * vertex->x + vertex->y * vertex->y + vertex->z * vertex->z);
-}
-
-static void
-_clutter_util_vertex_normalize (ClutterVertex *vertex)
-{
-  float factor = _clutter_util_vertex_length (vertex);
-
-  if (factor == 0.f)
-    return;
-
-  vertex->x /= factor;
-  vertex->y /= factor;
-  vertex->z /= factor;
-}
-
-static float
-_clutter_util_vertex_dot (const ClutterVertex *v1,
-                          const ClutterVertex *v2)
-{
-  return v1->x * v2->x + v1->y * v2->y + v1->z * v2->z;
-}
-
-static void
-_clutter_util_vertex_cross (const ClutterVertex *v1,
-                            const ClutterVertex *v2,
-                            ClutterVertex       *res)
-{
-  res->x = v1->y * v2->z - v2->y * v1->z;
-  res->y = v1->z * v2->x - v2->z * v1->x;
-  res->z = v1->x * v2->y - v2->x * v1->y;
-}
-
 static void
-_clutter_util_vertex_combine (const ClutterVertex *a,
-                              const ClutterVertex *b,
-                              double               ascl,
-                              double               bscl,
-                              ClutterVertex       *res)
+_clutter_util_vertex_combine (const graphene_point3d_t *a,
+                              const graphene_point3d_t *b,
+                              double                    ascl,
+                              double                    bscl,
+                              graphene_point3d_t       *res)
 {
   res->x = (ascl * a->x) + (bscl * b->x);
   res->y = (ascl * a->y) + (bscl * b->y);
@@ -388,16 +352,16 @@ _clutter_util_vertex4_interpolate (const ClutterVertex4 *a,
  */
 gboolean
 _clutter_util_matrix_decompose (const ClutterMatrix *src,
-                                ClutterVertex       *scale_p,
+                                graphene_point3d_t  *scale_p,
                                 float                shear_p[3],
-                                ClutterVertex       *rotate_p,
-                                ClutterVertex       *translate_p,
+                                graphene_point3d_t  *rotate_p,
+                                graphene_point3d_t  *translate_p,
                                 ClutterVertex4      *perspective_p)
 {
   CoglMatrix matrix = *src;
   CoglMatrix perspective;
   ClutterVertex4 vertex_tmp;
-  ClutterVertex row[3], pdum;
+  graphene_point3d_t row[3], pdum;
   int i, j;
 
 #define XY_SHEAR        0
@@ -485,34 +449,34 @@ _clutter_util_matrix_decompose (const ClutterMatrix *src,
     }
 
   /* compute scale.x and normalize the first row */
-  scale_p->x = _clutter_util_vertex_length (&row[0]);
-  _clutter_util_vertex_normalize (&row[0]);
+  scale_p->x = graphene_point3d_length (&row[0]);
+  graphene_point3d_normalize (&row[0], &row[0]);
 
   /* compute XY shear and make the second row orthogonal to the first */
-  shear_p[XY_SHEAR] = _clutter_util_vertex_dot (&row[0], &row[1]);
+  shear_p[XY_SHEAR] = graphene_point3d_dot (&row[0], &row[1]);
   _clutter_util_vertex_combine (&row[1], &row[0],
                                 1.0, -shear_p[XY_SHEAR],
                                 &row[1]);
 
   /* compute the Y scale and normalize the second row */
-  scale_p->y = _clutter_util_vertex_length (&row[1]);
-  _clutter_util_vertex_normalize (&row[1]);
+  scale_p->y = graphene_point3d_length (&row[1]);
+  graphene_point3d_normalize (&row[1], &row[1]);
   shear_p[XY_SHEAR] /= scale_p->y;
 
   /* compute XZ and YZ shears, orthogonalize the third row */
-  shear_p[XZ_SHEAR] = _clutter_util_vertex_dot (&row[0], &row[2]);
+  shear_p[XZ_SHEAR] = graphene_point3d_dot (&row[0], &row[2]);
   _clutter_util_vertex_combine (&row[2], &row[0],
                                 1.0, -shear_p[XZ_SHEAR],
                                 &row[2]);
 
-  shear_p[YZ_SHEAR] = _clutter_util_vertex_dot (&row[1], &row[2]);
+  shear_p[YZ_SHEAR] = graphene_point3d_dot (&row[1], &row[2]);
   _clutter_util_vertex_combine (&row[2], &row[1],
                                 1.0, -shear_p[YZ_SHEAR],
                                 &row[2]);
 
   /* get the Z scale and normalize the third row*/
-  scale_p->z = _clutter_util_vertex_length (&row[2]);
-  _clutter_util_vertex_normalize (&row[2]);
+  scale_p->z = graphene_point3d_length (&row[2]);
+  graphene_point3d_normalize (&row[2], &row[2]);
   shear_p[XZ_SHEAR] /= scale_p->z;
   shear_p[YZ_SHEAR] /= scale_p->z;
 
@@ -520,8 +484,8 @@ _clutter_util_matrix_decompose (const ClutterMatrix *src,
    * check for a coordinate system flip; if the determinant
    * is -1, then negate the matrix and scaling factors
    */
-  _clutter_util_vertex_cross (&row[1], &row[2], &pdum);
-  if (_clutter_util_vertex_dot (&row[0], &pdum) < 0.f)
+  graphene_point3d_cross (&row[1], &row[2], &pdum);
+  if (graphene_point3d_dot (&row[0], &pdum) < 0.f)
     {
       scale_p->x *= -1.f;
 
diff --git a/clutter/clutter/clutter-zoom-action.c b/clutter/clutter/clutter-zoom-action.c
index 6cd35fbc1..67a3d12bd 100644
--- a/clutter/clutter/clutter-zoom-action.c
+++ b/clutter/clutter/clutter-zoom-action.c
@@ -244,7 +244,7 @@ clutter_zoom_action_real_zoom (ClutterZoomAction *action,
   ClutterZoomActionPrivate *priv = action->priv;
   gfloat x, y, z;
   gdouble scale_x, scale_y;
-  ClutterVertex out, in;
+  graphene_point3d_t out, in;
 
   in.x = priv->transformed_focal_point.x;
   in.y = priv->transformed_focal_point.y;
diff --git a/clutter/clutter/deprecated/clutter-animation.c b/clutter/clutter/deprecated/clutter-animation.c
index 035f8549a..bb8c8a7a3 100644
--- a/clutter/clutter/deprecated/clutter-animation.c
+++ b/clutter/clutter/deprecated/clutter-animation.c
@@ -2220,7 +2220,7 @@ clutter_actor_animate_with_timeline (ClutterActor    *actor,
  *
  * Will animate the "rotation-angle-z" property between the current value
  * and 360 degrees, and set the "rotation-center-z" property to the fixed
- * value of the #ClutterVertex "center".
+ * value of the #graphene_point3d_t "center".
  *
  * This function will implicitly create a #ClutterAnimation object which
  * will be assigned to the @actor and will be returned to the developer
diff --git a/clutter/clutter/deprecated/clutter-texture.c b/clutter/clutter/deprecated/clutter-texture.c
index 203e84f43..b53a2dee1 100644
--- a/clutter/clutter/deprecated/clutter-texture.c
+++ b/clutter/clutter/deprecated/clutter-texture.c
@@ -438,7 +438,7 @@ set_viewport_with_buffer_under_fbo_source (ClutterActor *fbo_source,
        * falling back to a stage sized fbo with an offset of (0,0)
        */
 
-      ClutterVertex verts[4];
+      graphene_point3d_t verts[4];
       float x_min = G_MAXFLOAT, y_min = G_MAXFLOAT;
       int i;
 
diff --git a/clutter/clutter/meson.build b/clutter/clutter/meson.build
index b3d5a2fd6..c551f8984 100644
--- a/clutter/clutter/meson.build
+++ b/clutter/clutter/meson.build
@@ -127,6 +127,7 @@ clutter_sources = [
   'clutter-flatten-effect.c',
   'clutter-flow-layout.c',
   'clutter-gesture-action.c',
+  'clutter-graphene.c',
   'clutter-grid-layout.c',
   'clutter-image.c',
   'clutter-input-device.c',
@@ -191,6 +192,7 @@ clutter_private_headers = [
   'clutter-effect-private.h',
   'clutter-event-private.h',
   'clutter-flatten-effect.h',
+  'clutter-graphene.h',
   'clutter-gesture-action-private.h',
   'clutter-id-pool.h',
   'clutter-input-focus-private.h',
diff --git a/src/compositor/clutter-utils.c b/src/compositor/clutter-utils.c
index cfa35aaf9..a399cd477 100644
--- a/src/compositor/clutter-utils.c
+++ b/src/compositor/clutter-utils.c
@@ -66,11 +66,11 @@ round_to_fixed (float x)
  * in @x_origin and @y_origin.
  */
 gboolean
-meta_actor_vertices_are_untransformed (ClutterVertex *verts,
-                                       float          widthf,
-                                       float          heightf,
-                                       int           *x_origin,
-                                       int           *y_origin)
+meta_actor_vertices_are_untransformed (graphene_point3d_t *verts,
+                                       float               widthf,
+                                       float               heightf,
+                                       int                *x_origin,
+                                       int                *y_origin)
 {
   int width, height;
   int v0x, v0y, v1x, v1y, v2x, v2y, v3x, v3y;
@@ -119,7 +119,7 @@ meta_actor_is_untransformed (ClutterActor *actor,
                              int          *y_origin)
 {
   gfloat widthf, heightf;
-  ClutterVertex verts[4];
+  graphene_point3d_t verts[4];
 
   clutter_actor_get_size (actor, &widthf, &heightf);
   clutter_actor_get_abs_allocation_vertices (actor, verts);
@@ -153,7 +153,7 @@ meta_actor_painting_untransformed (CoglFramebuffer *fb,
                                    int             *y_origin)
 {
   CoglMatrix modelview, projection, modelview_projection;
-  ClutterVertex vertices[4];
+  graphene_point3d_t vertices[4];
   float viewport[4];
   int i;
 
diff --git a/src/compositor/clutter-utils.h b/src/compositor/clutter-utils.h
index b340ba464..d0513393e 100644
--- a/src/compositor/clutter-utils.h
+++ b/src/compositor/clutter-utils.h
@@ -23,11 +23,11 @@
 
 #include "clutter/clutter.h"
 
-gboolean meta_actor_vertices_are_untransformed (ClutterVertex *verts,
-                                                float          widthf,
-                                                float          heightf,
-                                                int           *x_origin,
-                                                int           *y_origin);
+gboolean meta_actor_vertices_are_untransformed (graphene_point3d_t *verts,
+                                                float               widthf,
+                                                float               heightf,
+                                                int                *x_origin,
+                                                int                *y_origin);
 gboolean meta_actor_is_untransformed (ClutterActor *actor,
                                       int          *x_origin,
                                       int          *y_origin);
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index d52ec240a..d644bc9a4 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -1152,7 +1152,7 @@ meta_window_actor_transform_relative_position (MetaScreenCastWindow *screen_cast
   MetaWindowActorPrivate *priv =
     meta_window_actor_get_instance_private (window_actor);
   MetaRectangle bounds;
-  ClutterVertex v1 = { 0.f, }, v2 = { 0.f, };
+  graphene_point3d_t v1 = { 0.f, }, v2 = { 0.f, };
 
   meta_window_actor_get_frame_bounds (screen_cast_window, &bounds);
 
diff --git a/src/tests/clutter/conform/actor-anchors.c b/src/tests/clutter/conform/actor-anchors.c
index 842379818..3cf3191f3 100644
--- a/src/tests/clutter/conform/actor-anchors.c
+++ b/src/tests/clutter/conform/actor-anchors.c
@@ -101,7 +101,7 @@ notify_cb (GObject *object, GParamSpec *pspec, TestState *state)
    macro so that the assertion failure will report the right line
    number */
 #define assert_coords(state, x_1, y_1, x_2, y_2)        G_STMT_START {  \
-  ClutterVertex verts[4];                                               \
+  graphene_point3d_t verts[4];                                          \
   clutter_actor_get_abs_allocation_vertices ((state)->rect, verts);     \
   check_coords ((state), (x_1), (y_1), (x_2), (y_2), verts);            \
   g_assert (approx_equal ((x_1), verts[0].x));                          \
@@ -116,7 +116,7 @@ notify_cb (GObject *object, GParamSpec *pspec, TestState *state)
   g_assert (approx_equal (v->x, xc) &&                          \
             approx_equal (v->y, yc) &&                          \
             approx_equal (v->z, zc));                           \
-  g_boxed_free (CLUTTER_TYPE_VERTEX, v);        } G_STMT_END
+  g_boxed_free (GRAPHENE_TYPE_POINT3D, v);        } G_STMT_END
 
 static inline gboolean
 approx_equal (int a, int b)
@@ -130,7 +130,7 @@ check_coords (TestState *state,
               gint y_1,
               gint x_2,
               gint y_2,
-              const ClutterVertex *verts)
+              const graphene_point3d_t *verts)
 {
   if (g_test_verbose ())
     g_print ("checking that (%i,%i,%i,%i) \xe2\x89\x88 (%i,%i,%i,%i): %s\n",
@@ -426,7 +426,7 @@ test_rotate_center (TestState *state)
 {
   ClutterActor *rect = state->rect;
   gdouble angle_x, angle_y, angle_z;
-  ClutterVertex *center_x, *center_y, *center_z;
+  graphene_point3d_t *center_x, *center_y, *center_z;
   ClutterGravity z_center_gravity;
   gfloat stage_width, stage_height;
   gfloat rect_x, rect_y;
diff --git a/src/tests/clutter/interactive/test-layout.c b/src/tests/clutter/interactive/test-layout.c
index 7a5b3cf2e..4c73c0de2 100644
--- a/src/tests/clutter/interactive/test-layout.c
+++ b/src/tests/clutter/interactive/test-layout.c
@@ -334,7 +334,7 @@ my_thing_allocate (ClutterActor           *self,
           if (clutter_actor_is_scaled (child) ||
               clutter_actor_is_rotated (child))
             {
-              ClutterVertex v1 = { 0, }, v2 = { 0, };
+              graphene_point3d_t v1 = { 0, }, v2 = { 0, };
               ClutterActorBox transformed_box = { 0, };
 
               /* origin */
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c
index 647f05338..0aa153621 100644
--- a/src/wayland/meta-wayland-surface.c
+++ b/src/wayland/meta-wayland-surface.c
@@ -1646,11 +1646,11 @@ meta_wayland_surface_get_absolute_coordinates (MetaWaylandSurface *surface,
 {
   ClutterActor *actor =
     CLUTTER_ACTOR (meta_wayland_surface_get_actor (surface));
-  ClutterVertex sv = {
+  graphene_point3d_t sv = {
     .x = sx * surface->scale,
     .y = sy * surface->scale,
   };
-  ClutterVertex v = { 0 };
+  graphene_point3d_t v = { 0 };
 
   clutter_actor_apply_relative_transform_to_point (actor, NULL, &sv, &v);
 


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