Replace CoglMatrix by graphene_matrix_t

Replace both the types, and the cogl_matrix_* API calls
with the corresponding graphene_matrix_* ones.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1436
This commit is contained in:
Georges Basile Stavracas Neto 2020-09-11 15:49:29 -03:00
parent 6b1e2df589
commit 2321ce2864
2 changed files with 14 additions and 22 deletions

View File

@ -330,17 +330,13 @@ setup_projection_matrix (CoglFramebuffer *framebuffer,
float width, float width,
float height) float height)
{ {
CoglMatrix projection; graphene_matrix_t projection;
cogl_matrix_init_identity (&projection); graphene_matrix_init_translate (&projection,
cogl_matrix_scale (&projection, &GRAPHENE_POINT3D_INIT (-width / 2.0,
2.0 / width, -height / 2.0,
-2.0 / height, 0.f));
1.f); graphene_matrix_scale (&projection, 2.0 / width, -2.0 / height, 1.f);
cogl_matrix_translate (&projection,
-width / 2.0,
-height / 2.0,
0);
cogl_framebuffer_set_projection_matrix (framebuffer, &projection); cogl_framebuffer_set_projection_matrix (framebuffer, &projection);
} }

View File

@ -325,28 +325,24 @@ get_hadjustment_value (StViewport *viewport)
} }
static void static void
st_viewport_apply_transform (ClutterActor *actor, st_viewport_apply_transform (ClutterActor *actor,
CoglMatrix *matrix) graphene_matrix_t *matrix)
{ {
StViewport *viewport = ST_VIEWPORT (actor); StViewport *viewport = ST_VIEWPORT (actor);
StViewportPrivate *priv = st_viewport_get_instance_private (viewport); StViewportPrivate *priv = st_viewport_get_instance_private (viewport);
ClutterActorClass *parent_class = ClutterActorClass *parent_class =
CLUTTER_ACTOR_CLASS (st_viewport_parent_class); CLUTTER_ACTOR_CLASS (st_viewport_parent_class);
double x, y; graphene_point3d_t p = GRAPHENE_POINT3D_INIT_ZERO;
parent_class->apply_transform (actor, matrix);
if (priv->hadjustment) if (priv->hadjustment)
x = get_hadjustment_value (viewport); p.x = -get_hadjustment_value (viewport);
else
x = 0;
if (priv->vadjustment) if (priv->vadjustment)
y = st_adjustment_get_value (priv->vadjustment); p.y = -st_adjustment_get_value (priv->vadjustment);
else
y = 0;
cogl_matrix_translate (matrix, (int) -x, (int) -y, 0); graphene_matrix_translate (matrix, &p);
parent_class->apply_transform (actor, matrix);
} }
/* If we are translated, then we need to translate back before chaining /* If we are translated, then we need to translate back before chaining