From 77352c2d3ae333dbd0561be9e58696747e8bd5c7 Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Fri, 11 Sep 2020 19:46:48 -0300 Subject: [PATCH] tests: Use graphene APIs https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439 --- src/tests/clutter/conform/actor-pivot-point.c | 5 ++- .../interactive/test-cogl-multitexture.c | 36 ++++++++++--------- .../clutter/interactive/test-cogl-offscreen.c | 13 ++++--- .../interactive/test-cogl-point-sprites.c | 2 +- 4 files changed, 31 insertions(+), 25 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); + 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); - 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); + 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)); - 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_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); + z_camera = 0.5 * graphene_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); + 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);