cogl/matrix: Remove custom boxed type

Given that CoglMatrix is simply a typedef to graphene_matrix_t, we can
remove all the GType machinery and reuse Graphene's.

Also remove the clutter-cogl helper, and cogl_matrix_to_graphene_matrix()
which is now unused.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
This commit is contained in:
Georges Basile Stavracas Neto 2020-09-11 14:53:32 -03:00
parent 5b8c0dca68
commit 050053a114
7 changed files with 2 additions and 150 deletions

View File

@ -6908,7 +6908,7 @@ clutter_actor_class_init (ClutterActorClass *klass)
g_param_spec_boxed ("transform", g_param_spec_boxed ("transform",
P_("Transform"), P_("Transform"),
P_("Transformation matrix"), P_("Transformation matrix"),
COGL_GTYPE_TYPE_MATRIX, GRAPHENE_TYPE_MATRIX,
G_PARAM_READWRITE | G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS | G_PARAM_STATIC_STRINGS |
CLUTTER_PARAM_ANIMATABLE); CLUTTER_PARAM_ANIMATABLE);
@ -6946,7 +6946,7 @@ clutter_actor_class_init (ClutterActorClass *klass)
g_param_spec_boxed ("child-transform", g_param_spec_boxed ("child-transform",
P_("Child Transform"), P_("Child Transform"),
P_("Children transformation matrix"), P_("Children transformation matrix"),
COGL_GTYPE_TYPE_MATRIX, GRAPHENE_TYPE_MATRIX,
G_PARAM_READWRITE | G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS | G_PARAM_STATIC_STRINGS |
CLUTTER_PARAM_ANIMATABLE); CLUTTER_PARAM_ANIMATABLE);

View File

@ -1,62 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Georges Basile Stavracas Neto <georges.stavracas@gmail.com>
*
* Copyright (C) 2009, 2010 Intel Corp
* Copyright (C) 2020 Endless OS Foundation LLC
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "clutter-build-config.h"
#include "clutter-cogl.h"
#include "clutter-private.h"
#include "clutter-types.h"
static gboolean
cogl_matrix_progress (const GValue *a,
const GValue *b,
gdouble progress,
GValue *retval)
{
const CoglMatrix *matrix1 = g_value_get_boxed (a);
const CoglMatrix *matrix2 = g_value_get_boxed (b);
graphene_matrix_t interpolated;
CoglMatrix res;
float v[16];
graphene_matrix_interpolate (cogl_matrix_get_graphene_matrix (matrix1),
cogl_matrix_get_graphene_matrix (matrix2),
progress,
&interpolated);
graphene_matrix_to_float (&interpolated, v);
cogl_matrix_init_from_array (&res, v);
g_value_set_boxed (retval, &res);
return TRUE;
}
void
clutter_cogl_init (void)
{
clutter_interval_register_progress_func (COGL_GTYPE_TYPE_MATRIX,
cogl_matrix_progress);
}

View File

@ -1,30 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Georges Basile Stavracas Neto <georges.stavracas@gmail.com>
*
* Copyright (C) 2009, 2010 Intel Corp
* Copyright (C) 2020 Endless OS Foundation LLC
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CLUTTER_COGL_H
#define CLUTTER_COGL_H
void clutter_cogl_init (void);
#endif

View File

@ -53,7 +53,6 @@
#include "clutter-actor-private.h" #include "clutter-actor-private.h"
#include "clutter-backend-private.h" #include "clutter-backend-private.h"
#include "clutter-cogl.h"
#include "clutter-config.h" #include "clutter-config.h"
#include "clutter-debug.h" #include "clutter-debug.h"
#include "clutter-event-private.h" #include "clutter-event-private.h"
@ -2021,7 +2020,6 @@ clutter_base_init (void)
g_type_init (); g_type_init ();
#endif #endif
clutter_cogl_init ();
clutter_graphene_init (); clutter_graphene_init ();
} }
} }

View File

