[mutter/gbsneto/graphene-matrix] cogl/matrix-stack: Use graphene APIs
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/gbsneto/graphene-matrix] cogl/matrix-stack: Use graphene APIs
- Date: Fri, 11 Sep 2020 23:04:25 +0000 (UTC)
commit fb99de7bd64c32f125c28e3abf2b63aee4cdb251
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Fri Sep 11 18:32:25 2020 -0300
cogl/matrix-stack: Use graphene APIs
Nothing new under the sun.
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
cogl/cogl/cogl-matrix-stack.c | 57 +++++++++++++++++--------------------------
1 file changed, 23 insertions(+), 34 deletions(-)
---
diff --git a/cogl/cogl/cogl-matrix-stack.c b/cogl/cogl/cogl-matrix-stack.c
index 9a308ea7bf..87efb6c405 100644
--- a/cogl/cogl/cogl-matrix-stack.c
+++ b/cogl/cogl/cogl-matrix-stack.c
@@ -238,10 +238,10 @@ cogl_matrix_stack_frustum (CoglMatrixStack *stack,
_cogl_matrix_stack_push_replacement_entry (stack,
COGL_MATRIX_OP_LOAD);
- cogl_matrix_init_identity (&entry->matrix);
- cogl_matrix_frustum (&entry->matrix,
- left, right, bottom, top,
- z_near, z_far);
+ graphene_matrix_init_frustum (&entry->matrix,
+ left, right,
+ bottom, top,
+ z_near, z_far);
}
void
@@ -256,9 +256,9 @@ cogl_matrix_stack_perspective (CoglMatrixStack *stack,
entry =
_cogl_matrix_stack_push_replacement_entry (stack,
COGL_MATRIX_OP_LOAD);
- cogl_matrix_init_identity (&entry->matrix);
- cogl_matrix_perspective (&entry->matrix,
- fov_y, aspect, z_near, z_far);
+ graphene_matrix_init_perspective (&entry->matrix,
+ fov_y, aspect,
+ z_near, z_far);
}
void
@@ -275,9 +275,10 @@ cogl_matrix_stack_orthographic (CoglMatrixStack *stack,
entry =
_cogl_matrix_stack_push_replacement_entry (stack,
COGL_MATRIX_OP_LOAD);
- cogl_matrix_init_identity (&entry->matrix);
- cogl_matrix_orthographic (&entry->matrix,
- x_1, y_1, x_2, y_2, near, far);
+ graphene_matrix_init_ortho (&entry->matrix,
+ x_1, x_2,
+ y_2, y_1,
+ near, far);
}
void
@@ -384,13 +385,12 @@ cogl_matrix_entry_get (CoglMatrixEntry *entry,
switch (current->op)
{
case COGL_MATRIX_OP_LOAD_IDENTITY:
- cogl_matrix_init_identity (matrix);
+ graphene_matrix_init_identity (matrix);
goto initialized;
case COGL_MATRIX_OP_LOAD:
{
CoglMatrixEntryLoad *load = (CoglMatrixEntryLoad *)current;
- _cogl_matrix_init_from_matrix_without_inverse (matrix,
- &load->matrix);
+ graphene_matrix_init_from_matrix (matrix, &load->matrix);
goto initialized;
}
case COGL_MATRIX_OP_SAVE:
@@ -401,7 +401,7 @@ cogl_matrix_entry_get (CoglMatrixEntry *entry,
cogl_matrix_entry_get (current->parent, &save->cache);
save->cache_valid = TRUE;
}
- _cogl_matrix_init_from_matrix_without_inverse (matrix, &save->cache);
+ graphene_matrix_init_from_matrix (matrix, &save->cache);
goto initialized;
}
default:
@@ -478,46 +478,35 @@ initialized:
{
CoglMatrixEntryTranslate *translate =
(CoglMatrixEntryTranslate *)children[i];
- cogl_matrix_translate (matrix,
- translate->translate.x,
- translate->translate.y,
- translate->translate.z);
+ graphene_matrix_translate (matrix, &translate->translate);
continue;
}
case COGL_MATRIX_OP_ROTATE:
{
CoglMatrixEntryRotate *rotate=
(CoglMatrixEntryRotate *)children[i];
- cogl_matrix_rotate (matrix,
- rotate->angle,
- graphene_vec3_get_x (&rotate->axis),
- graphene_vec3_get_y (&rotate->axis),
- graphene_vec3_get_z (&rotate->axis));
+ graphene_matrix_rotate (matrix, rotate->angle, &rotate->axis);
continue;
}
case COGL_MATRIX_OP_ROTATE_EULER:
{
CoglMatrixEntryRotateEuler *rotate =
(CoglMatrixEntryRotateEuler *)children[i];
- cogl_matrix_rotate_euler (matrix,
- &rotate->euler);
+ graphene_matrix_rotate_euler (matrix, &rotate->euler);
continue;
}
case COGL_MATRIX_OP_SCALE:
{
CoglMatrixEntryScale *scale =
(CoglMatrixEntryScale *)children[i];
- cogl_matrix_scale (matrix,
- scale->x,
- scale->y,
- scale->z);
+ graphene_matrix_scale (matrix, scale->x, scale->y, scale->z);
continue;
}
case COGL_MATRIX_OP_MULTIPLY:
{
CoglMatrixEntryMultiply *multiply =
(CoglMatrixEntryMultiply *)children[i];
- cogl_matrix_multiply (matrix, matrix, &multiply->matrix);
+ graphene_matrix_multiply (&multiply->matrix, matrix, matrix);
continue;
}
@@ -793,7 +782,7 @@ cogl_matrix_entry_equal (CoglMatrixEntry *entry0,
{
CoglMatrixEntryMultiply *mult0 = (CoglMatrixEntryMultiply *)entry0;
CoglMatrixEntryMultiply *mult1 = (CoglMatrixEntryMultiply *)entry1;
- if (!cogl_matrix_equal (&mult0->matrix, &mult1->matrix))
+ if (!graphene_matrix_equal (&mult0->matrix, &mult1->matrix))
return FALSE;
}
break;
@@ -804,7 +793,7 @@ cogl_matrix_entry_equal (CoglMatrixEntry *entry0,
/* There's no need to check any further since an
* _OP_LOAD makes all the ancestors redundant as far as
* the final matrix value is concerned. */
- return cogl_matrix_equal (&load0->matrix, &load1->matrix);
+ return graphene_matrix_equal (&load0->matrix, &load1->matrix);
}
case COGL_MATRIX_OP_SAVE:
/* We skip over saves above so we shouldn't see save entries */
@@ -890,14 +879,14 @@ cogl_debug_matrix_entry_print (CoglMatrixEntry *entry)
{
CoglMatrixEntryMultiply *mult = (CoglMatrixEntryMultiply *)entry;
g_print (" MULT:\n");
- _cogl_matrix_prefix_print (" ", &mult->matrix);
+ graphene_matrix_print (&mult->matrix);
continue;
}
case COGL_MATRIX_OP_LOAD:
{
CoglMatrixEntryLoad *load = (CoglMatrixEntryLoad *)entry;
g_print (" LOAD:\n");
- _cogl_matrix_prefix_print (" ", &load->matrix);
+ graphene_matrix_print (&load->matrix);
continue;
}
case COGL_MATRIX_OP_SAVE:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]