mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 09:30:45 -05:00
background-actor: Do not copy empty clip/unobscured regions
Clip and unobscured regions stricly shrink during culling. If they are already empty, simply reference the empty region to reduce allocations. https://gitlab.gnome.org/GNOME/mutter/merge_requests/1082
This commit is contained in:
parent
c979cd95aa
commit
39a8c047d1
@ -193,8 +193,13 @@ set_clip_region (MetaBackgroundActor *self,
|
|||||||
{
|
{
|
||||||
g_clear_pointer (&self->clip_region, cairo_region_destroy);
|
g_clear_pointer (&self->clip_region, cairo_region_destroy);
|
||||||
if (clip_region)
|
if (clip_region)
|
||||||
|
{
|
||||||
|
if (cairo_region_is_empty (clip_region))
|
||||||
|
self->clip_region = cairo_region_reference (clip_region);
|
||||||
|
else
|
||||||
self->clip_region = cairo_region_copy (clip_region);
|
self->clip_region = cairo_region_copy (clip_region);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_unobscured_region (MetaBackgroundActor *self,
|
set_unobscured_region (MetaBackgroundActor *self,
|
||||||
@ -202,8 +207,13 @@ set_unobscured_region (MetaBackgroundActor *self,
|
|||||||
{
|
{
|
||||||
g_clear_pointer (&self->unobscured_region, cairo_region_destroy);
|
g_clear_pointer (&self->unobscured_region, cairo_region_destroy);
|
||||||
if (unobscured_region)
|
if (unobscured_region)
|
||||||
|
{
|
||||||
|
if (cairo_region_is_empty (unobscured_region))
|
||||||
|
self->unobscured_region = cairo_region_reference (unobscured_region);
|
||||||
|
else
|
||||||
self->unobscured_region = cairo_region_copy (unobscured_region);
|
self->unobscured_region = cairo_region_copy (unobscured_region);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_background_actor_dispose (GObject *object)
|
meta_background_actor_dispose (GObject *object)
|
||||||
|
Loading…
Reference in New Issue
Block a user