window-actor: Don't create a mask texture unnecessarily

Mask texture resources may be expensive. Don't create one
if we don't need to, like on an unshaped window without
a frame.

https://bugzilla.gnome.org/show_bug.cgi?id=681676
This commit is contained in:
Jasper St. Pierre 2012-08-12 18:02:06 -03:00
parent 165e117028
commit 7938458eb8

View File

@ -2219,6 +2219,7 @@ check_needs_reshape (MetaWindowActor *self)
MetaFrameBorders borders; MetaFrameBorders borders;
cairo_region_t *region = NULL; cairo_region_t *region = NULL;
cairo_rectangle_int_t client_area; cairo_rectangle_int_t client_area;
gboolean needs_mask;
if (!priv->needs_reshape) if (!priv->needs_reshape)
return; return;
@ -2270,6 +2271,8 @@ check_needs_reshape (MetaWindowActor *self)
} }
#endif #endif
needs_mask = (region != NULL) || (priv->window->frame != NULL);
if (region == NULL) if (region == NULL)
{ {
/* If we don't have a shape on the server, that means that /* If we don't have a shape on the server, that means that
@ -2278,13 +2281,16 @@ check_needs_reshape (MetaWindowActor *self)
region = cairo_region_create_rectangle (&client_area); region = cairo_region_create_rectangle (&client_area);
} }
/* This takes the region, generates a mask using GTK+ if (needs_mask)
* and scans the mask looking for all opaque pixels, {
* adding it to region. /* This takes the region, generates a mask using GTK+
*/ * and scans the mask looking for all opaque pixels,
build_and_scan_frame_mask (self, &borders, &client_area, region); * adding it to region.
meta_window_actor_update_shape_region (self, region); */
build_and_scan_frame_mask (self, &borders, &client_area, region);
}
meta_window_actor_update_shape_region (self, region);
cairo_region_destroy (region); cairo_region_destroy (region);
priv->needs_reshape = FALSE; priv->needs_reshape = FALSE;