clutter/actor: Remove pick code from paint

Now that they are properly split, remove the pick
code from paint paths.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/865
This commit is contained in:
Georges Basile Stavracas Neto 2019-10-17 17:08:19 +02:00
parent 86a5358812
commit db8fcc0537

View File

@ -3877,7 +3877,6 @@ void
clutter_actor_paint (ClutterActor *self) clutter_actor_paint (ClutterActor *self)
{ {
ClutterActorPrivate *priv; ClutterActorPrivate *priv;
ClutterPickMode pick_mode;
ClutterActorBox clip; ClutterActorBox clip;
gboolean clip_set = FALSE; gboolean clip_set = FALSE;
ClutterStage *stage; ClutterStage *stage;
@ -3888,16 +3887,11 @@ clutter_actor_paint (ClutterActor *self)
return; return;
priv = self->priv; priv = self->priv;
pick_mode = _clutter_context_get_pick_mode ();
if (pick_mode == CLUTTER_PICK_NONE)
priv->propagated_one_redraw = FALSE; priv->propagated_one_redraw = FALSE;
/* It's an important optimization that we consider painting of /* It's an important optimization that we consider painting of
* actors with 0 opacity to be a NOP... */ * actors with 0 opacity to be a NOP... */
if (pick_mode == CLUTTER_PICK_NONE && if (/* ignore top-levels, since they might be transparent */
/* ignore top-levels, since they might be transparent */
!CLUTTER_ACTOR_IS_TOPLEVEL (self) && !CLUTTER_ACTOR_IS_TOPLEVEL (self) &&
/* Use the override opacity if its been set */ /* Use the override opacity if its been set */
((priv->opacity_override >= 0) ? ((priv->opacity_override >= 0) ?
@ -3988,8 +3982,6 @@ clutter_actor_paint (ClutterActor *self)
} }
if (clip_set) if (clip_set)
{
if (pick_mode == CLUTTER_PICK_NONE)
{ {
CoglFramebuffer *fb = _clutter_stage_get_active_framebuffer (stage); CoglFramebuffer *fb = _clutter_stage_get_active_framebuffer (stage);
@ -3999,21 +3991,13 @@ clutter_actor_paint (ClutterActor *self)
clip.x2, clip.x2,
clip.y2); clip.y2);
} }
else
{
if (!_clutter_actor_push_pick_clip (self, &clip))
clip_set = FALSE;
}
}
if (pick_mode == CLUTTER_PICK_NONE)
{
/* We check whether we need to add the flatten effect before /* We check whether we need to add the flatten effect before
each paint so that we can avoid having a mechanism for * each paint so that we can avoid having a mechanism for
applications to notify when the value of the * applications to notify when the value of the
has_overlaps virtual changes. */ * has_overlaps virtual changes.
*/
add_or_remove_flatten_effect (self); add_or_remove_flatten_effect (self);
}
/* We save the current paint volume so that the next time the /* We save the current paint volume so that the next time the
* actor queues a redraw we can constrain the redraw to just * actor queues a redraw we can constrain the redraw to just
@ -4042,7 +4026,7 @@ clutter_actor_paint (ClutterActor *self)
* paint then the last-paint-volume would likely represent the new * paint then the last-paint-volume would likely represent the new
* actor position not the old. * actor position not the old.
*/ */
if (!in_clone_paint () && pick_mode == CLUTTER_PICK_NONE) if (!in_clone_paint ())
{ {
gboolean success; gboolean success;
/* annoyingly gcc warns if uninitialized even though /* annoyingly gcc warns if uninitialized even though
@ -4072,29 +4056,20 @@ clutter_actor_paint (ClutterActor *self)
clutter_actor_continue_paint (self); clutter_actor_continue_paint (self);
if (G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_PAINT_VOLUMES && if (G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_PAINT_VOLUMES))
pick_mode == CLUTTER_PICK_NONE))
_clutter_actor_draw_paint_volume (self); _clutter_actor_draw_paint_volume (self);
/* If we make it here then the actor has run through a complete /* If we make it here then the actor has run through a complete
paint run including all the effects so it's no longer dirty */ paint run including all the effects so it's no longer dirty */
if (pick_mode == CLUTTER_PICK_NONE)
priv->is_dirty = FALSE; priv->is_dirty = FALSE;
done: done:
if (clip_set) if (clip_set)
{
if (pick_mode == CLUTTER_PICK_NONE)
{ {
CoglFramebuffer *fb = _clutter_stage_get_active_framebuffer (stage); CoglFramebuffer *fb = _clutter_stage_get_active_framebuffer (stage);
cogl_framebuffer_pop_clip (fb); cogl_framebuffer_pop_clip (fb);
} }
else
{
_clutter_actor_pop_pick_clip (self);
}
}
cogl_pop_matrix (); cogl_pop_matrix ();
@ -4134,8 +4109,6 @@ clutter_actor_continue_paint (ClutterActor *self)
/* If this has come from the last effect then we'll just paint the /* If this has come from the last effect then we'll just paint the
actual actor */ actual actor */
if (priv->next_effect_to_paint == NULL) if (priv->next_effect_to_paint == NULL)
{
if (_clutter_context_get_pick_mode () == CLUTTER_PICK_NONE)
{ {
ClutterPaintNode *dummy; ClutterPaintNode *dummy;
@ -4160,19 +4133,6 @@ clutter_actor_continue_paint (ClutterActor *self)
else else
CLUTTER_ACTOR_GET_CLASS (self)->paint (self); CLUTTER_ACTOR_GET_CLASS (self)->paint (self);
} }
else
{
/* The actor will log a silhouette of itself to the stage pick log.
*
* XXX:2.0 - Call the pick() virtual directly
*/
if (g_signal_has_handler_pending (self, actor_signals[PICK],
0, TRUE))
g_signal_emit (self, actor_signals[PICK], 0);
else
CLUTTER_ACTOR_GET_CLASS (self)->pick (self);
}
}
else else
{ {
ClutterEffect *old_current_effect; ClutterEffect *old_current_effect;
@ -4185,31 +4145,20 @@ clutter_actor_continue_paint (ClutterActor *self)
priv->current_effect = priv->next_effect_to_paint->data; priv->current_effect = priv->next_effect_to_paint->data;
priv->next_effect_to_paint = priv->next_effect_to_paint->next; priv->next_effect_to_paint = priv->next_effect_to_paint->next;
if (_clutter_context_get_pick_mode () == CLUTTER_PICK_NONE)
{
if (priv->is_dirty) if (priv->is_dirty)
{ {
/* If there's an effect queued with this redraw then all /* If there's an effect queued with this redraw then all
effects up to that one will be considered dirty. It * effects up to that one will be considered dirty. It
is expected the queued effect will paint the cached * is expected the queued effect will paint the cached
image and not call clutter_actor_continue_paint again * image and not call clutter_actor_continue_paint again
(although it should work ok if it does) */ * (although it should work ok if it does)
*/
if (priv->effect_to_redraw == NULL || if (priv->effect_to_redraw == NULL ||
priv->current_effect != priv->effect_to_redraw) priv->current_effect != priv->effect_to_redraw)
run_flags |= CLUTTER_EFFECT_PAINT_ACTOR_DIRTY; run_flags |= CLUTTER_EFFECT_PAINT_ACTOR_DIRTY;
} }
_clutter_effect_paint (priv->current_effect, run_flags); _clutter_effect_paint (priv->current_effect, run_flags);
}
else
{
/* We can't determine when an actor has been modified since
its last pick so lets just assume it has always been
modified */
run_flags |= CLUTTER_EFFECT_PAINT_ACTOR_DIRTY;
_clutter_effect_pick (priv->current_effect, run_flags);
}
priv->current_effect = old_current_effect; priv->current_effect = old_current_effect;
} }