cullable: Factor out untransformed check into a vfunc
Some cullable implementation may have extra information about their expected size. The main example here are surface actors which can be scaled by geometry scale. Add an API to overwrite the default size / untransformed check for such cases. https://gitlab.gnome.org/GNOME/mutter/merge_requests/1036
This commit is contained in:
parent
d8b7905662
commit
56ce25360c
@ -110,23 +110,6 @@ meta_actor_vertices_are_untransformed (graphene_point3d_t *verts,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if an actor is "untransformed" - which actually means transformed by
|
|
||||||
* at most a integer-translation. The integer translation, if any, is returned.
|
|
||||||
*/
|
|
||||||
gboolean
|
|
||||||
meta_actor_is_untransformed (ClutterActor *actor,
|
|
||||||
int *x_origin,
|
|
||||||
int *y_origin)
|
|
||||||
{
|
|
||||||
gfloat widthf, heightf;
|
|
||||||
graphene_point3d_t verts[4];
|
|
||||||
|
|
||||||
clutter_actor_get_size (actor, &widthf, &heightf);
|
|
||||||
clutter_actor_get_abs_allocation_vertices (actor, verts);
|
|
||||||
|
|
||||||
return meta_actor_vertices_are_untransformed (verts, widthf, heightf, x_origin, y_origin);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* meta_actor_painting_untransformed:
|
* meta_actor_painting_untransformed:
|
||||||
* @paint_width: the width of the painted area
|
* @paint_width: the width of the painted area
|
||||||
|
@ -28,9 +28,6 @@ gboolean meta_actor_vertices_are_untransformed (graphene_point3d_t *verts,
|
|||||||
float heightf,
|
float heightf,
|
||||||
int *x_origin,
|
int *x_origin,
|
||||||
int *y_origin);
|
int *y_origin);
|
||||||
gboolean meta_actor_is_untransformed (ClutterActor *actor,
|
|
||||||
int *x_origin,
|
|
||||||
int *y_origin);
|
|
||||||
|
|
||||||
gboolean meta_actor_painting_untransformed (CoglFramebuffer *fb,
|
gboolean meta_actor_painting_untransformed (CoglFramebuffer *fb,
|
||||||
int paint_width,
|
int paint_width,
|
||||||
|
@ -100,7 +100,7 @@ meta_cullable_cull_out_children (MetaCullable *cullable,
|
|||||||
if (needs_culling && clutter_actor_has_effects (child))
|
if (needs_culling && clutter_actor_has_effects (child))
|
||||||
needs_culling = FALSE;
|
needs_culling = FALSE;
|
||||||
|
|
||||||
if (needs_culling && !meta_actor_is_untransformed (child, NULL, NULL))
|
if (needs_culling && !meta_cullable_is_untransformed (META_CULLABLE (child)))
|
||||||
needs_culling = FALSE;
|
needs_culling = FALSE;
|
||||||
|
|
||||||
if (needs_culling)
|
if (needs_culling)
|
||||||
@ -149,9 +149,23 @@ meta_cullable_reset_culling_children (MetaCullable *cullable)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
meta_cullable_default_is_untransformed (MetaCullable *cullable)
|
||||||
|
{
|
||||||
|
float width, height;
|
||||||
|
graphene_point3d_t verts[4];
|
||||||
|
|
||||||
|
clutter_actor_get_size (CLUTTER_ACTOR (cullable), &width, &height);
|
||||||
|
clutter_actor_get_abs_allocation_vertices (CLUTTER_ACTOR (cullable), verts);
|
||||||
|
|
||||||
|
return meta_actor_vertices_are_untransformed (verts, width, height,
|
||||||
|
NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_cullable_default_init (MetaCullableInterface *iface)
|
meta_cullable_default_init (MetaCullableInterface *iface)
|
||||||
{
|
{
|
||||||
|
iface->is_untransformed = meta_cullable_default_is_untransformed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -186,6 +200,19 @@ meta_cullable_cull_out (MetaCullable *cullable,
|
|||||||
META_CULLABLE_GET_IFACE (cullable)->cull_out (cullable, unobscured_region, clip_region);
|
META_CULLABLE_GET_IFACE (cullable)->cull_out (cullable, unobscured_region, clip_region);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* meta_cullable_is_untransformed:
|
||||||
|
* @cullable: The #MetaCullable
|
||||||
|
*
|
||||||
|
* Check if a cullable is "untransformed" - which actually means transformed by
|
||||||
|
* at most a integer-translation.
|
||||||
|
*/
|
||||||
|
gboolean
|
||||||
|
meta_cullable_is_untransformed (MetaCullable *cullable)
|
||||||
|
{
|
||||||
|
return META_CULLABLE_GET_IFACE (cullable)->is_untransformed (cullable);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* meta_cullable_reset_culling:
|
* meta_cullable_reset_culling:
|
||||||
* @cullable: The #MetaCullable
|
* @cullable: The #MetaCullable
|
||||||
|
@ -39,12 +39,14 @@ struct _MetaCullableInterface
|
|||||||
void (* cull_out) (MetaCullable *cullable,
|
void (* cull_out) (MetaCullable *cullable,
|
||||||
cairo_region_t *unobscured_region,
|
cairo_region_t *unobscured_region,
|
||||||
cairo_region_t *clip_region);
|
cairo_region_t *clip_region);
|
||||||
|
gboolean (* is_untransformed) (MetaCullable *cullable);
|
||||||
void (* reset_culling) (MetaCullable *cullable);
|
void (* reset_culling) (MetaCullable *cullable);
|
||||||
};
|
};
|
||||||
|
|
||||||
void meta_cullable_cull_out (MetaCullable *cullable,
|
void meta_cullable_cull_out (MetaCullable *cullable,
|
||||||
cairo_region_t *unobscured_region,
|
cairo_region_t *unobscured_region,
|
||||||
cairo_region_t *clip_region);
|
cairo_region_t *clip_region);
|
||||||
|
gboolean meta_cullable_is_untransformed (MetaCullable *cullable);
|
||||||
void meta_cullable_reset_culling (MetaCullable *cullable);
|
void meta_cullable_reset_culling (MetaCullable *cullable);
|
||||||
|
|
||||||
/* Utility methods for implementations */
|
/* Utility methods for implementations */
|
||||||
|
@ -89,7 +89,7 @@ meta_window_group_paint (ClutterActor *actor,
|
|||||||
screen_height,
|
screen_height,
|
||||||
&paint_x_origin,
|
&paint_x_origin,
|
||||||
&paint_y_origin) ||
|
&paint_y_origin) ||
|
||||||
!meta_actor_is_untransformed (actor, NULL, NULL))
|
!meta_cullable_is_untransformed (META_CULLABLE (actor)))
|
||||||
{
|
{
|
||||||
CLUTTER_ACTOR_CLASS (meta_window_group_parent_class)->paint (actor,
|
CLUTTER_ACTOR_CLASS (meta_window_group_parent_class)->paint (actor,
|
||||||
paint_context);
|
paint_context);
|
||||||
|
Loading…
Reference in New Issue
Block a user