mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 17:40:40 -05:00
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:
parent
165e117028
commit
7938458eb8
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (needs_mask)
|
||||||
|
{
|
||||||
/* This takes the region, generates a mask using GTK+
|
/* This takes the region, generates a mask using GTK+
|
||||||
* and scans the mask looking for all opaque pixels,
|
* and scans the mask looking for all opaque pixels,
|
||||||
* adding it to region.
|
* adding it to region.
|
||||||
*/
|
*/
|
||||||
build_and_scan_frame_mask (self, &borders, &client_area, region);
|
build_and_scan_frame_mask (self, &borders, &client_area, region);
|
||||||
meta_window_actor_update_shape_region (self, 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;
|
||||||
|
Loading…
Reference in New Issue
Block a user