From 1688cf7c44ef0105ecb8dea2a7a55490473c0046 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Fri, 1 Nov 2019 12:05:32 +0100 Subject: [PATCH] clutter: Drop the no-clear stage hint A compositor is notably opaque (usually has nothing to be painted on!). gnome-shell sets this hint, but there's no reason why we wouldn't want it by default. Also, the color buffer being cleared messes with stencil clips, as the clear operation by definition ignores the stencil buffer. We want to use these more extensively in the future, so just drop this API. https://gitlab.gnome.org/GNOME/mutter/merge_requests/911 --- clutter/clutter/clutter-actor.c | 2 - clutter/clutter/clutter-stage.c | 117 -------------------------------- clutter/clutter/clutter-stage.h | 5 -- 3 files changed, 124 deletions(-) diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c index ac2e54afd..af9353e0e 100644 --- a/clutter/clutter/clutter-actor.c +++ b/clutter/clutter/clutter-actor.c @@ -3807,8 +3807,6 @@ clutter_actor_paint_node (ClutterActor *actor, bg_color.alpha); clear_flags = COGL_BUFFER_BIT_DEPTH; - if (!clutter_stage_get_no_clear_hint (CLUTTER_STAGE (actor))) - clear_flags |= COGL_BUFFER_BIT_COLOR; node = clutter_root_node_new (fb, &bg_color, clear_flags); clutter_paint_node_set_name (node, "stageClear"); diff --git a/clutter/clutter/clutter-stage.c b/clutter/clutter/clutter-stage.c index f1f75bd0a..4b6f46612 100644 --- a/clutter/clutter/clutter-stage.c +++ b/clutter/clutter/clutter-stage.c @@ -78,24 +78,6 @@ #include "cogl/cogl.h" #include "cogl/cogl-trace.h" -/* - * ClutterStageHint: - * @CLUTTER_STAGE_NONE: No hint set - * @CLUTTER_STAGE_NO_CLEAR_ON_PAINT: When this hint is set, the stage - * should not clear the viewport; this flag is useful when painting - * fully opaque actors covering the whole visible area of the stage, - * i.e. when no blending with the stage color happens over the whole - * stage viewport - */ -typedef enum /*< prefix=CLUTTER_STAGE >*/ -{ - CLUTTER_STAGE_HINT_NONE = 0, - - CLUTTER_STAGE_NO_CLEAR_ON_PAINT = 1 << 0 -} ClutterStageHint; - -#define STAGE_NO_CLEAR_ON_PAINT(s) ((((ClutterStage *) (s))->priv->stage_hints & CLUTTER_STAGE_NO_CLEAR_ON_PAINT) != 0) - struct _ClutterStageQueueRedrawEntry { ClutterActor *actor; @@ -132,8 +114,6 @@ struct _ClutterStagePrivate GQueue *event_queue; - ClutterStageHint stage_hints; - GArray *paint_volume_stack; ClutterPlane current_clip_planes[4]; @@ -188,7 +168,6 @@ enum PROP_TITLE, PROP_USE_ALPHA, PROP_KEY_FOCUS, - PROP_NO_CLEAR_HINT, PROP_ACCEPT_FOCUS, PROP_LAST }; @@ -1889,10 +1868,6 @@ clutter_stage_set_property (GObject *object, clutter_stage_set_key_focus (stage, g_value_get_object (value)); break; - case PROP_NO_CLEAR_HINT: - clutter_stage_set_no_clear_hint (stage, g_value_get_boolean (value)); - break; - case PROP_ACCEPT_FOCUS: clutter_stage_set_accept_focus (stage, g_value_get_boolean (value)); break; @@ -1943,15 +1918,6 @@ clutter_stage_get_property (GObject *gobject, g_value_set_object (value, priv->key_focused_actor); break; - case PROP_NO_CLEAR_HINT: - { - gboolean hint = - (priv->stage_hints & CLUTTER_STAGE_NO_CLEAR_ON_PAINT) != 0; - - g_value_set_boolean (value, hint); - } - break; - case PROP_ACCEPT_FOCUS: g_value_set_boolean (value, priv->accept_focus); break; @@ -2154,23 +2120,6 @@ clutter_stage_class_init (ClutterStageClass *klass) CLUTTER_TYPE_ACTOR, CLUTTER_PARAM_READWRITE); - /** - * ClutterStage:no-clear-hint: - * - * Whether or not the #ClutterStage should clear its contents - * before each paint cycle. - * - * See clutter_stage_set_no_clear_hint() for further information. - * - * Since: 1.4 - */ - obj_props[PROP_NO_CLEAR_HINT] = - g_param_spec_boolean ("no-clear-hint", - P_("No Clear Hint"), - P_("Whether the stage should clear its contents"), - FALSE, - CLUTTER_PARAM_READWRITE); - /** * ClutterStage:accept-focus: * @@ -3788,72 +3737,6 @@ _clutter_stage_clear_update_time (ClutterStage *stage) _clutter_stage_window_clear_update_time (stage_window); } -/** - * clutter_stage_set_no_clear_hint: - * @stage: a #ClutterStage - * @no_clear: %TRUE if the @stage should not clear itself on every - * repaint cycle - * - * Sets whether the @stage should clear itself at the beginning - * of each paint cycle or not. - * - * Clearing the #ClutterStage can be a costly operation, especially - * if the stage is always covered - for instance, in a full-screen - * video player or in a game with a background texture. - * - * This setting is a hint; Clutter might discard this hint - * depending on its internal state. - * - * If parts of the stage are visible and you disable clearing you - * might end up with visual artifacts while painting the contents of - * the stage. - * - * Since: 1.4 - */ -void -clutter_stage_set_no_clear_hint (ClutterStage *stage, - gboolean no_clear) -{ - ClutterStagePrivate *priv; - ClutterStageHint new_hints; - - g_return_if_fail (CLUTTER_IS_STAGE (stage)); - - priv = stage->priv; - new_hints = priv->stage_hints; - - if (no_clear) - new_hints |= CLUTTER_STAGE_NO_CLEAR_ON_PAINT; - else - new_hints &= ~CLUTTER_STAGE_NO_CLEAR_ON_PAINT; - - if (priv->stage_hints == new_hints) - return; - - priv->stage_hints = new_hints; - - g_object_notify_by_pspec (G_OBJECT (stage), obj_props[PROP_NO_CLEAR_HINT]); -} - -/** - * clutter_stage_get_no_clear_hint: - * @stage: a #ClutterStage - * - * Retrieves the hint set with clutter_stage_set_no_clear_hint() - * - * Return value: %TRUE if the stage should not clear itself on every paint - * cycle, and %FALSE otherwise - * - * Since: 1.4 - */ -gboolean -clutter_stage_get_no_clear_hint (ClutterStage *stage) -{ - g_return_val_if_fail (CLUTTER_IS_STAGE (stage), FALSE); - - return (stage->priv->stage_hints & CLUTTER_STAGE_NO_CLEAR_ON_PAINT) != 0; -} - ClutterPaintVolume * _clutter_stage_paint_volume_stack_allocate (ClutterStage *stage) { diff --git a/clutter/clutter/clutter-stage.h b/clutter/clutter/clutter-stage.h index f40ce8164..88cd96ad5 100644 --- a/clutter/clutter/clutter-stage.h +++ b/clutter/clutter/clutter-stage.h @@ -164,11 +164,6 @@ void clutter_stage_get_minimum_size (ClutterStage guint *width, guint *height); CLUTTER_EXPORT -void clutter_stage_set_no_clear_hint (ClutterStage *stage, - gboolean no_clear); -CLUTTER_EXPORT -gboolean clutter_stage_get_no_clear_hint (ClutterStage *stage); -CLUTTER_EXPORT void clutter_stage_set_use_alpha (ClutterStage *stage, gboolean use_alpha); CLUTTER_EXPORT