clutter/actor: Use a variable to check if culling is allowed

Since we now want to check whether culling is force-disabled using a
debug flag in two places, let's factor this out into a separate
variable.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1591>
This commit is contained in:
Jonas Dreßler 2020-11-25 00:51:15 +01:00
parent 0320649a1c
commit 58930e9e1f

View File

@ -3637,6 +3637,11 @@ clutter_actor_paint (ClutterActor *self,
g_autoptr (ClutterPaintNode) root_node = NULL; g_autoptr (ClutterPaintNode) root_node = NULL;
ClutterActorPrivate *priv; ClutterActorPrivate *priv;
ClutterActorBox clip; ClutterActorBox clip;
gboolean should_cull_out = (clutter_paint_debug_flags &
(CLUTTER_DEBUG_DISABLE_CULLING |
CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS)) !=
(CLUTTER_DEBUG_DISABLE_CULLING |
CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS);
gboolean culling_inhibited; gboolean culling_inhibited;
gboolean clip_set = FALSE; gboolean clip_set = FALSE;
@ -3792,11 +3797,7 @@ clutter_actor_paint (ClutterActor *self,
* the initialization is redundant :-( */ * the initialization is redundant :-( */
ClutterCullResult result = CLUTTER_CULL_RESULT_IN; ClutterCullResult result = CLUTTER_CULL_RESULT_IN;
if (G_LIKELY ((clutter_paint_debug_flags & if (should_cull_out)
(CLUTTER_DEBUG_DISABLE_CULLING |
CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS)) !=
(CLUTTER_DEBUG_DISABLE_CULLING |
CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS)))
_clutter_actor_update_last_paint_volume (self); _clutter_actor_update_last_paint_volume (self);
success = cull_actor (self, paint_context, &result); success = cull_actor (self, paint_context, &result);
@ -3828,13 +3829,7 @@ clutter_actor_paint (ClutterActor *self,
*/ */
if (!priv->children_painted) if (!priv->children_painted)
{ {
if (!culling_inhibited && if (!culling_inhibited && !in_clone_paint () && should_cull_out)
!in_clone_paint () &&
G_LIKELY ((clutter_paint_debug_flags &
(CLUTTER_DEBUG_DISABLE_CULLING |
CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS)) !=
(CLUTTER_DEBUG_DISABLE_CULLING |
CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS)))
ensure_last_paint_volumes_updated (self); ensure_last_paint_volumes_updated (self);
} }