clutter/actor: Move paint flag to ClutterActorNode

Now that we unconditionally use ClutterActorNode to
paint ClutterActors, move the PAINT private flag to
the ClutterActorNode. This way, we can run the paint
on the actor anywhere inside the paint tree.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/890
This commit is contained in:
Georges Basile Stavracas Neto 2019-10-25 09:32:57 -03:00
parent 7193938d27
commit 03b59f9e19
2 changed files with 14 additions and 8 deletions

View File

@ -3904,9 +3904,6 @@ clutter_actor_paint (ClutterActor *self)
clutter_actor_ensure_resource_scale (self);
/* mark that we are in the paint process */
CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_IN_PAINT);
actor_node = clutter_actor_node_new (self);
root_node = clutter_paint_node_ref (actor_node);
@ -4044,7 +4041,7 @@ clutter_actor_paint (ClutterActor *self)
if (G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_REDRAWS))
_clutter_actor_paint_cull_result (self, success, result);
else if (result == CLUTTER_CULL_RESULT_OUT && success)
goto done;
return;
}
if (priv->effects == NULL)
@ -4061,10 +4058,6 @@ clutter_actor_paint (ClutterActor *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 */
priv->is_dirty = FALSE;
done:
/* paint sequence complete */
CLUTTER_UNSET_PRIVATE_FLAGS (self, CLUTTER_IN_PAINT);
}
/**

View File

@ -1102,6 +1102,10 @@ G_DEFINE_TYPE (ClutterActorNode, clutter_actor_node, CLUTTER_TYPE_PAINT_NODE)
static gboolean
clutter_actor_node_pre_draw (ClutterPaintNode *node)
{
ClutterActorNode *actor_node = CLUTTER_ACTOR_NODE (node);
CLUTTER_SET_PRIVATE_FLAGS (actor_node->actor, CLUTTER_IN_PAINT);
return TRUE;
}
@ -1113,6 +1117,14 @@ clutter_actor_node_draw (ClutterPaintNode *node)
clutter_actor_continue_paint (actor_node->actor);
}
static void
clutter_actor_node_post_draw (ClutterPaintNode *node)
{
ClutterActorNode *actor_node = CLUTTER_ACTOR_NODE (node);
CLUTTER_UNSET_PRIVATE_FLAGS (actor_node->actor, CLUTTER_IN_PAINT);
}
static JsonNode *
clutter_actor_node_serialize (ClutterPaintNode *node)
{
@ -1139,6 +1151,7 @@ clutter_actor_node_class_init (ClutterActorNodeClass *klass)
node_class = CLUTTER_PAINT_NODE_CLASS (klass);
node_class->pre_draw = clutter_actor_node_pre_draw;
node_class->draw = clutter_actor_node_draw;
node_class->post_draw = clutter_actor_node_post_draw;
node_class->serialize = clutter_actor_node_serialize;
}