background: Rename visible_region to clip_region

This does better reflect what this region is used for.

https://bugzilla.gnome.org/show_bug.cgi?id=703332
This commit is contained in:
Adel Gadllah 2013-08-27 16:30:39 +02:00 committed by Jasper St. Pierre
parent 1a7984be43
commit daba05f6a7
6 changed files with 33 additions and 34 deletions

View File

@ -6,9 +6,9 @@
#include <meta/screen.h>
#include <meta/meta-background-actor.h>
void meta_background_actor_set_visible_region (MetaBackgroundActor *self,
cairo_region_t *visible_region);
void meta_background_actor_set_clip_region (MetaBackgroundActor *self,
cairo_region_t *clip_region);
cairo_region_t *meta_background_actor_get_visible_region (MetaBackgroundActor *self);
cairo_region_t *meta_background_actor_get_clip_region (MetaBackgroundActor *self);
#endif /* META_BACKGROUND_ACTOR_PRIVATE_H */

View File

@ -44,7 +44,7 @@
struct _MetaBackgroundActorPrivate
{
cairo_region_t *visible_region;
cairo_region_t *clip_region;
};
G_DEFINE_TYPE (MetaBackgroundActor, meta_background_actor, CLUTTER_TYPE_ACTOR);
@ -54,7 +54,7 @@ meta_background_actor_dispose (GObject *object)
{
MetaBackgroundActor *self = META_BACKGROUND_ACTOR (object);
meta_background_actor_set_visible_region (self, NULL);
meta_background_actor_set_clip_region (self, NULL);
G_OBJECT_CLASS (meta_background_actor_parent_class)->dispose (object);
}
@ -167,17 +167,17 @@ meta_background_actor_new (void)
}
/**
* meta_background_actor_set_visible_region:
* meta_background_actor_set_clip_region:
* @self: a #MetaBackgroundActor
* @visible_region: (allow-none): the area of the actor (in allocate-relative
* @clip_region: (allow-none): the area of the actor (in allocate-relative
* coordinates) that is visible.
*
* Sets the area of the background that is unobscured by overlapping windows.
* This is used to optimize and only paint the visible portions.
*/
void
meta_background_actor_set_visible_region (MetaBackgroundActor *self,
cairo_region_t *visible_region)
meta_background_actor_set_clip_region (MetaBackgroundActor *self,
cairo_region_t *clip_region)
{
MetaBackgroundActorPrivate *priv;
@ -185,16 +185,16 @@ meta_background_actor_set_visible_region (MetaBackgroundActor *self,
priv = self->priv;
g_clear_pointer (&priv->visible_region,
g_clear_pointer (&priv->clip_region,
(GDestroyNotify)
cairo_region_destroy);
if (visible_region)
priv->visible_region = cairo_region_copy (visible_region);
if (clip_region)
priv->clip_region = cairo_region_copy (clip_region);
}
/**
* meta_background_actor_get_visible_region:
* meta_background_actor_get_clip_region:
* @self: a #MetaBackgroundActor
*
* Return value (transfer full): a #cairo_region_t that represents the part of
@ -202,16 +202,16 @@ meta_background_actor_set_visible_region (MetaBackgroundActor *self,
* #MetaWindowActor objects.
*/
cairo_region_t *
meta_background_actor_get_visible_region (MetaBackgroundActor *self)
meta_background_actor_get_clip_region (MetaBackgroundActor *self)
{
MetaBackgroundActorPrivate *priv = self->priv;
ClutterActorBox content_box;
cairo_rectangle_int_t content_area = { 0 };
cairo_region_t *visible_region;
cairo_region_t *clip_region;
g_return_val_if_fail (META_IS_BACKGROUND_ACTOR (self), NULL);
if (!priv->visible_region)
if (!priv->clip_region)
return NULL;
clutter_actor_get_content_box (CLUTTER_ACTOR (self), &content_box);
@ -221,8 +221,8 @@ meta_background_actor_get_visible_region (MetaBackgroundActor *self)
content_area.width = content_box.x2 - content_box.x1;
content_area.height = content_box.y2 - content_box.y1;
visible_region = cairo_region_create_rectangle (&content_area);
cairo_region_intersect (visible_region, priv->visible_region);
clip_region = cairo_region_create_rectangle (&content_area);
cairo_region_intersect (clip_region, priv->clip_region);
return visible_region;
return clip_region;
}

View File

@ -6,6 +6,6 @@
#include <meta/screen.h>
#include <meta/meta-background-group.h>
void meta_background_group_set_visible_region (MetaBackgroundGroup *self,
cairo_region_t *visible_region);
void meta_background_group_set_clip_region (MetaBackgroundGroup *self,
cairo_region_t *visible_region);
#endif /* META_BACKGROUND_GROUP_PRIVATE_H */

View File

@ -62,16 +62,16 @@ meta_background_group_init (MetaBackgroundGroup *self)
}
/**
* meta_background_group_set_visible_region:
* meta_background_group_set_clip_region:
* @self: a #MetaBackgroundGroup
* @visible_region: (allow-none): the parts of the background to paint
* @region: (allow-none): the parts of the background to paint
*
* Sets the area of the backgrounds that is unobscured by overlapping windows.
* This is used to optimize and only paint the visible portions.
*/
void
meta_background_group_set_visible_region (MetaBackgroundGroup *self,
cairo_region_t *region)
meta_background_group_set_clip_region (MetaBackgroundGroup *self,
cairo_region_t *region)
{
GList *children, *l;
@ -82,7 +82,7 @@ meta_background_group_set_visible_region (MetaBackgroundGroup *self,
if (META_IS_BACKGROUND_ACTOR (actor))
{
meta_background_actor_set_visible_region (META_BACKGROUND_ACTOR (actor), region);
meta_background_actor_set_clip_region (META_BACKGROUND_ACTOR (actor), region);
}
else if (META_IS_BACKGROUND_GROUP (actor))
{
@ -92,7 +92,7 @@ meta_background_group_set_visible_region (MetaBackgroundGroup *self,
continue;
cairo_region_translate (region, -x, -y);
meta_background_group_set_visible_region (META_BACKGROUND_GROUP (actor), region);
meta_background_group_set_clip_region (META_BACKGROUND_GROUP (actor), region);
cairo_region_translate (region, x, y);
}
}

View File

@ -412,13 +412,13 @@ meta_background_paint_content (ClutterContent *content,
*/
if (META_IS_BACKGROUND_ACTOR (actor))
{
cairo_region_t *visible_region;
visible_region = meta_background_actor_get_visible_region (META_BACKGROUND_ACTOR (actor));
cairo_region_t *clip_region;
clip_region = meta_background_actor_get_clip_region (META_BACKGROUND_ACTOR (actor));
if (visible_region != NULL)
if (clip_region != NULL)
{
cairo_region_intersect (paintable_region, visible_region);
cairo_region_destroy (visible_region);
cairo_region_intersect (paintable_region, clip_region);
cairo_region_destroy (clip_region);
}
}

View File

@ -254,7 +254,6 @@ meta_window_group_paint (ClutterActor *actor)
meta_background_group_set_clip_region (META_BACKGROUND_GROUP (child), clip_region);
else
meta_background_actor_set_clip_region (META_BACKGROUND_ACTOR (child), clip_region);
cairo_region_translate (clip_region, x, y);
}
}
@ -278,7 +277,7 @@ meta_window_group_paint (ClutterActor *actor)
else if (META_IS_BACKGROUND_ACTOR (child))
{
MetaBackgroundActor *background_actor = META_BACKGROUND_ACTOR (child);
meta_background_actor_set_visible_region (background_actor, NULL);
meta_background_actor_set_clip_region (background_actor, NULL);
}
}
}