[mutter/gbsneto/graphene-matrix: 56/57] tests: Use graphene APIs




commit 6105e65c2b83a4eaab510ec974aafae49f5806e7
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Fri Sep 11 19:46:48 2020 -0300

    tests: Use graphene APIs
    
    https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439

 src/tests/clutter/conform/actor-pivot-point.c      |  5 ++-
 .../clutter/interactive/test-cogl-multitexture.c   | 40 ++++++++++++----------
 .../clutter/interactive/test-cogl-offscreen.c      | 15 ++++----
 .../clutter/interactive/test-cogl-point-sprites.c  |  2 +-
 4 files changed, 34 insertions(+), 28 deletions(-)
---
diff --git a/src/tests/clutter/conform/actor-pivot-point.c b/src/tests/clutter/conform/actor-pivot-point.c
index 5213e69e94..f16d18dea2 100644
--- a/src/tests/clutter/conform/actor-pivot-point.c
+++ b/src/tests/clutter/conform/actor-pivot-point.c
@@ -33,14 +33,13 @@ actor_pivot (void)
   clutter_actor_set_rotation_angle (actor_implicit, CLUTTER_Z_AXIS, angle);
 
   /* Explicit transformation */
-  cogl_matrix_init_identity (&transform);
-  cogl_matrix_rotate (&transform, angle, 0, 0, 1.0);
+  graphene_matrix_init_rotate (&transform, angle, graphene_vec3_z_axis ());
   clutter_actor_set_transform (actor_explicit, &transform);
 
   clutter_actor_get_transform (actor_implicit, &result_implicit);
   clutter_actor_get_transform (actor_explicit, &result_explicit);
 
-  g_assert (cogl_matrix_equal (&result_implicit, &result_explicit));
+  g_assert (graphene_matrix_equal (&result_implicit, &result_explicit));
 
   clutter_actor_destroy (actor_implicit);
   clutter_actor_destroy (actor_explicit);
