mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
window-actor: Don't pass around client_area
To solve a performance regression, the three update_*_region calls are going to be split up, so just call get_client_area_rect in the methods itself.
This commit is contained in:
parent
ad43cbd70b
commit
7253a5d274
@ -1974,16 +1974,18 @@ build_and_scan_frame_mask (MetaWindowActor *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_window_actor_update_shape_region (MetaWindowActor *self,
|
meta_window_actor_update_shape_region (MetaWindowActor *self)
|
||||||
cairo_rectangle_int_t *client_area)
|
|
||||||
{
|
{
|
||||||
MetaWindowActorPrivate *priv = self->priv;
|
MetaWindowActorPrivate *priv = self->priv;
|
||||||
cairo_region_t *region = NULL;
|
cairo_region_t *region = NULL;
|
||||||
|
cairo_rectangle_int_t client_area;
|
||||||
|
|
||||||
|
meta_window_get_client_area_rect (priv->window, &client_area);
|
||||||
|
|
||||||
if (priv->window->frame != NULL && priv->window->shape_region != NULL)
|
if (priv->window->frame != NULL && priv->window->shape_region != NULL)
|
||||||
{
|
{
|
||||||
region = cairo_region_copy (priv->window->shape_region);
|
region = cairo_region_copy (priv->window->shape_region);
|
||||||
cairo_region_translate (region, client_area->x, client_area->y);
|
cairo_region_translate (region, client_area.x, client_area.y);
|
||||||
}
|
}
|
||||||
else if (priv->window->shape_region != NULL)
|
else if (priv->window->shape_region != NULL)
|
||||||
{
|
{
|
||||||
@ -1994,12 +1996,12 @@ meta_window_actor_update_shape_region (MetaWindowActor *self,
|
|||||||
/* 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
|
||||||
* we have an implicit shape of one rectangle covering the
|
* we have an implicit shape of one rectangle covering the
|
||||||
* entire window. */
|
* entire window. */
|
||||||
region = cairo_region_create_rectangle (client_area);
|
region = cairo_region_create_rectangle (&client_area);
|
||||||
}
|
}
|
||||||
|
|
||||||
meta_shaped_texture_set_mask_texture (META_SHAPED_TEXTURE (priv->actor), NULL);
|
meta_shaped_texture_set_mask_texture (META_SHAPED_TEXTURE (priv->actor), NULL);
|
||||||
if ((priv->window->shape_region != NULL) || (priv->window->frame != NULL))
|
if ((priv->window->shape_region != NULL) || (priv->window->frame != NULL))
|
||||||
build_and_scan_frame_mask (self, client_area, region);
|
build_and_scan_frame_mask (self, &client_area, region);
|
||||||
|
|
||||||
g_clear_pointer (&priv->shape_region, cairo_region_destroy);
|
g_clear_pointer (&priv->shape_region, cairo_region_destroy);
|
||||||
priv->shape_region = region;
|
priv->shape_region = region;
|
||||||
@ -2010,24 +2012,26 @@ meta_window_actor_update_shape_region (MetaWindowActor *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_window_actor_update_input_region (MetaWindowActor *self,
|
meta_window_actor_update_input_region (MetaWindowActor *self)
|
||||||
cairo_rectangle_int_t *client_area)
|
|
||||||
{
|
{
|
||||||
MetaWindowActorPrivate *priv = self->priv;
|
MetaWindowActorPrivate *priv = self->priv;
|
||||||
MetaShapedTexture *stex = META_SHAPED_TEXTURE (priv->actor);
|
MetaShapedTexture *stex = META_SHAPED_TEXTURE (priv->actor);
|
||||||
cairo_region_t *region = NULL;
|
cairo_region_t *region = NULL;
|
||||||
|
cairo_rectangle_int_t client_area;
|
||||||
|
|
||||||
|
meta_window_get_client_area_rect (priv->window, &client_area);
|
||||||
|
|
||||||
if (priv->window->frame != NULL && priv->window->input_region != NULL)
|
if (priv->window->frame != NULL && priv->window->input_region != NULL)
|
||||||
{
|
{
|
||||||
region = meta_frame_get_frame_bounds (priv->window->frame);
|
region = meta_frame_get_frame_bounds (priv->window->frame);
|
||||||
|
|
||||||
cairo_region_subtract_rectangle (region, client_area);
|
cairo_region_subtract_rectangle (region, &client_area);
|
||||||
|
|
||||||
/* input_region is in client window coordinates, so translate the
|
/* input_region is in client window coordinates, so translate the
|
||||||
* input region into that coordinate system and back */
|
* input region into that coordinate system and back */
|
||||||
cairo_region_translate (region, -client_area->x, -client_area->y);
|
cairo_region_translate (region, -client_area.x, -client_area.y);
|
||||||
cairo_region_union (region, priv->window->input_region);
|
cairo_region_union (region, priv->window->input_region);
|
||||||
cairo_region_translate (region, client_area->x, client_area->y);
|
cairo_region_translate (region, client_area.x, client_area.y);
|
||||||
}
|
}
|
||||||
else if (priv->window->input_region != NULL)
|
else if (priv->window->input_region != NULL)
|
||||||
{
|
{
|
||||||
@ -2038,7 +2042,7 @@ meta_window_actor_update_input_region (MetaWindowActor *self,
|
|||||||
/* 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
|
||||||
* we have an implicit shape of one rectangle covering the
|
* we have an implicit shape of one rectangle covering the
|
||||||
* entire window. */
|
* entire window. */
|
||||||
region = cairo_region_create_rectangle (client_area);
|
region = cairo_region_create_rectangle (&client_area);
|
||||||
}
|
}
|
||||||
|
|
||||||
meta_shaped_texture_set_input_shape_region (stex, region);
|
meta_shaped_texture_set_input_shape_region (stex, region);
|
||||||
@ -2084,15 +2088,12 @@ static void
|
|||||||
check_needs_reshape (MetaWindowActor *self)
|
check_needs_reshape (MetaWindowActor *self)
|
||||||
{
|
{
|
||||||
MetaWindowActorPrivate *priv = self->priv;
|
MetaWindowActorPrivate *priv = self->priv;
|
||||||
cairo_rectangle_int_t client_area;
|
|
||||||
|
|
||||||
if (!priv->needs_reshape)
|
if (!priv->needs_reshape)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
meta_window_get_client_area_rect (window, &client_area);
|
meta_window_actor_update_shape_region (self);
|
||||||
|
meta_window_actor_update_input_region (self);
|
||||||
meta_window_actor_update_shape_region (self, &client_area);
|
|
||||||
meta_window_actor_update_input_region (self, &client_area);
|
|
||||||
meta_window_actor_update_opaque_region (self);
|
meta_window_actor_update_opaque_region (self);
|
||||||
|
|
||||||
priv->needs_reshape = FALSE;
|
priv->needs_reshape = FALSE;
|
||||||
|
Loading…
Reference in New Issue
Block a user