summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>2020-09-11 19:46:48 -0300
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>2020-10-06 15:34:48 +0000
commit77352c2d3ae333dbd0561be9e58696747e8bd5c7 (patch)
treeea4381ab25520d5247891ba4ed12e19a29feff4f
parent090973e538e4e0586300143d95d3c036e4995a8c (diff)
downloadmutter-77352c2d3ae333dbd0561be9e58696747e8bd5c7.tar.gz
tests: Use graphene APIs
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
-rw-r--r--src/tests/clutter/conform/actor-pivot-point.c5
-rw-r--r--src/tests/clutter/interactive/test-cogl-multitexture.c40
-rw-r--r--src/tests/clutter/interactive/test-cogl-offscreen.c15
-rw-r--r--src/tests/clutter/interactive/test-cogl-point-sprites.c2
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 5213e69e9..f16d18dea 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 93e2d5d5b..f14f0b7d8 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 de77745e9..5d8089944 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 8a3604edf..681fdb71f 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);