[mutter/gbsneto/graphene-matrix: 52/71] clutter/stage: Only use graphene_matrix_* APIs




commit 6f84185097b920bc6cb58ebe009838f8b49e1464
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Fri Sep 11 16:18:51 2020 -0300

    clutter/stage: Only use graphene_matrix_* APIs
    
    Switch away from cogl_matrix_* APIs in favor of graphene_matrix_*
    ones. Notice that cogl_matrix_get_value() swaps row and column,
    which is reflected here.
    
    https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439

 clutter/clutter/clutter-stage.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)
---
diff --git a/clutter/clutter/clutter-stage.c b/clutter/clutter/clutter-stage.c
index ac6abb7336..725f990720 100644
--- a/clutter/clutter/clutter-stage.c
+++ b/clutter/clutter/clutter-stage.c
@@ -694,8 +694,8 @@ _cogl_util_get_eye_planes_for_screen_poly (float *polygon,
    * frustum; coordinates range from [-Wc,Wc] left to right on the
    * x-axis and [Wc,-Wc] top to bottom on the y-axis.
    */
-  wz = cogl_matrix_get_value (projection, 3, 2);
-  ww = cogl_matrix_get_value (projection, 3, 3);
+  wz = graphene_matrix_get_value (projection, 2, 3);
+  ww = graphene_matrix_get_value (projection, 3, 3);
   Wc = DEPTH * wz + ww;
 
 #define CLIP_X(X) ((((float)X - viewport[0]) * (2.0 / viewport[2])) - 1) * Wc
@@ -1585,8 +1585,7 @@ clutter_stage_real_apply_transform (ClutterActor      *stage,
 
   /* FIXME: we probably shouldn't be explicitly resetting the matrix
    * here... */
-  cogl_matrix_init_identity (matrix);
-  cogl_matrix_multiply (matrix, matrix, &priv->view);
+  graphene_matrix_init_from_matrix (matrix, &priv->view);
 }
 
 static void
@@ -2064,12 +2063,11 @@ clutter_stage_set_perspective (ClutterStage       *stage,
 
   priv->perspective = *perspective;
 
-  cogl_matrix_init_identity (&priv->projection);
-  cogl_matrix_perspective (&priv->projection,
-                           priv->perspective.fovy,
-                           priv->perspective.aspect,
-                           priv->perspective.z_near,
-                           priv->perspective.z_far);
+  graphene_matrix_init_perspective (&priv->projection,
+                                    priv->perspective.fovy,
+                                    priv->perspective.aspect,
+                                    priv->perspective.z_near,
+                                    priv->perspective.z_far);
   cogl_graphene_matrix_get_inverse (&priv->projection,
                                     &priv->inverse_projection);
 


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