Blob Blame History Raw
From e69a6ac0e44e8d5fd72d7bc60f118044b0407e8f Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Thu, 9 Nov 2017 16:18:02 -0500
Subject: [PATCH] 0001-clutter-stage-don-t-use-deprecated-api.patch

---
 clutter/clutter/clutter-stage.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/clutter/clutter/clutter-stage.c b/clutter/clutter/clutter-stage.c
index 02ab07b..e4f9342 100644
--- a/clutter/clutter/clutter-stage.c
+++ b/clutter/clutter/clutter-stage.c
@@ -1459,64 +1459,65 @@ _clutter_stage_do_pick_on_view (ClutterStage     *stage,
   fb_height = view_layout.height * fb_scale;
   cogl_push_framebuffer (fb);
 
   /* needed for when a context switch happens */
   _clutter_stage_maybe_setup_viewport (stage, view);
 
   /* FIXME: For some reason leaving the cogl clip stack empty causes the
    * picking to not work at all, so setting it the whole framebuffer content
    * for now. */
   cogl_framebuffer_push_scissor_clip (fb, 0, 0,
                                       view_layout.width * fb_scale,
                                       view_layout.height * fb_scale);
 
   _clutter_stage_window_get_dirty_pixel (priv->impl, view, &dirty_x, &dirty_y);
 
   if (G_LIKELY (!(clutter_pick_debug_flags & CLUTTER_DEBUG_DUMP_PICK_BUFFERS)))
     {
       CLUTTER_NOTE (PICK, "Pushing pick scissor clip x: %d, y: %d, 1x1",
                     (int) dirty_x * fb_scale,
                     (int) dirty_y * fb_scale);
       cogl_framebuffer_push_scissor_clip (fb, dirty_x * fb_scale, dirty_y * fb_scale, 1, 1);
     }
 
   viewport_offset_x = x * fb_scale - dirty_x * fb_scale;
   viewport_offset_y = y * fb_scale - dirty_y * fb_scale;
   CLUTTER_NOTE (PICK, "Setting viewport to %f, %f, %f, %f",
                 priv->viewport[0] * fb_scale - viewport_offset_x,
                 priv->viewport[1] * fb_scale - viewport_offset_y,
                 priv->viewport[2] * fb_scale,
                 priv->viewport[3] * fb_scale);
-  cogl_set_viewport (priv->viewport[0] * fb_scale - viewport_offset_x,
-                     priv->viewport[1] * fb_scale - viewport_offset_y,
-                     priv->viewport[2] * fb_scale,
-                     priv->viewport[3] * fb_scale);
+  cogl_framebuffer_set_viewport (fb,
+                                 priv->viewport[0] * fb_scale - viewport_offset_x,
+                                 priv->viewport[1] * fb_scale - viewport_offset_y,
+                                 priv->viewport[2] * fb_scale,
+                                 priv->viewport[3] * fb_scale);
 
   read_x = dirty_x * fb_scale;
   read_y = dirty_y * fb_scale;
 
   CLUTTER_NOTE (PICK, "Performing pick at %i,%i on view %dx%d+%d+%d s: %d",
                 x, y,
                 view_layout.width, view_layout.height,
                 view_layout.x, view_layout.y, fb_scale);
 
   cogl_color_init_from_4ub (&stage_pick_id, 255, 255, 255, 255);
   cogl_clear (&stage_pick_id, COGL_BUFFER_BIT_COLOR | COGL_BUFFER_BIT_DEPTH);
 
   /* Disable dithering (if any) when doing the painting in pick mode */
   dither_enabled_save = cogl_framebuffer_get_dither_enabled (fb);
   cogl_framebuffer_set_dither_enabled (fb, FALSE);
 
   /* Render the entire scence in pick mode - just single colored silhouette's
    * are drawn offscreen (as we never swap buffers)
   */
   context->pick_mode = mode;
   _clutter_stage_paint_view (stage, view, NULL);
   context->pick_mode = CLUTTER_PICK_NONE;
 
   /* Read the color of the screen co-ords pixel. RGBA_8888_PRE is used
      even though we don't care about the alpha component because under
      GLES this is the only format that is guaranteed to work so Cogl
      will end up having to do a conversion if any other format is
      used. The format is requested as pre-multiplied because Cogl
      assumes that all pixels in the framebuffer are premultiplied so
      it avoids a conversion. */
@@ -3590,123 +3591,125 @@ calculate_z_translation (float z_near)
    *  z_2d = --------------------------- + z_near
    *                 sin (0.5°)
    */
 
    /* We expect the compiler should boil this down to z_near * CONSTANT
     * already, but just in case we use precomputed constants
     */
 #if 0
 # define A      tanf (_DEG_TO_RAD (30.f))
 # define B      sinf (_DEG_TO_RAD (120.f))
 # define C      cosf (_DEG_TO_RAD (30.5f))
 # define D      sinf (_DEG_TO_RAD (.5f))
 #else
 # define A      0.57735025882720947265625f
 # define B      0.866025388240814208984375f
 # define C      0.86162912845611572265625f
 # define D      0.00872653536498546600341796875f
 #endif
 
   return z_near
        * A * B * C
        / D
        + z_near;
 }
 
 void
 _clutter_stage_maybe_setup_viewport (ClutterStage     *stage,
                                      ClutterStageView *view)
 {
   ClutterStagePrivate *priv = stage->priv;
+  CoglFramebuffer *fb = clutter_stage_view_get_framebuffer (view);
 
   if (clutter_stage_view_is_dirty_viewport (view))
     {
       cairo_rectangle_int_t view_layout;
       ClutterPerspective perspective;
       float fb_scale;
       float viewport_offset_x;
       float viewport_offset_y;
       float z_2d;
 
       CLUTTER_NOTE (PAINT,
                     "Setting up the viewport { w:%f, h:%f }",
                     priv->viewport[2],
                     priv->viewport[3]);
 
       fb_scale = clutter_stage_view_get_scale (view);
       clutter_stage_view_get_layout (view, &view_layout);
 
       viewport_offset_x = view_layout.x * fb_scale;
       viewport_offset_y = view_layout.y * fb_scale;
-      cogl_set_viewport (priv->viewport[0] * fb_scale - viewport_offset_x,
-                         priv->viewport[1] * fb_scale - viewport_offset_y,
-                         priv->viewport[2] * fb_scale,
-                         priv->viewport[3] * fb_scale);
+      cogl_framebuffer_set_viewport (fb,
+                                     priv->viewport[0] * fb_scale - viewport_offset_x,
+                                     priv->viewport[1] * fb_scale - viewport_offset_y,
+                                     priv->viewport[2] * fb_scale,
+                                     priv->viewport[3] * fb_scale);
 
       perspective = priv->perspective;
 
       /* Ideally we want to regenerate the perspective matrix whenever
        * the size changes but if the user has provided a custom matrix
        * then we don't want to override it */
       if (!priv->has_custom_perspective)
         {
           perspective.aspect = priv->viewport[2] / priv->viewport[3];
           z_2d = calculate_z_translation (perspective.z_near);
 
           /* NB: z_2d is only enough room for 85% of the stage_height between
            * the stage and the z_near plane. For behind the stage plane we
            * want a more consistent gap of 10 times the stage_height before
            * hitting the far plane so we calculate that relative to the final
            * height of the stage plane at the z_2d_distance we got... */
           perspective.z_far = z_2d +
             tanf (_DEG_TO_RAD (perspective.fovy / 2.0f)) * z_2d * 20.0f;
 
           clutter_stage_set_perspective_internal (stage, &perspective);
         }
       else
         z_2d = calculate_z_translation (perspective.z_near);
 
       cogl_matrix_init_identity (&priv->view);
       cogl_matrix_view_2d_in_perspective (&priv->view,
                                           perspective.fovy,
                                           perspective.aspect,
                                           perspective.z_near,
                                           z_2d,
                                           priv->viewport[2],
                                           priv->viewport[3]);
 
       clutter_stage_view_set_dirty_viewport (view, FALSE);
     }
 
   if (clutter_stage_view_is_dirty_projection (view))
     {
-      cogl_set_projection_matrix (&priv->projection);
+      cogl_framebuffer_set_projection_matrix (fb, &priv->projection);
 
       clutter_stage_view_set_dirty_projection (view, FALSE);
     }
 }
 
 #undef _DEG_TO_RAD
 
 /**
  * clutter_stage_ensure_redraw:
  * @stage: a #ClutterStage
  *
  * Ensures that @stage is redrawn
  *
  * This function should not be called by applications: it is
  * used when embedding a #ClutterStage into a toolkit with
  * another windowing system, like GTK+.
  *
  * Since: 1.0
  */
 void
 clutter_stage_ensure_redraw (ClutterStage *stage)
 {
   ClutterMasterClock *master_clock;
   ClutterStagePrivate *priv;
 
   g_return_if_fail (CLUTTER_IS_STAGE (stage));
 
   priv = stage->priv;
 
   if (!priv->relayout_pending && !priv->redraw_pending)
-- 
2.14.3