[mutter/gbsneto/graphene-matrix: 58/73] clutter/stage-view: Use graphene APIs




commit aca2880c6acd1c391b77457ef52c09b2f0781f1f
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Fri Sep 11 16:39:50 2020 -0300

    clutter/stage-view: Use graphene APIs
    
    In this case, since we are building the entire matrix by ourselves,
    reverse the order of operations (translate + scale → scale + translate)
    and build it using graphene-specific APIs.
    
    https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439

 clutter/clutter/clutter-stage-view.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
---
diff --git a/clutter/clutter/clutter-stage-view.c b/clutter/clutter/clutter-stage-view.c
index c75b1f25eb..6e505bd07e 100644
--- a/clutter/clutter/clutter-stage-view.c
+++ b/clutter/clutter/clutter-stage-view.c
@@ -236,13 +236,14 @@ paint_transformed_framebuffer (ClutterStageView     *view,
 
   cogl_framebuffer_push_matrix (dst_framebuffer);
 
-  cogl_matrix_init_identity (&matrix);
-  cogl_matrix_scale (&matrix,
-                     1.0 / (dst_width / 2.0),
-                     -1.0 / (dst_height / 2.0), 0);
-  cogl_matrix_translate (&matrix,
-                         -(dst_width / 2.0),
-                         -(dst_height / 2.0), 0);
+  graphene_matrix_init_translate (&matrix,
+                                  &GRAPHENE_POINT3D_INIT (-dst_width / 2.0,
+                                                          -dst_height / 2.0,
+                                                          0.f));
+  graphene_matrix_scale (&matrix,
+                         1.0 / (dst_width / 2.0),
+                         -1.0 / (dst_height / 2.0),
+                         0.f);
   cogl_framebuffer_set_projection_matrix (dst_framebuffer, &matrix);
   cogl_framebuffer_set_viewport (dst_framebuffer,
                                  0, 0, dst_width, dst_height);
@@ -987,7 +988,7 @@ static void
 clutter_stage_default_get_offscreen_transformation_matrix (ClutterStageView  *view,
                                                            graphene_matrix_t *matrix)
 {
-  cogl_matrix_init_identity (matrix);
+  graphene_matrix_init_identity (matrix);
 }
 
 void


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