[mutter] background-actor: Do not copy empty clip/unobscured regions
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] background-actor: Do not copy empty clip/unobscured regions
- Date: Sat, 29 Feb 2020 19:52:47 +0000 (UTC)
commit 39a8c047d18bf0ee88f294892fb64fe82928f5b4
Author: Robert Mader <robert mader posteo de>
Date: Tue Feb 25 20:10:48 2020 +0100
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
src/compositor/meta-background-actor.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/src/compositor/meta-background-actor.c b/src/compositor/meta-background-actor.c
index 466dfc2ab..54a6fa5f4 100644
--- a/src/compositor/meta-background-actor.c
+++ b/src/compositor/meta-background-actor.c
@@ -193,7 +193,12 @@ set_clip_region (MetaBackgroundActor *self,
{
g_clear_pointer (&self->clip_region, cairo_region_destroy);
if (clip_region)
- self->clip_region = cairo_region_copy (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);
+ }
}
static void
@@ -202,7 +207,12 @@ set_unobscured_region (MetaBackgroundActor *self,
{
g_clear_pointer (&self->unobscured_region, cairo_region_destroy);
if (unobscured_region)
- self->unobscured_region = cairo_region_copy (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);
+ }
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]