[mutter/gbsneto/graphene-matrix: 2/42] cogl/matrix: Remove matrix type




commit 2c51e9a2aa379530e93b3e80fa9b68d35cab3e6b
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Thu Sep 10 15:24:10 2020 -0300

    cogl/matrix: Remove matrix type
    
    We can remove it since the most important type (identity) is now
    detected through a simple graphene check.
    
    https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439

 cogl/cogl/cogl-matrix.c | 43 -------------------------------------------
 cogl/cogl/cogl-matrix.h |  3 +--
 2 files changed, 1 insertion(+), 45 deletions(-)
---
diff --git a/cogl/cogl/cogl-matrix.c b/cogl/cogl/cogl-matrix.c
index 64d6bbb0e0..0e41a33bdf 100644
--- a/cogl/cogl/cogl-matrix.c
+++ b/cogl/cogl/cogl-matrix.c
@@ -97,21 +97,6 @@ COGL_GTYPE_DEFINE_BOXED (Matrix, matrix,
 #define MAT_TY 13
 #define MAT_TZ 14
 
-/*
- * These identify different kinds of 4x4 transformation matrices and we use
- * this information to find fast-paths when available.
- */
-enum CoglMatrixType {
-   COGL_MATRIX_TYPE_GENERAL,   /**< general 4x4 matrix */
-   COGL_MATRIX_TYPE_IDENTITY,  /**< identity matrix */
-   COGL_MATRIX_TYPE_3D_NO_ROT, /**< orthogonal projection and others... */
-   COGL_MATRIX_TYPE_PERSPECTIVE,       /**< perspective projection matrix */
-   COGL_MATRIX_TYPE_2D,                /**< 2-D transformation */
-   COGL_MATRIX_TYPE_2D_NO_ROT, /**< 2-D scale & translate only */
-   COGL_MATRIX_TYPE_3D,                /**< 3-D transformation */
-   COGL_MATRIX_N_TYPES
-} ;
-
 #define LEN_SQUARED_3FV( V ) ((V)[0]*(V)[0]+(V)[1]*(V)[1]+(V)[2]*(V)[2])
 
 /*
@@ -169,21 +154,6 @@ enum CoglMatrixType {
                            MAT_DIRTY_INVERSE)
 
 
-
-/*
- * Names of the corresponding CoglMatrixType values.
- */
-static const char *types[] = {
-   "COGL_MATRIX_TYPE_GENERAL",
-   "COGL_MATRIX_TYPE_IDENTITY",
-   "COGL_MATRIX_TYPE_3D_NO_ROT",
-   "COGL_MATRIX_TYPE_PERSPECTIVE",
-   "COGL_MATRIX_TYPE_2D",
-   "COGL_MATRIX_TYPE_2D_NO_ROT",
-   "COGL_MATRIX_TYPE_3D"
-};
-
-
 /*
  * Identity matrix.
  */
@@ -246,16 +216,6 @@ print_matrix_floats (const char *prefix, const float m[16])
 void
 _cogl_matrix_prefix_print (const char *prefix, const CoglMatrix *matrix)
 {
-  if (!(matrix->flags & MAT_DIRTY_TYPE))
-    {
-      g_return_if_fail (matrix->type < COGL_MATRIX_N_TYPES);
-      g_print ("%sMatrix type: %s, flags: %x\n",
-               prefix, types[matrix->type], (int)matrix->flags);
-    }
-  else
-    g_print ("%sMatrix type: DIRTY, flags: %x\n",
-             prefix, (int)matrix->flags);
-
   print_matrix_floats (prefix, (float *)matrix);
   g_print ("%sInverse: \n", prefix);
   if (!(matrix->flags & MAT_DIRTY_INVERSE))
@@ -513,7 +473,6 @@ _cogl_matrix_init_identity (CoglMatrix *matrix)
 {
   memcpy (matrix, identity, 16 * sizeof (float));
 
-  matrix->type = COGL_MATRIX_TYPE_IDENTITY;
   matrix->flags = MAT_DIRTY_INVERSE;
 }
 
@@ -535,7 +494,6 @@ cogl_matrix_init_translation (CoglMatrix *matrix,
   graphene_matrix_init_translate (&m, &GRAPHENE_POINT3D_INIT (tx, ty, tz));
   graphene_matrix_to_cogl_matrix (&m, matrix);
 
-  matrix->type = COGL_MATRIX_TYPE_3D;
   matrix->flags = MAT_FLAG_TRANSLATION | MAT_DIRTY_INVERSE;
 
   _COGL_MATRIX_DEBUG_PRINT (matrix);
@@ -577,7 +535,6 @@ _cogl_matrix_init_from_matrix_without_inverse (CoglMatrix *matrix,
                                                const CoglMatrix *src)
 {
   memcpy (matrix, src, 16 * sizeof (float));
-  matrix->type = src->type;
   matrix->flags = src->flags | MAT_DIRTY_INVERSE;
 }
 
diff --git a/cogl/cogl/cogl-matrix.h b/cogl/cogl/cogl-matrix.h
index b2e03f55b0..120d9a7365 100644
--- a/cogl/cogl/cogl-matrix.h
+++ b/cogl/cogl/cogl-matrix.h
@@ -115,11 +115,10 @@ struct _CoglMatrix
   /* Note: we may want to extend this later with private flags
    * and a cache of the inverse transform matrix. */
   float          COGL_PRIVATE (inv)[16];
-  unsigned long  COGL_PRIVATE (type);
   unsigned long  COGL_PRIVATE (flags);
   unsigned long  COGL_PRIVATE (_padding3);
 };
-COGL_STRUCT_SIZE_ASSERT (CoglMatrix, 128 + sizeof (unsigned long) * 3);
+COGL_STRUCT_SIZE_ASSERT (CoglMatrix, 128 + sizeof (unsigned long) * 2);
 
 #define COGL_MATRIX_INIT_IDENTITY (CoglMatrix) { \
   1.0f, 0.0f, 0.0f, 0.0f, \


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