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