mirror of
https://github.com/brl/mutter.git
synced 2024-11-12 17:27:03 -05:00
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:
parent
86a5358812
commit
db8fcc0537
@ -3877,7 +3877,6 @@ void
|
||||
clutter_actor_paint (ClutterActor *self)
|
||||
{
|
||||
ClutterActorPrivate *priv;
|
||||
ClutterPickMode pick_mode;
|
||||
ClutterActorBox clip;
|
||||
gboolean clip_set = FALSE;
|
||||
ClutterStage *stage;
|
||||
@ -3888,16 +3887,11 @@ clutter_actor_paint (ClutterActor *self)
|
||||
return;
|
||||
|
||||
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
|
||||
* actors with 0 opacity to be a NOP... */
|
||||
if (pick_mode == CLUTTER_PICK_NONE &&
|
||||
/* ignore top-levels, since they might be transparent */
|
||||
if (/* ignore top-levels, since they might be transparent */
|
||||
!CLUTTER_ACTOR_IS_TOPLEVEL (self) &&
|
||||
/* Use the override opacity if its been set */
|
||||
((priv->opacity_override >= 0) ?
|
||||
@ -3989,31 +3983,21 @@ clutter_actor_paint (ClutterActor *self)
|
||||
|
||||
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_push_rectangle_clip (fb,
|
||||
clip.x1,
|
||||
clip.y1,
|
||||
clip.x2,
|
||||
clip.y2);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!_clutter_actor_push_pick_clip (self, &clip))
|
||||
clip_set = FALSE;
|
||||
}
|
||||
cogl_framebuffer_push_rectangle_clip (fb,
|
||||
clip.x1,
|
||||
clip.y1,
|
||||
clip.x2,
|
||||
clip.y2);
|
||||
}
|
||||
|
||||
if (pick_mode == CLUTTER_PICK_NONE)
|
||||
{
|
||||
/* We check whether we need to add the flatten effect before
|
||||
each paint so that we can avoid having a mechanism for
|
||||
applications to notify when the value of the
|
||||
has_overlaps virtual changes. */
|
||||
add_or_remove_flatten_effect (self);
|
||||
}
|
||||
/* We check whether we need to add the flatten effect before
|
||||
* each paint so that we can avoid having a mechanism for
|
||||
* applications to notify when the value of the
|
||||
* has_overlaps virtual changes.
|
||||
*/
|
||||
add_or_remove_flatten_effect (self);
|
||||
|
||||
/* We save the current paint volume so that the next time the
|
||||
* 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
|
||||
* actor position not the old.
|
||||
*/
|
||||
if (!in_clone_paint () && pick_mode == CLUTTER_PICK_NONE)
|
||||
if (!in_clone_paint ())
|
||||
{
|
||||
gboolean success;
|
||||
/* annoyingly gcc warns if uninitialized even though
|
||||
@ -4072,28 +4056,19 @@ clutter_actor_paint (ClutterActor *self)
|
||||
|
||||
clutter_actor_continue_paint (self);
|
||||
|
||||
if (G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_PAINT_VOLUMES &&
|
||||
pick_mode == CLUTTER_PICK_NONE))
|
||||
if (G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_PAINT_VOLUMES))
|
||||
_clutter_actor_draw_paint_volume (self);
|
||||
|
||||
/* 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 */
|
||||
if (pick_mode == CLUTTER_PICK_NONE)
|
||||
priv->is_dirty = FALSE;
|
||||
priv->is_dirty = FALSE;
|
||||
|
||||
done:
|
||||
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);
|
||||
}
|
||||
else
|
||||
{
|
||||
_clutter_actor_pop_pick_clip (self);
|
||||
}
|
||||
cogl_framebuffer_pop_clip (fb);
|
||||
}
|
||||
|
||||
cogl_pop_matrix ();
|
||||
@ -4135,43 +4110,28 @@ clutter_actor_continue_paint (ClutterActor *self)
|
||||
actual actor */
|
||||
if (priv->next_effect_to_paint == NULL)
|
||||
{
|
||||
if (_clutter_context_get_pick_mode () == CLUTTER_PICK_NONE)
|
||||
{
|
||||
ClutterPaintNode *dummy;
|
||||
ClutterPaintNode *dummy;
|
||||
|
||||
/* XXX - this will go away in 2.0, when we can get rid of this
|
||||
* stuff and switch to a pure retained render tree of PaintNodes
|
||||
* for the entire frame, starting from the Stage; the paint()
|
||||
* virtual function can then be called directly.
|
||||
*/
|
||||
dummy = _clutter_dummy_node_new (self);
|
||||
clutter_paint_node_set_name (dummy, "Root");
|
||||
/* XXX - this will go away in 2.0, when we can get rid of this
|
||||
* stuff and switch to a pure retained render tree of PaintNodes
|
||||
* for the entire frame, starting from the Stage; the paint()
|
||||
* virtual function can then be called directly.
|
||||
*/
|
||||
dummy = _clutter_dummy_node_new (self);
|
||||
clutter_paint_node_set_name (dummy, "Root");
|
||||
|
||||
/* XXX - for 1.12, we use the return value of paint_node() to
|
||||
* decide whether we should emit the ::paint signal.
|
||||
*/
|
||||
clutter_actor_paint_node (self, dummy);
|
||||
clutter_paint_node_unref (dummy);
|
||||
/* XXX - for 1.12, we use the return value of paint_node() to
|
||||
* decide whether we should emit the ::paint signal.
|
||||
*/
|
||||
clutter_actor_paint_node (self, dummy);
|
||||
clutter_paint_node_unref (dummy);
|
||||
|
||||
/* XXX:2.0 - Call the paint() virtual directly */
|
||||
if (g_signal_has_handler_pending (self, actor_signals[PAINT],
|
||||
0, TRUE))
|
||||
g_signal_emit (self, actor_signals[PAINT], 0);
|
||||
else
|
||||
CLUTTER_ACTOR_GET_CLASS (self)->paint (self);
|
||||
}
|
||||
/* XXX:2.0 - Call the paint() virtual directly */
|
||||
if (g_signal_has_handler_pending (self, actor_signals[PAINT],
|
||||
0, TRUE))
|
||||
g_signal_emit (self, actor_signals[PAINT], 0);
|
||||
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);
|
||||
}
|
||||
CLUTTER_ACTOR_GET_CLASS (self)->paint (self);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -4185,31 +4145,20 @@ clutter_actor_continue_paint (ClutterActor *self)
|
||||
priv->current_effect = priv->next_effect_to_paint->data;
|
||||
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
|
||||
effects up to that one will be considered dirty. It
|
||||
is expected the queued effect will paint the cached
|
||||
image and not call clutter_actor_continue_paint again
|
||||
(although it should work ok if it does) */
|
||||
if (priv->effect_to_redraw == NULL ||
|
||||
priv->current_effect != priv->effect_to_redraw)
|
||||
run_flags |= CLUTTER_EFFECT_PAINT_ACTOR_DIRTY;
|
||||
}
|
||||
|
||||
_clutter_effect_paint (priv->current_effect, run_flags);
|
||||
/* If there's an effect queued with this redraw then all
|
||||
* effects up to that one will be considered dirty. It
|
||||
* is expected the queued effect will paint the cached
|
||||
* image and not call clutter_actor_continue_paint again
|
||||
* (although it should work ok if it does)
|
||||
*/
|
||||
if (priv->effect_to_redraw == NULL ||
|
||||
priv->current_effect != priv->effect_to_redraw)
|
||||
run_flags |= CLUTTER_EFFECT_PAINT_ACTOR_DIRTY;
|
||||
}
|
||||
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);
|
||||
}
|
||||
_clutter_effect_paint (priv->current_effect, run_flags);
|
||||
|
||||
priv->current_effect = old_current_effect;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user