From 6fbd21001b04c5183111111e50948f48aa1be44a Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Wed, 30 Jul 2014 17:09:02 +0200 Subject: [PATCH] window-actor: Base the paint volume on our children, not our shape This was wrong for subsurfaces that extend beyond the parent's shape, since the paint volume would be wrong in this case. Instead of using the shape region which can be out of date and wrong, just use the union of our children's volumes, which is a lot easier to manage. --- src/compositor/meta-window-actor.c | 33 +++++++++++++++--------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c index 5415ac31f..66a7e3c92 100644 --- a/src/compositor/meta-window-actor.c +++ b/src/compositor/meta-window-actor.c @@ -710,25 +710,16 @@ meta_window_actor_get_paint_volume (ClutterActor *actor, { MetaWindowActor *self = META_WINDOW_ACTOR (actor); MetaWindowActorPrivate *priv = self->priv; - cairo_rectangle_int_t unobscured_bounds, bounds; gboolean appears_focused = meta_window_appears_focused (priv->window); - ClutterVertex origin; /* The paint volume is computed before paint functions are called * so our bounds might not be updated yet. Force an update. */ meta_window_actor_handle_updates (self); - meta_window_actor_get_shape_bounds (self, &bounds); - - if (priv->surface) - { - if (meta_surface_actor_get_unobscured_bounds (priv->surface, &unobscured_bounds)) - gdk_rectangle_intersect (&bounds, &unobscured_bounds, &bounds); - } - if (appears_focused ? priv->focused_shadow : priv->unfocused_shadow) { cairo_rectangle_int_t shadow_bounds; + ClutterActorBox shadow_box; /* We could compute an full clip region as we do for the window * texture, but the shadow is relatively cheap to draw, and @@ -738,16 +729,24 @@ meta_window_actor_get_paint_volume (ClutterActor *actor, */ meta_window_actor_get_shadow_bounds (self, appears_focused, &shadow_bounds); - gdk_rectangle_union (&bounds, &shadow_bounds, &bounds); + shadow_box.x1 = shadow_bounds.x; + shadow_box.x2 = shadow_bounds.x + shadow_bounds.width; + shadow_box.y1 = shadow_bounds.y; + shadow_box.y2 = shadow_bounds.y + shadow_bounds.height; + + clutter_paint_volume_union_box (volume, &shadow_box); } - origin.x = bounds.x; - origin.y = bounds.y; - origin.z = 0.0f; - clutter_paint_volume_set_origin (volume, &origin); + if (priv->surface) + { + const ClutterPaintVolume *child_volume; - clutter_paint_volume_set_width (volume, bounds.width); - clutter_paint_volume_set_height (volume, bounds.height); + child_volume = clutter_actor_get_transformed_paint_volume (CLUTTER_ACTOR (priv->surface), actor); + if (!child_volume) + return FALSE; + + clutter_paint_volume_union (volume, child_volume); + } return TRUE; }