diff options
author | Giovanni Campagna <gcampagn@redhat.com> | 2013-09-16 11:19:56 +0200 |
---|---|---|
committer | Giovanni Campagna <gcampagn@redhat.com> | 2013-09-16 11:28:12 +0200 |
commit | 42a5f4f479ee2dc765286cd5654b79c79b5acfa9 (patch) | |
tree | 0e0cba45e7b72fd7a22407b055df36b2294deea7 /src | |
parent | 6c1feedbdfb10cd4427c42f76c671b39036040e6 (diff) | |
download | mutter-42a5f4f479ee2dc765286cd5654b79c79b5acfa9.tar.gz |
MetaShapedTexture: don't intersect a region with an uninitialized clip
If we skip getting the clip rectangle because we don't have an
allocation or a texture, don't intersect with the visible region.
This avoids a pixman warning of an invalid rectangle.
Reviewed by drago01 in IRC.
Diffstat (limited to 'src')
-rw-r--r-- | src/compositor/meta-shaped-texture.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/compositor/meta-shaped-texture.c b/src/compositor/meta-shaped-texture.c index 30135d4f6..8253cb1f6 100644 --- a/src/compositor/meta-shaped-texture.c +++ b/src/compositor/meta-shaped-texture.c @@ -691,7 +691,7 @@ wayland_surface_update_area (MetaShapedTexture *stex, } } -static void +static gboolean get_clip (MetaShapedTexture *stex, int x, int y, @@ -717,15 +717,12 @@ get_clip (MetaShapedTexture *stex, * it here. */ if (!clutter_actor_has_allocation (self)) - { - clutter_actor_queue_redraw (self); - return; - } + return FALSE; priv = stex->priv; if (priv->tex_width == 0 || priv->tex_height == 0) - return; + return FALSE; clutter_actor_get_allocation_box (self, &allocation); @@ -736,6 +733,8 @@ get_clip (MetaShapedTexture *stex, clip->y = y * scale_y; clip->width = width * scale_x; clip->height = height * scale_y; + + return TRUE; } /** @@ -766,6 +765,7 @@ meta_shaped_texture_update_area (MetaShapedTexture *stex, { MetaShapedTexturePrivate *priv; cairo_rectangle_int_t clip; + gboolean has_clip; priv = stex->priv; @@ -785,7 +785,7 @@ meta_shaped_texture_update_area (MetaShapedTexture *stex, meta_texture_tower_update_area (priv->paint_tower, x, y, width, height); - get_clip (stex, x, y, width, height, &clip); + has_clip = get_clip (stex, x, y, width, height, &clip); if (unobscured_region) { @@ -795,7 +795,8 @@ meta_shaped_texture_update_area (MetaShapedTexture *stex, return FALSE; intersection = cairo_region_copy (unobscured_region); - cairo_region_intersect_rectangle (intersection, &clip); + if (has_clip) + cairo_region_intersect_rectangle (intersection, &clip); if (!cairo_region_is_empty (intersection)) { @@ -812,7 +813,10 @@ meta_shaped_texture_update_area (MetaShapedTexture *stex, return FALSE; } - clutter_actor_queue_redraw_with_clip (CLUTTER_ACTOR (stex), &clip); + if (has_clip) + clutter_actor_queue_redraw_with_clip (CLUTTER_ACTOR (stex), &clip); + else + clutter_actor_queue_redraw (CLUTTER_ACTOR (stex)); return TRUE; } |