@ -109,7 +109,6 @@ clutter_sources = [
'clutter-child-meta.c', 'clutter-child-meta.c',
'clutter-click-action.c', 'clutter-click-action.c',
'clutter-clone.c', 'clutter-clone.c',
'clutter-cogl.c',
'clutter-color.c', 'clutter-color.c',
'clutter-colorize-effect.c', 'clutter-colorize-effect.c',
'clutter-constraint.c', 'clutter-constraint.c',
@ -184,7 +183,6 @@ clutter_private_headers = [
'clutter-actor-private.h', 'clutter-actor-private.h',
'clutter-backend-private.h', 'clutter-backend-private.h',
'clutter-bezier.h', 'clutter-bezier.h',
'clutter-cogl.h',
'clutter-constraint-private.h', 'clutter-constraint-private.h',
'clutter-content-private.h', 'clutter-content-private.h',
'clutter-damage-history.h', 'clutter-damage-history.h',

View File

@ -42,11 +42,6 @@
#include <math.h> #include <math.h>
#include <string.h> #include <string.h>
#include <cogl-gtype-private.h>
COGL_GTYPE_DEFINE_BOXED (Matrix, matrix,
cogl_matrix_copy,
cogl_matrix_free);
void void
cogl_matrix_multiply (CoglMatrix *result, cogl_matrix_multiply (CoglMatrix *result,
const CoglMatrix *a, const CoglMatrix *a,
@ -692,12 +687,6 @@ cogl_matrix_transpose (CoglMatrix *matrix)
graphene_matrix_transpose (matrix, matrix); graphene_matrix_transpose (matrix, matrix);
} }
GType
cogl_gtype_matrix_get_type (void)
{
return cogl_matrix_get_gtype ();
}
void void
cogl_matrix_skew_xy (CoglMatrix *matrix, cogl_matrix_skew_xy (CoglMatrix *matrix,
float factor) float factor)
@ -736,9 +725,3 @@ cogl_matrix_skew_yz (CoglMatrix *matrix,
_COGL_MATRIX_DEBUG_PRINT (matrix); _COGL_MATRIX_DEBUG_PRINT (matrix);
} }
const graphene_matrix_t *
cogl_matrix_get_graphene_matrix (const CoglMatrix *matrix)
{
return matrix;
}

View File

@ -673,29 +673,6 @@ cogl_matrix_transpose (CoglMatrix *matrix);
COGL_EXPORT void COGL_EXPORT void
cogl_debug_matrix_print (const CoglMatrix *matrix); cogl_debug_matrix_print (const CoglMatrix *matrix);
#define COGL_GTYPE_TYPE_MATRIX (cogl_matrix_get_gtype ())
/**
* cogl_matrix_get_gtype:
*
* Returns: a #GType that can be used with the GLib type system.
*/
COGL_EXPORT
GType cogl_matrix_get_gtype (void);
/**
* cogl_gtype_matrix_get_type:
*
* Returns: the GType for the registered "CoglMatrix" boxed type. This
* can be used for example to define GObject properties that accept a
* #CoglMatrix value.
*
* Deprecated: 1.18: Use cogl_matrix_get_gtype() instead.
*/
COGL_EXPORT GType
cogl_gtype_matrix_get_type (void);
/** /**
* cogl_matrix_determinant: * cogl_matrix_determinant:
* @matrix: a #CoglMatrix * @matrix: a #CoglMatrix
@ -740,18 +717,6 @@ COGL_EXPORT void
cogl_matrix_skew_yz (CoglMatrix *matrix, cogl_matrix_skew_yz (CoglMatrix *matrix,
float factor); float factor);
/**
* cogl_matrix_get_graphene_matrix:
* @matrix: a #CoglMatrix
*
* Retrieves the internal #graphene_matrix_t of @matrix. It should not
* be modified, and must be considered read-only.
*
* Returns: (transfer none): a #graphene_matrix_t
*/
COGL_EXPORT const graphene_matrix_t *
cogl_matrix_get_graphene_matrix (const CoglMatrix *matrix);
G_END_DECLS G_END_DECLS
#endif /* __COGL_MATRIX_H */ #endif /* __COGL_MATRIX_H */