[mutter/wayland] MetaShapedTexture: don't intersect a region with an uninitialized clip
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wayland] MetaShapedTexture: don't intersect a region with an uninitialized clip
- Date: Mon, 16 Sep 2013 09:28:56 +0000 (UTC)
commit 42a5f4f479ee2dc765286cd5654b79c79b5acfa9
Author: Giovanni Campagna <gcampagn redhat com>
Date: Mon Sep 16 11:19:56 2013 +0200
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.
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 30135d4..8253cb1 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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]