mirror of
https://github.com/brl/mutter.git
synced 2025-02-16 13:24:09 +00:00
surface-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
6831f2edb4
commit
c979cd95aa
@ -102,6 +102,12 @@ set_unobscured_region (MetaSurfaceActor *surface_actor,
|
|||||||
|
|
||||||
g_clear_pointer (&priv->unobscured_region, cairo_region_destroy);
|
g_clear_pointer (&priv->unobscured_region, cairo_region_destroy);
|
||||||
if (unobscured_region)
|
if (unobscured_region)
|
||||||
|
{
|
||||||
|
if (cairo_region_is_empty (unobscured_region))
|
||||||
|
{
|
||||||
|
priv->unobscured_region = cairo_region_reference (unobscured_region);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
cairo_rectangle_int_t bounds = { 0, };
|
cairo_rectangle_int_t bounds = { 0, };
|
||||||
float width, height;
|
float width, height;
|
||||||
@ -120,6 +126,7 @@ set_unobscured_region (MetaSurfaceActor *surface_actor,
|
|||||||
cairo_region_intersect_rectangle (priv->unobscured_region, &bounds);
|
cairo_region_intersect_rectangle (priv->unobscured_region, &bounds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_clip_region (MetaSurfaceActor *surface_actor,
|
set_clip_region (MetaSurfaceActor *surface_actor,
|
||||||
@ -130,8 +137,13 @@ set_clip_region (MetaSurfaceActor *surface_actor,
|
|||||||
|
|
||||||
g_clear_pointer (&priv->clip_region, cairo_region_destroy);
|
g_clear_pointer (&priv->clip_region, cairo_region_destroy);
|
||||||
if (clip_region)
|
if (clip_region)
|
||||||
|
{
|
||||||
|
if (cairo_region_is_empty (clip_region))
|
||||||
|
priv->clip_region = cairo_region_reference (clip_region);
|
||||||
|
else
|
||||||
priv->clip_region = get_scaled_region (surface_actor, clip_region);
|
priv->clip_region = get_scaled_region (surface_actor, clip_region);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_surface_actor_paint (ClutterActor *actor,
|
meta_surface_actor_paint (ClutterActor *actor,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user