diff --git a/src/tests/clutter/interactive/test-cogl-multitexture.c 
b/src/tests/clutter/interactive/test-cogl-multitexture.c
index 93e2d5d5b7..f14f0b7d8a 100644
--- a/src/tests/clutter/interactive/test-cogl-multitexture.c
+++ b/src/tests/clutter/interactive/test-cogl-multitexture.c
@@ -45,14 +45,14 @@ frame_cb (ClutterTimeline  *timeline,
 {
   TestMultiLayerMaterialState *state = data;
 
-  cogl_matrix_multiply (&state->tex_matrix0,
-                       &state->tex_matrix0,
-                       &state->rot_matrix0);
+  graphene_matrix_multiply (&state->rot_matrix0,
+                            &state->tex_matrix0,
+                            &state->tex_matrix0);
   cogl_material_set_layer_matrix (state->material0, 2, &state->tex_matrix0);
 
-  cogl_matrix_multiply (&state->tex_matrix1,
-                       &state->tex_matrix1,
-                       &state->rot_matrix1);
+  graphene_matrix_multiply (&state->rot_matrix1,
+                            &state->tex_matrix1,
+                            &state->tex_matrix1);
   cogl_material_set_layer_matrix (state->material1, 2, &state->tex_matrix1);
 }
 
@@ -196,18 +196,22 @@ test_cogl_multitexture_main (int argc, char *argv[])
 
   state->tex_coords = tex_coords;
 
-  cogl_matrix_init_identity (&state->tex_matrix0);
-  cogl_matrix_init_identity (&state->tex_matrix1);
-  cogl_matrix_init_identity (&state->rot_matrix0);
-  cogl_matrix_init_identity (&state->rot_matrix1);
-
-  cogl_matrix_translate (&state->rot_matrix0, 0.5, 0.5, 0);
-  cogl_matrix_rotate (&state->rot_matrix0, 10.0, 0, 0, 1.0);
-  cogl_matrix_translate (&state->rot_matrix0, -0.5, -0.5, 0);
-
-  cogl_matrix_translate (&state->rot_matrix1, 0.5, 0.5, 0);
-  cogl_matrix_rotate (&state->rot_matrix1, -10.0, 0, 0, 1.0);
-  cogl_matrix_translate (&state->rot_matrix1, -0.5, -0.5, 0);
+  graphene_matrix_init_identity (&state->tex_matrix0);
+  graphene_matrix_init_identity (&state->tex_matrix1);
+  graphene_matrix_init_identity (&state->rot_matrix0);
+  graphene_matrix_init_identity (&state->rot_matrix1);
+
+  graohene_matrix_translate (&state->rot_matrix0,
+                             &GRAPHENE_POINT3D_INIT (-0.5, -0.5, 0));
+  graohene_matrix_rotate (&state->rot_matrix0, 10.0, graphene_vec3_z_axis ());
+  graphene_matrix_translate (&state->rot_matrix0,
+                             &GRAPHENE_POINT3D_INIT (0.5, 0.5, 0));
+
+  graphene_matrix_translate (&state->rot_matrix1,
+                             &GRAPHENE_POINT3D_INIT (-0.5, -0.5, 0));
+  graohene_matrix_rotate (&state->rot_matrix1, -10.0, graphene_vec3_z_axis ());
+  graphene_matrix_translate (&state->rot_matrix1,
+                             &GRAPHENE_POINT3D_INIT (0.5, 0.5, 0));
 
   clutter_actor_set_translation (data->parent_container, -86.f, -125.f, 0.f);
   clutter_container_add_actor (CLUTTER_CONTAINER(stage),
diff --git a/src/tests/clutter/interactive/test-cogl-offscreen.c 
b/src/tests/clutter/interactive/test-cogl-offscreen.c
index de77745e91..5d80899447 100644
--- a/src/tests/clutter/interactive/test-cogl-offscreen.c
+++ b/src/tests/clutter/interactive/test-cogl-offscreen.c
@@ -232,12 +232,15 @@ setup_viewport (CoglFramebuffer *framebuffer,
    */
 
   cogl_framebuffer_get_projection_matrix (framebuffer, &projection_matrix);
-  z_camera = 0.5 * cogl_matrix_get_value (&projection_matrix, 0, 0);
-
-  cogl_matrix_init_identity (&mv_matrix);
-  cogl_matrix_translate (&mv_matrix, -0.5f, -0.5f, -z_camera);
-  cogl_matrix_scale (&mv_matrix, 1.0f / width, -1.0f / height, 1.0f / width);
-  cogl_matrix_translate (&mv_matrix, 0.0f, -1.0 * height, 0.0f);
+  z_camera = 0.5 * graphene_matrix_get_value (&projection_matrix, 0, 0);
+
+  graphene_matrix_init_translate (&mv_matrix,
+                                  &GRAPHENE_POINT3D_INIT (0.0f,
+                                                          -1.0 * height,
+                                                          0.0f));
+  graphene_matrix_scale (&mv_matrix, 1.0f / width, -1.0f / height, 1.0f / width);
+  graphene_matrix_translate (&mv_matrix,
+                             &GRAPHENE_POINT3D_INIT (-0.5f, -0.5f, -z_camera));
   cogl_framebuffer_set_modelview_matrix (framebuffer, &mv_matrix);
 }
 
diff --git a/src/tests/clutter/interactive/test-cogl-point-sprites.c 
b/src/tests/clutter/interactive/test-cogl-point-sprites.c
index 8a3604edfa..681fdb71f7 100644
--- a/src/tests/clutter/interactive/test-cogl-point-sprites.c
+++ b/src/tests/clutter/interactive/test-cogl-point-sprites.c
@@ -109,7 +109,7 @@ paint_cb (ClutterActor        *stage,
 
   cogl_framebuffer_get_projection_matrix (framebuffer, &old_matrix);
   /* Use an orthogonal projection from -1 -> 1 in both axes */
-  cogl_matrix_init_identity (&new_matrix);
+  graphene_matrix_init_identity (&new_matrix);
   cogl_framebuffer_set_projection_matrix (framebuffer, &new_matrix);
 
   cogl_framebuffer_push_matrix (framebuffer);


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