clutter: Explicitly initiate CoglMatrices

Instead of relying on the macro. The macro will go away in the
next commit as part of using graphene_matrix_t in the CoglMatrix
structure.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
This commit is contained in:
Georges Basile Stavracas Neto 2020-09-10 16:04:48 -03:00
parent b878938de4
commit 3324fbb1e3
2 changed files with 23 additions and 6 deletions

View File

@ -4418,7 +4418,7 @@ clutter_actor_remove_child_internal (ClutterActor *self,
g_object_unref (child);
}
static const ClutterTransformInfo default_transform_info = {
static ClutterTransformInfo default_transform_info = {
0.0, /* rotation-x */
0.0, /* rotation-y */
0.0, /* rotation-z */
@ -4432,12 +4432,27 @@ static const ClutterTransformInfo default_transform_info = {
GRAPHENE_POINT_INIT_ZERO, /* pivot */
0.f, /* pivot-z */
COGL_MATRIX_INIT_IDENTITY,
{ },
FALSE, /* transform */
COGL_MATRIX_INIT_IDENTITY,
{ },
FALSE, /* child-transform */
};
static inline const ClutterTransformInfo *
get_default_transform_info (void)
{
static gsize initialized = FALSE;
if (G_UNLIKELY (g_once_init_enter (&initialized)))
{
cogl_matrix_init_identity (&default_transform_info.transform);
cogl_matrix_init_identity (&default_transform_info.child_transform);
g_once_init_leave (&initialized, TRUE);
}
return &default_transform_info;
}
/*< private >
* _clutter_actor_get_transform_info_or_defaults:
* @self: a #ClutterActor
@ -4460,7 +4475,7 @@ _clutter_actor_get_transform_info_or_defaults (ClutterActor *self)
if (info != NULL)
return info;
return &default_transform_info;
return get_default_transform_info ();
}
static void
@ -4497,7 +4512,7 @@ _clutter_actor_get_transform_info (ClutterActor *self)
{
info = g_slice_new (ClutterTransformInfo);
*info = default_transform_info;
*info = *get_default_transform_info ();
g_object_set_qdata_full (G_OBJECT (self), quark_actor_transform_info,
info,

View File

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