Remove ClutterMatrix

Good bye. You won't be missed.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
This commit is contained in:
Georges Basile Stavracas Neto 2020-09-08 21:14:39 -03:00
parent eee2e331fd
commit dc9c1f8983
10 changed files with 71 additions and 287 deletions

View File

@ -1069,9 +1069,9 @@ static inline void clutter_actor_set_margin_internal (ClutterActor *self,
GParamSpec *pspec); GParamSpec *pspec);
static void clutter_actor_set_transform_internal (ClutterActor *self, static void clutter_actor_set_transform_internal (ClutterActor *self,
const ClutterMatrix *transform); const CoglMatrix *transform);
static void clutter_actor_set_child_transform_internal (ClutterActor *self, static void clutter_actor_set_child_transform_internal (ClutterActor *self,
const ClutterMatrix *transform); const CoglMatrix *transform);
static void clutter_actor_realize_internal (ClutterActor *self); static void clutter_actor_realize_internal (ClutterActor *self);
static void clutter_actor_unrealize_internal (ClutterActor *self); static void clutter_actor_unrealize_internal (ClutterActor *self);
@ -3054,7 +3054,7 @@ clutter_actor_get_abs_allocation_vertices (ClutterActor *self,
static void static void
clutter_actor_real_apply_transform (ClutterActor *self, clutter_actor_real_apply_transform (ClutterActor *self,
ClutterMatrix *matrix) CoglMatrix *matrix)
{ {
ClutterActorPrivate *priv = self->priv; ClutterActorPrivate *priv = self->priv;
const ClutterTransformInfo *info; const ClutterTransformInfo *info;
@ -3085,10 +3085,10 @@ clutter_actor_real_apply_transform (ClutterActor *self,
const ClutterTransformInfo *parent_info; const ClutterTransformInfo *parent_info;
parent_info = _clutter_actor_get_transform_info_or_defaults (priv->parent); parent_info = _clutter_actor_get_transform_info_or_defaults (priv->parent);
clutter_matrix_init_from_matrix (matrix, &(parent_info->child_transform)); cogl_matrix_init_from_matrix (matrix, &(parent_info->child_transform));
} }
else else
clutter_matrix_init_identity (matrix); cogl_matrix_init_identity (matrix);
/* if we have an overriding transformation, we use that, and get out */ /* if we have an overriding transformation, we use that, and get out */
if (info->transform_set) if (info->transform_set)
@ -3147,7 +3147,7 @@ roll_back_pivot:
* matrix. */ * matrix. */
void void
_clutter_actor_apply_modelview_transform (ClutterActor *self, _clutter_actor_apply_modelview_transform (ClutterActor *self,
ClutterMatrix *matrix) CoglMatrix *matrix)
{ {
ClutterActorPrivate *priv = self->priv; ClutterActorPrivate *priv = self->priv;
@ -3167,7 +3167,7 @@ out:
* @self: The actor whose coordinate space you want to transform from. * @self: The actor whose coordinate space you want to transform from.
* @ancestor: The ancestor actor whose coordinate space you want to transform too * @ancestor: The ancestor actor whose coordinate space you want to transform too
* or %NULL if you want to transform all the way to eye coordinates. * or %NULL if you want to transform all the way to eye coordinates.
* @matrix: A #ClutterMatrix to apply the transformation too. * @matrix: A #CoglMatrix to apply the transformation too.
* *
* This multiplies a transform with @matrix that will transform coordinates * This multiplies a transform with @matrix that will transform coordinates
* from the coordinate space of @self into the coordinate space of @ancestor. * from the coordinate space of @self into the coordinate space of @ancestor.
@ -4432,9 +4432,9 @@ static const ClutterTransformInfo default_transform_info = {
GRAPHENE_POINT_INIT_ZERO, /* pivot */ GRAPHENE_POINT_INIT_ZERO, /* pivot */
0.f, /* pivot-z */ 0.f, /* pivot-z */
CLUTTER_MATRIX_INIT_IDENTITY, COGL_MATRIX_INIT_IDENTITY,
FALSE, /* transform */ FALSE, /* transform */
CLUTTER_MATRIX_INIT_IDENTITY, COGL_MATRIX_INIT_IDENTITY,
FALSE, /* child-transform */ FALSE, /* child-transform */
}; };
@ -5456,7 +5456,7 @@ clutter_actor_get_property (GObject *object,
case PROP_TRANSFORM: case PROP_TRANSFORM:
{ {
ClutterMatrix m; CoglMatrix m;
clutter_actor_get_transform (actor, &m); clutter_actor_get_transform (actor, &m);
g_value_set_boxed (value, &m); g_value_set_boxed (value, &m);
@ -5474,7 +5474,7 @@ clutter_actor_get_property (GObject *object,
case PROP_CHILD_TRANSFORM: case PROP_CHILD_TRANSFORM:
{ {
ClutterMatrix m; CoglMatrix m;
clutter_actor_get_child_transform (actor, &m); clutter_actor_get_child_transform (actor, &m);
g_value_set_boxed (value, &m); g_value_set_boxed (value, &m);
@ -6865,7 +6865,7 @@ clutter_actor_class_init (ClutterActorClass *klass)
* *
* Application code should rarely need to use this function directly. * Application code should rarely need to use this function directly.
* *
* Setting this property with a #ClutterMatrix will set the * Setting this property with a #CoglMatrix will set the
* #ClutterActor:transform-set property to %TRUE as a side effect; * #ClutterActor:transform-set property to %TRUE as a side effect;
* setting this property with %NULL will set the * setting this property with %NULL will set the
* #ClutterActor:transform-set property to %FALSE. * #ClutterActor:transform-set property to %FALSE.
@ -6878,7 +6878,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"),
CLUTTER_TYPE_MATRIX, COGL_GTYPE_TYPE_MATRIX,
G_PARAM_READWRITE | G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS | G_PARAM_STATIC_STRINGS |
CLUTTER_PARAM_ANIMATABLE); CLUTTER_PARAM_ANIMATABLE);
@ -6903,7 +6903,7 @@ clutter_actor_class_init (ClutterActorClass *klass)
* *
* Applies a transformation matrix on each child of an actor. * Applies a transformation matrix on each child of an actor.
* *
* Setting this property with a #ClutterMatrix will set the * Setting this property with a #CoglMatrix will set the
* #ClutterActor:child-transform-set property to %TRUE as a side effect; * #ClutterActor:child-transform-set property to %TRUE as a side effect;
* setting this property with %NULL will set the * setting this property with %NULL will set the
* #ClutterActor:child-transform-set property to %FALSE. * #ClutterActor:child-transform-set property to %FALSE.
@ -6916,7 +6916,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"),
CLUTTER_TYPE_MATRIX, COGL_GTYPE_TYPE_MATRIX,
G_PARAM_READWRITE | G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS | G_PARAM_STATIC_STRINGS |
CLUTTER_PARAM_ANIMATABLE); CLUTTER_PARAM_ANIMATABLE);
@ -14773,7 +14773,7 @@ clutter_actor_unset_flags (ClutterActor *self,
static void static void
clutter_actor_set_transform_internal (ClutterActor *self, clutter_actor_set_transform_internal (ClutterActor *self,
const ClutterMatrix *transform) const CoglMatrix *transform)
{ {
ClutterTransformInfo *info; ClutterTransformInfo *info;
gboolean was_set; gboolean was_set;
@ -14801,7 +14801,7 @@ clutter_actor_set_transform_internal (ClutterActor *self,
/** /**
* clutter_actor_set_transform: * clutter_actor_set_transform:
* @self: a #ClutterActor * @self: a #ClutterActor
* @transform: (allow-none): a #ClutterMatrix, or %NULL to * @transform: (allow-none): a #CoglMatrix, or %NULL to
* unset a custom transformation * unset a custom transformation
* *
* Overrides the transformations of a #ClutterActor with a custom * Overrides the transformations of a #ClutterActor with a custom
@ -14814,19 +14814,19 @@ clutter_actor_set_transform_internal (ClutterActor *self,
*/ */
void void
clutter_actor_set_transform (ClutterActor *self, clutter_actor_set_transform (ClutterActor *self,
const ClutterMatrix *transform) const CoglMatrix *transform)
{ {
const ClutterTransformInfo *info; const ClutterTransformInfo *info;
ClutterMatrix new_transform; CoglMatrix new_transform;
g_return_if_fail (CLUTTER_IS_ACTOR (self)); g_return_if_fail (CLUTTER_IS_ACTOR (self));
info = _clutter_actor_get_transform_info_or_defaults (self); info = _clutter_actor_get_transform_info_or_defaults (self);
if (transform != NULL) if (transform != NULL)
clutter_matrix_init_from_matrix (&new_transform, transform); cogl_matrix_init_from_matrix (&new_transform, transform);
else else
clutter_matrix_init_identity (&new_transform); cogl_matrix_init_identity (&new_transform);
_clutter_actor_create_transition (self, obj_props[PROP_TRANSFORM], _clutter_actor_create_transition (self, obj_props[PROP_TRANSFORM],
&info->transform, &info->transform,
@ -14836,7 +14836,7 @@ clutter_actor_set_transform (ClutterActor *self,
/** /**
* clutter_actor_get_transform: * clutter_actor_get_transform:
* @self: a #ClutterActor * @self: a #ClutterActor
* @transform: (out caller-allocates): a #ClutterMatrix * @transform: (out caller-allocates): a #CoglMatrix
* *
* Retrieves the current transformation matrix of a #ClutterActor. * Retrieves the current transformation matrix of a #ClutterActor.
* *
@ -14844,7 +14844,7 @@ clutter_actor_set_transform (ClutterActor *self,
*/ */
void void
clutter_actor_get_transform (ClutterActor *self, clutter_actor_get_transform (ClutterActor *self,
ClutterMatrix *transform) CoglMatrix *transform)
{ {
g_return_if_fail (CLUTTER_IS_ACTOR (self)); g_return_if_fail (CLUTTER_IS_ACTOR (self));
g_return_if_fail (transform != NULL); g_return_if_fail (transform != NULL);
@ -19384,7 +19384,7 @@ done:
static void static void
clutter_actor_set_child_transform_internal (ClutterActor *self, clutter_actor_set_child_transform_internal (ClutterActor *self,
const ClutterMatrix *transform) const CoglMatrix *transform)
{ {
ClutterTransformInfo *info = _clutter_actor_get_transform_info (self); ClutterTransformInfo *info = _clutter_actor_get_transform_info (self);
ClutterActorIter iter; ClutterActorIter iter;
@ -19392,7 +19392,7 @@ clutter_actor_set_child_transform_internal (ClutterActor *self,
GObject *obj; GObject *obj;
gboolean was_set = info->child_transform_set; gboolean was_set = info->child_transform_set;
clutter_matrix_init_from_matrix (&info->child_transform, transform); cogl_matrix_init_from_matrix (&info->child_transform, transform);
/* if it's the identity matrix, we need to toggle the boolean flag */ /* if it's the identity matrix, we need to toggle the boolean flag */
info->child_transform_set = !cogl_matrix_is_identity (transform); info->child_transform_set = !cogl_matrix_is_identity (transform);
@ -19414,7 +19414,7 @@ clutter_actor_set_child_transform_internal (ClutterActor *self,
/** /**
* clutter_actor_set_child_transform: * clutter_actor_set_child_transform:
* @self: a #ClutterActor * @self: a #ClutterActor
* @transform: (allow-none): a #ClutterMatrix, or %NULL * @transform: (allow-none): a #CoglMatrix, or %NULL
* *
* Sets the transformation matrix to be applied to all the children * Sets the transformation matrix to be applied to all the children
* of @self prior to their own transformations. The default child * of @self prior to their own transformations. The default child
@ -19428,19 +19428,19 @@ clutter_actor_set_child_transform_internal (ClutterActor *self,
*/ */
void void
clutter_actor_set_child_transform (ClutterActor *self, clutter_actor_set_child_transform (ClutterActor *self,
const ClutterMatrix *transform) const CoglMatrix *transform)
{ {
const ClutterTransformInfo *info; const ClutterTransformInfo *info;
ClutterMatrix new_transform; CoglMatrix new_transform;
g_return_if_fail (CLUTTER_IS_ACTOR (self)); g_return_if_fail (CLUTTER_IS_ACTOR (self));
info = _clutter_actor_get_transform_info_or_defaults (self); info = _clutter_actor_get_transform_info_or_defaults (self);
if (transform != NULL) if (transform != NULL)
clutter_matrix_init_from_matrix (&new_transform, transform); cogl_matrix_init_from_matrix (&new_transform, transform);
else else
clutter_matrix_init_identity (&new_transform); cogl_matrix_init_identity (&new_transform);
_clutter_actor_create_transition (self, obj_props[PROP_CHILD_TRANSFORM], _clutter_actor_create_transition (self, obj_props[PROP_CHILD_TRANSFORM],
&info->child_transform, &info->child_transform,
@ -19450,7 +19450,7 @@ clutter_actor_set_child_transform (ClutterActor *self,
/** /**
* clutter_actor_get_child_transform: * clutter_actor_get_child_transform:
* @self: a #ClutterActor * @self: a #ClutterActor
* @transform: (out caller-allocates): a #ClutterMatrix * @transform: (out caller-allocates): a #CoglMatrix
* *
* Retrieves the child transformation matrix set using * Retrieves the child transformation matrix set using
* clutter_actor_set_child_transform(); if none is currently set, * clutter_actor_set_child_transform(); if none is currently set,
@ -19460,7 +19460,7 @@ clutter_actor_set_child_transform (ClutterActor *self,
*/ */
void void
clutter_actor_get_child_transform (ClutterActor *self, clutter_actor_get_child_transform (ClutterActor *self,
ClutterMatrix *transform) CoglMatrix *transform)
{ {
const ClutterTransformInfo *info; const ClutterTransformInfo *info;
@ -19470,9 +19470,9 @@ clutter_actor_get_child_transform (ClutterActor *self,
info = _clutter_actor_get_transform_info_or_defaults (self); info = _clutter_actor_get_transform_info_or_defaults (self);
if (info->child_transform_set) if (info->child_transform_set)
clutter_matrix_init_from_matrix (transform, &info->child_transform); cogl_matrix_init_from_matrix (transform, &info->child_transform);
else else
clutter_matrix_init_identity (transform); cogl_matrix_init_identity (transform);
} }
static void static void

View File

@ -257,7 +257,7 @@ struct _ClutterActorClass
/* transformations */ /* transformations */
void (* apply_transform) (ClutterActor *actor, void (* apply_transform) (ClutterActor *actor,
ClutterMatrix *matrix); CoglMatrix *matrix);
/* event signals */ /* event signals */
gboolean (* event) (ClutterActor *actor, gboolean (* event) (ClutterActor *actor,
@ -803,16 +803,16 @@ void clutter_actor_get_translation
gfloat *translate_z); gfloat *translate_z);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_actor_set_transform (ClutterActor *self, void clutter_actor_set_transform (ClutterActor *self,
const ClutterMatrix *transform); const CoglMatrix *transform);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_actor_get_transform (ClutterActor *self, void clutter_actor_get_transform (ClutterActor *self,
ClutterMatrix *transform); CoglMatrix *transform);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_actor_set_child_transform (ClutterActor *self, void clutter_actor_set_child_transform (ClutterActor *self,
const ClutterMatrix *transform); const CoglMatrix *transform);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_actor_get_child_transform (ClutterActor *self, void clutter_actor_get_child_transform (ClutterActor *self,
ClutterMatrix *transform); CoglMatrix *transform);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_actor_get_transformed_extents (ClutterActor *self, void clutter_actor_get_transformed_extents (ClutterActor *self,

View File

@ -83,7 +83,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterZoomAction, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterActorBox, clutter_actor_box_free) G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterActorBox, clutter_actor_box_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterColor, clutter_color_free) G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterColor, clutter_color_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterMargin, clutter_margin_free) G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterMargin, clutter_margin_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterMatrix, clutter_matrix_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPaintContext, clutter_paint_context_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPaintContext, clutter_paint_context_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPaintNode, clutter_paint_node_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPaintNode, clutter_paint_node_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPaintVolume, clutter_paint_volume_free) G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPaintVolume, clutter_paint_volume_free)

View File

@ -101,192 +101,3 @@ clutter_margin_free (ClutterMargin *margin_)
G_DEFINE_BOXED_TYPE (ClutterMargin, clutter_margin, G_DEFINE_BOXED_TYPE (ClutterMargin, clutter_margin,
clutter_margin_copy, clutter_margin_copy,
clutter_margin_free) clutter_margin_free)
/**
* ClutterMatrix:
*
* A type representing a 4x4 matrix.
*
* It is identicaly to #CoglMatrix.
*
* Since: 1.12
*/
static gpointer
clutter_matrix_copy (gpointer data)
{
return cogl_matrix_copy (data);
}
static gboolean
clutter_matrix_progress (const GValue *a,
const GValue *b,
gdouble progress,
GValue *retval)
{
const ClutterMatrix *matrix1 = g_value_get_boxed (a);
const ClutterMatrix *matrix2 = g_value_get_boxed (b);
graphene_point3d_t scale1 = GRAPHENE_POINT3D_INIT (1.f, 1.f, 1.f);
float shear1[3] = { 0.f, 0.f, 0.f };
graphene_point3d_t rotate1 = GRAPHENE_POINT3D_INIT_ZERO;
graphene_point3d_t translate1 = GRAPHENE_POINT3D_INIT_ZERO;
ClutterVertex4 perspective1 = { 0.f, 0.f, 0.f, 0.f };
graphene_point3d_t scale2 = GRAPHENE_POINT3D_INIT (1.f, 1.f, 1.f);
float shear2[3] = { 0.f, 0.f, 0.f };
graphene_point3d_t rotate2 = GRAPHENE_POINT3D_INIT_ZERO;
graphene_point3d_t translate2 = GRAPHENE_POINT3D_INIT_ZERO;
ClutterVertex4 perspective2 = { 0.f, 0.f, 0.f, 0.f };
graphene_point3d_t scale_res = GRAPHENE_POINT3D_INIT (1.f, 1.f, 1.f);
float shear_res = 0.f;
graphene_point3d_t rotate_res = GRAPHENE_POINT3D_INIT_ZERO;
graphene_point3d_t translate_res = GRAPHENE_POINT3D_INIT_ZERO;
ClutterVertex4 perspective_res = { 0.f, 0.f, 0.f, 0.f };
ClutterMatrix res;
clutter_matrix_init_identity (&res);
_clutter_util_matrix_decompose (matrix1,
&scale1, shear1, &rotate1, &translate1,
&perspective1);
_clutter_util_matrix_decompose (matrix2,
&scale2, shear2, &rotate2, &translate2,
&perspective2);
/* perspective */
_clutter_util_vertex4_interpolate (&perspective1, &perspective2, progress, &perspective_res);
res.wx = perspective_res.x;
res.wy = perspective_res.y;
res.wz = perspective_res.z;
res.ww = perspective_res.w;
/* translation */
graphene_point3d_interpolate (&translate1, &translate2, progress, &translate_res);
cogl_matrix_translate (&res, translate_res.x, translate_res.y, translate_res.z);
/* rotation */
graphene_point3d_interpolate (&rotate1, &rotate2, progress, &rotate_res);
cogl_matrix_rotate (&res, rotate_res.x, 1.0f, 0.0f, 0.0f);
cogl_matrix_rotate (&res, rotate_res.y, 0.0f, 1.0f, 0.0f);
cogl_matrix_rotate (&res, rotate_res.z, 0.0f, 0.0f, 1.0f);
/* skew */
shear_res = shear1[2] + (shear2[2] - shear1[2]) * progress; /* YZ */
if (shear_res != 0.f)
_clutter_util_matrix_skew_yz (&res, shear_res);
shear_res = shear1[1] + (shear2[1] - shear1[1]) * progress; /* XZ */
if (shear_res != 0.f)
_clutter_util_matrix_skew_xz (&res, shear_res);
shear_res = shear1[0] + (shear2[0] - shear1[0]) * progress; /* XY */
if (shear_res != 0.f)
_clutter_util_matrix_skew_xy (&res, shear_res);
/* scale */
graphene_point3d_interpolate (&scale1, &scale2, progress, &scale_res);
cogl_matrix_scale (&res, scale_res.x, scale_res.y, scale_res.z);
g_value_set_boxed (retval, &res);
return TRUE;
}
G_DEFINE_BOXED_TYPE_WITH_CODE (ClutterMatrix, clutter_matrix,
clutter_matrix_copy,
clutter_matrix_free,
CLUTTER_REGISTER_INTERVAL_PROGRESS (clutter_matrix_progress))
/**
* clutter_matrix_alloc:
*
* Allocates enough memory to hold a #ClutterMatrix.
*
* Return value: (transfer full): the newly allocated #ClutterMatrix
*
* Since: 1.12
*/
ClutterMatrix *
clutter_matrix_alloc (void)
{
return g_new0 (ClutterMatrix, 1);
}
/**
* clutter_matrix_free:
* @matrix: (allow-none): a #ClutterMatrix
*
* Frees the memory allocated by clutter_matrix_alloc().
*
* Since: 1.12
*/
void
clutter_matrix_free (ClutterMatrix *matrix)
{
cogl_matrix_free (matrix);
}
/**
* clutter_matrix_init_identity:
* @matrix: a #ClutterMatrix
*
* Initializes @matrix with the identity matrix, i.e.:
*
* |[
* .xx = 1.0, .xy = 0.0, .xz = 0.0, .xw = 0.0
* .yx = 0.0, .yy = 1.0, .yz = 0.0, .yw = 0.0
* .zx = 0.0, .zy = 0.0, .zz = 1.0, .zw = 0.0
* .wx = 0.0, .wy = 0.0, .wz = 0.0, .ww = 1.0
* ]|
*
* Return value: (transfer none): the initialized #ClutterMatrix
*
* Since: 1.12
*/
ClutterMatrix *
clutter_matrix_init_identity (ClutterMatrix *matrix)
{
cogl_matrix_init_identity (matrix);
return matrix;
}
/**
* clutter_matrix_init_from_array:
* @matrix: a #ClutterMatrix
* @values: (array fixed-size=16): a C array of 16 floating point values,
* representing a 4x4 matrix, with column-major order
*
* Initializes @matrix with the contents of a C array of floating point
* values.
*
* Return value: (transfer none): the initialized #ClutterMatrix
*
* Since: 1.12
*/
ClutterMatrix *
clutter_matrix_init_from_array (ClutterMatrix *matrix,
const float values[16])
{
cogl_matrix_init_from_array (matrix, values);
return matrix;
}
/**
* clutter_matrix_init_from_matrix:
* @a: the #ClutterMatrix to initialize
* @b: the #ClutterMatrix to copy
*
* Initializes the #ClutterMatrix @a with the contents of the
* #ClutterMatrix @b.
*
* Return value: (transfer none): the initialized #ClutterMatrix
*
* Since: 1.12
*/
ClutterMatrix *
clutter_matrix_init_from_matrix (ClutterMatrix *a,
const ClutterMatrix *b)
{
return memcpy (a, b, sizeof (ClutterMatrix));
}

View File

@ -354,7 +354,7 @@ clutter_pan_action_real_pan (ClutterPanAction *self,
gboolean is_interpolated) gboolean is_interpolated)
{ {
gfloat dx, dy; gfloat dx, dy;
ClutterMatrix transform; CoglMatrix transform;
clutter_pan_action_get_constrained_motion_delta (self, 0, &dx, &dy); clutter_pan_action_get_constrained_motion_delta (self, 0, &dx, &dy);

View File

@ -255,23 +255,16 @@ _clutter_util_vertex4_interpolate (const ClutterVertex4 *a,
double progress, double progress,
ClutterVertex4 *res); ClutterVertex4 *res);
#define CLUTTER_MATRIX_INIT_IDENTITY { \ float _clutter_util_matrix_determinant (const CoglMatrix *matrix);
1.0f, 0.0f, 0.0f, 0.0f, \
0.0f, 1.0f, 0.0f, 0.0f, \
0.0f, 0.0f, 1.0f, 0.0f, \
0.0f, 0.0f, 0.0f, 1.0f, \
}
float _clutter_util_matrix_determinant (const ClutterMatrix *matrix); void _clutter_util_matrix_skew_xy (CoglMatrix *matrix,
void _clutter_util_matrix_skew_xy (ClutterMatrix *matrix,
float factor); float factor);
void _clutter_util_matrix_skew_xz (ClutterMatrix *matrix, void _clutter_util_matrix_skew_xz (CoglMatrix *matrix,
float factor); float factor);
void _clutter_util_matrix_skew_yz (ClutterMatrix *matrix, void _clutter_util_matrix_skew_yz (CoglMatrix *matrix,
float factor); float factor);
gboolean _clutter_util_matrix_decompose (const ClutterMatrix *src, gboolean _clutter_util_matrix_decompose (const CoglMatrix *src,
graphene_point3d_t *scale_p, graphene_point3d_t *scale_p,
float shear_p[3], float shear_p[3],
graphene_point3d_t *rotate_p, graphene_point3d_t *rotate_p,

View File

@ -99,7 +99,7 @@ clutter_scroll_actor_set_scroll_to_internal (ClutterScrollActor *self,
{ {
ClutterScrollActorPrivate *priv = self->priv; ClutterScrollActorPrivate *priv = self->priv;
ClutterActor *actor = CLUTTER_ACTOR (self); ClutterActor *actor = CLUTTER_ACTOR (self);
ClutterMatrix m = CLUTTER_MATRIX_INIT_IDENTITY; CoglMatrix m = COGL_MATRIX_INIT_IDENTITY;
float dx, dy; float dx, dy;
if (graphene_point_equal (&priv->scroll_to, point)) if (graphene_point_equal (&priv->scroll_to, point))

View File

@ -40,7 +40,6 @@ G_BEGIN_DECLS
#define CLUTTER_TYPE_ACTOR_BOX (clutter_actor_box_get_type ()) #define CLUTTER_TYPE_ACTOR_BOX (clutter_actor_box_get_type ())
#define CLUTTER_TYPE_KNOT (clutter_knot_get_type ()) #define CLUTTER_TYPE_KNOT (clutter_knot_get_type ())
#define CLUTTER_TYPE_MARGIN (clutter_margin_get_type ()) #define CLUTTER_TYPE_MARGIN (clutter_margin_get_type ())
#define CLUTTER_TYPE_MATRIX (clutter_matrix_get_type ())
#define CLUTTER_TYPE_PAINT_VOLUME (clutter_paint_volume_get_type ()) #define CLUTTER_TYPE_PAINT_VOLUME (clutter_paint_volume_get_type ())
#define CLUTTER_TYPE_PERSPECTIVE (clutter_perspective_get_type ()) #define CLUTTER_TYPE_PERSPECTIVE (clutter_perspective_get_type ())
@ -87,8 +86,6 @@ typedef struct _ClutterVirtualInputDevice ClutterVirtualInputDevice;
typedef struct _ClutterInputMethod ClutterInputMethod; typedef struct _ClutterInputMethod ClutterInputMethod;
typedef struct _ClutterInputFocus ClutterInputFocus; typedef struct _ClutterInputFocus ClutterInputFocus;
typedef CoglMatrix ClutterMatrix;
typedef union _ClutterEvent ClutterEvent; typedef union _ClutterEvent ClutterEvent;
/** /**
@ -432,22 +429,6 @@ CLUTTER_EXPORT
void clutter_interval_register_progress_func (GType value_type, void clutter_interval_register_progress_func (GType value_type,
ClutterProgressFunc func); ClutterProgressFunc func);
CLUTTER_EXPORT
GType clutter_matrix_get_type (void) G_GNUC_CONST;
CLUTTER_EXPORT
ClutterMatrix * clutter_matrix_alloc (void);
CLUTTER_EXPORT
ClutterMatrix * clutter_matrix_init_identity (ClutterMatrix *matrix);
CLUTTER_EXPORT
ClutterMatrix * clutter_matrix_init_from_array (ClutterMatrix *matrix,
const float values[16]);
CLUTTER_EXPORT
ClutterMatrix * clutter_matrix_init_from_matrix (ClutterMatrix *a,
const ClutterMatrix *b);
CLUTTER_EXPORT
void clutter_matrix_free (ClutterMatrix *matrix);
G_END_DECLS G_END_DECLS
#endif /* __CLUTTER_TYPES_H__ */ #endif /* __CLUTTER_TYPES_H__ */

View File

@ -231,7 +231,7 @@ clutter_util_rectangle_equal (const cairo_rectangle_int_t *src1,
} }
float float
_clutter_util_matrix_determinant (const ClutterMatrix *matrix) _clutter_util_matrix_determinant (const CoglMatrix *matrix)
{ {
return matrix->xw * matrix->yz * matrix->zy * matrix->wz return matrix->xw * matrix->yz * matrix->zy * matrix->wz
- matrix->xz * matrix->yw * matrix->zy * matrix->wz - matrix->xz * matrix->yw * matrix->zy * matrix->wz
@ -260,7 +260,7 @@ _clutter_util_matrix_determinant (const ClutterMatrix *matrix)
} }
static void static void
_clutter_util_matrix_transpose_vector4_transform (const ClutterMatrix *matrix, _clutter_util_matrix_transpose_vector4_transform (const CoglMatrix *matrix,
const ClutterVertex4 *point, const ClutterVertex4 *point,
ClutterVertex4 *res) ClutterVertex4 *res)
{ {
@ -286,7 +286,7 @@ _clutter_util_matrix_transpose_vector4_transform (const ClutterMatrix *matrix,
} }
void void
_clutter_util_matrix_skew_xy (ClutterMatrix *matrix, _clutter_util_matrix_skew_xy (CoglMatrix *matrix,
float factor) float factor)
{ {
matrix->yx += matrix->xx * factor; matrix->yx += matrix->xx * factor;
@ -296,7 +296,7 @@ _clutter_util_matrix_skew_xy (ClutterMatrix *matrix,
} }
void void
_clutter_util_matrix_skew_xz (ClutterMatrix *matrix, _clutter_util_matrix_skew_xz (CoglMatrix *matrix,
float factor) float factor)
{ {
matrix->zx += matrix->xx * factor; matrix->zx += matrix->xx * factor;
@ -306,7 +306,7 @@ _clutter_util_matrix_skew_xz (ClutterMatrix *matrix,
} }
void void
_clutter_util_matrix_skew_yz (ClutterMatrix *matrix, _clutter_util_matrix_skew_yz (CoglMatrix *matrix,
float factor) float factor)
{ {
matrix->zx += matrix->yx * factor; matrix->zx += matrix->yx * factor;
@ -353,7 +353,7 @@ _clutter_util_vertex4_interpolate (const ClutterVertex4 *a,
* @perspective_p: (out caller-allocates: return location for a 4D vertex * @perspective_p: (out caller-allocates: return location for a 4D vertex
* containing the perspective * containing the perspective
* *
* Decomposes a #ClutterMatrix into the transformations that compose it. * Decomposes a #CoglMatrix into the transformations that compose it.
* *
* This code is based on the matrix decomposition algorithm as published in * This code is based on the matrix decomposition algorithm as published in
* the CSS Transforms specification by the W3C CSS working group, available * the CSS Transforms specification by the W3C CSS working group, available
@ -367,7 +367,7 @@ _clutter_util_vertex4_interpolate (const ClutterVertex4 *a,
* if the matrix is singular * if the matrix is singular
*/ */
gboolean gboolean
_clutter_util_matrix_decompose (const ClutterMatrix *src, _clutter_util_matrix_decompose (const CoglMatrix *src,
graphene_point3d_t *scale_p, graphene_point3d_t *scale_p,
float shear_p[3], float shear_p[3],
graphene_point3d_t *rotate_p, graphene_point3d_t *rotate_p,

View File

@ -10,7 +10,7 @@ static void
actor_pivot (void) actor_pivot (void)
{ {
ClutterActor *stage, *actor_implicit, *actor_explicit; ClutterActor *stage, *actor_implicit, *actor_explicit;
ClutterMatrix transform, result_implicit, result_explicit; CoglMatrix transform, result_implicit, result_explicit;
ClutterActorBox allocation = CLUTTER_ACTOR_BOX_INIT (0, 0, 90, 30); ClutterActorBox allocation = CLUTTER_ACTOR_BOX_INIT (0, 0, 90, 30);
gfloat angle = 30; gfloat angle = 30;
@ -33,7 +33,7 @@ actor_pivot (void)
clutter_actor_set_rotation_angle (actor_implicit, CLUTTER_Z_AXIS, angle); clutter_actor_set_rotation_angle (actor_implicit, CLUTTER_Z_AXIS, angle);
/* Explicit transformation */ /* Explicit transformation */
clutter_matrix_init_identity(&transform); cogl_matrix_init_identity (&transform);
cogl_matrix_rotate (&transform, angle, 0, 0, 1.0); cogl_matrix_rotate (&transform, angle, 0, 0, 1.0);
clutter_actor_set_transform (actor_explicit, &transform); clutter_actor_set_transform (actor_explicit, &transform);