From e28a36affd1fd8a9d31d95ed09764c702b3f439d Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Mon, 14 Jan 2013 21:43:08 -0500 Subject: [PATCH] window-actor: Merge two simple methods With some recent changes to how mask textures are constructed from shapes, a helper method we made was only called in one place, allowing us to drop a reference/destroy, and remove a double clear. https://bugzilla.gnome.org/show_bug.cgi?id=679901 --- src/compositor/meta-window-actor.c | 44 ++++++++++-------------------- 1 file changed, 15 insertions(+), 29 deletions(-) diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c index 677824fac..180cfdc56 100644 --- a/src/compositor/meta-window-actor.c +++ b/src/compositor/meta-window-actor.c @@ -1577,33 +1577,6 @@ meta_window_actor_update_bounding_region_and_borders (MetaWindowActor *self, g_signal_emit (self, signals[SIZE_CHANGED], 0); } -static void -meta_window_actor_update_shape_region (MetaWindowActor *self, - cairo_region_t *region) -{ - MetaWindowActorPrivate *priv = self->priv; - - g_clear_pointer (&priv->shape_region, cairo_region_destroy); - - /* region must be non-null */ - priv->shape_region = region; - cairo_region_reference (region); - - /* Our "shape_region" is called the "bounding region" in the X Shape - * Extension Documentation. - * - * Our "bounding_region" is called the "bounding rectangle", which defines - * the shape of the window as if it the window was unshaped. - * - * The X Shape extension requires that the "bounding region" can never - * extend outside the "bounding rectangle", and says it must be implicitly - * clipped before rendering. The region we get back hasn't been clipped. - * We explicitly clip the region here. - */ - if (priv->bounding_region != NULL) - cairo_region_intersect (priv->shape_region, priv->bounding_region); -} - /** * meta_window_actor_get_obscured_region: * @self: a #MetaWindowActor @@ -2234,8 +2207,21 @@ check_needs_reshape (MetaWindowActor *self) build_and_scan_frame_mask (self, &borders, &client_area, region); } - meta_window_actor_update_shape_region (self, region); - cairo_region_destroy (region); + priv->shape_region = region; + + /* Our "shape_region" is called the "bounding region" in the X Shape + * Extension Documentation. + * + * Our "bounding_region" is called the "bounding rectangle", which defines + * the shape of the window as if it the window was unshaped. + * + * The X Shape extension requires that the "bounding region" can never + * extend outside the "bounding rectangle", and says it must be implicitly + * clipped before rendering. The region we get back hasn't been clipped. + * We explicitly clip the region here. + */ + if (priv->bounding_region != NULL) + cairo_region_intersect (priv->shape_region, priv->bounding_region); priv->needs_reshape = FALSE; meta_window_actor_invalidate_shadow (self);