diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c index 53f4c11f5..9d23a357c 100644 --- a/clutter/clutter/clutter-actor.c +++ b/clutter/clutter/clutter-actor.c @@ -643,6 +643,7 @@ #include "clutter-main.h" #include "clutter-marshal.h" #include "clutter-mutter.h" +#include "clutter-paint-context-private.h" #include "clutter-paint-nodes.h" #include "clutter-paint-node-private.h" #include "clutter-paint-volume-private.h" @@ -3594,8 +3595,9 @@ in_clone_paint (void) * means there's no point in trying to cull descendants of the current * node. */ static gboolean -cull_actor (ClutterActor *self, - ClutterCullResult *result_out) +cull_actor (ClutterActor *self, + ClutterPaintContext *paint_context, + ClutterCullResult *result_out) { ClutterActorPrivate *priv = self->priv; ClutterStage *stage; @@ -3622,10 +3624,10 @@ cull_actor (ClutterActor *self, return FALSE; } - if (cogl_get_draw_framebuffer () != _clutter_stage_get_active_framebuffer (stage)) + if (clutter_paint_context_is_drawing_off_stage (paint_context)) { CLUTTER_NOTE (CLIPPING, "Bail from cull_actor without culling (%s): " - "Current framebuffer doesn't correspond to stage", + "Drawing off stage", _clutter_actor_get_debug_name (self)); return FALSE; } @@ -4058,7 +4060,7 @@ clutter_actor_paint (ClutterActor *self, CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS))) _clutter_actor_update_last_paint_volume (self); - success = cull_actor (self, &result); + success = cull_actor (self, paint_context, &result); if (G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_REDRAWS)) _clutter_actor_paint_cull_result (self, success, result, actor_node); diff --git a/clutter/clutter/clutter-paint-context-private.h b/clutter/clutter/clutter-paint-context-private.h index 8d8986ca1..bb9118019 100644 --- a/clutter/clutter/clutter-paint-context-private.h +++ b/clutter/clutter/clutter-paint-context-private.h @@ -27,4 +27,6 @@ void clutter_paint_context_push_framebuffer (ClutterPaintContext *paint_context, void clutter_paint_context_pop_framebuffer (ClutterPaintContext *paint_context); +gboolean clutter_paint_context_is_drawing_off_stage (ClutterPaintContext *paint_context); + #endif /* CLUTTER_PAINT_CONTEXT_PRIVATE_H */ diff --git a/clutter/clutter/clutter-paint-context.c b/clutter/clutter/clutter-paint-context.c index 51f73b9a5..fe0b6a6a0 100644 --- a/clutter/clutter/clutter-paint-context.c +++ b/clutter/clutter/clutter-paint-context.c @@ -137,3 +137,19 @@ clutter_paint_context_get_stage_view (ClutterPaintContext *paint_context) { return paint_context->view; } + +/** + * clutter_paint_context_is_drawing_off_stage: (skip) + * + * Return %TRUE if the paint context is currently drawing off stage. + * This happens if there are any framebuffers pushed, and the base framebuffer + * comes from the stage view. + */ +gboolean +clutter_paint_context_is_drawing_off_stage (ClutterPaintContext *paint_context) +{ + if (g_list_length (paint_context->framebuffers) > 1) + return TRUE; + + return !paint_context->view; +}