mirror of
https://github.com/brl/mutter.git
synced 2024-11-29 19:40:43 -05:00
surface-actor: Fix meta_surface_actor_is_obscured_on_stage_view
`meta_surface_actor_is_obscured_on_stage_view` currently fails to account for non-identity scaling of actor size (e.g. window actor geometry scale or surface pixel alignment). Fix this by using the new `meta_region_apply_matrix_transform_expand` to calculate the unobscured region in stage coordinates. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2726>
This commit is contained in:
parent
231729b7f2
commit
ae4755cc61
@ -395,9 +395,11 @@ meta_surface_actor_is_obscured_on_stage_view (MetaSurfaceActor *self,
|
|||||||
{
|
{
|
||||||
MetaSurfaceActorPrivate *priv =
|
MetaSurfaceActorPrivate *priv =
|
||||||
meta_surface_actor_get_instance_private (self);
|
meta_surface_actor_get_instance_private (self);
|
||||||
|
ClutterActor *stage = clutter_actor_get_stage (CLUTTER_ACTOR (self));
|
||||||
cairo_region_t *intersection_region;
|
cairo_region_t *intersection_region;
|
||||||
cairo_rectangle_int_t stage_rect;
|
cairo_rectangle_int_t stage_rect;
|
||||||
float x, y;
|
graphene_matrix_t transform;
|
||||||
|
graphene_rect_t actor_bounds;
|
||||||
float bounds_width, bounds_height;
|
float bounds_width, bounds_height;
|
||||||
float bounds_size;
|
float bounds_size;
|
||||||
int intersection_size = 0;
|
int intersection_size = 0;
|
||||||
@ -406,9 +408,11 @@ meta_surface_actor_is_obscured_on_stage_view (MetaSurfaceActor *self,
|
|||||||
if (cairo_region_is_empty (unobscured_region))
|
if (cairo_region_is_empty (unobscured_region))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
intersection_region = cairo_region_copy (unobscured_region);
|
clutter_actor_get_relative_transformation_matrix (CLUTTER_ACTOR (self),
|
||||||
clutter_actor_get_transformed_position (CLUTTER_ACTOR (self), &x, &y);
|
stage,
|
||||||
cairo_region_translate (intersection_region, x, y);
|
&transform);
|
||||||
|
|
||||||
|
intersection_region = meta_region_apply_matrix_transform_expand (unobscured_region, &transform);
|
||||||
|
|
||||||
clutter_stage_view_get_layout (stage_view, &stage_rect);
|
clutter_stage_view_get_layout (stage_view, &stage_rect);
|
||||||
cairo_region_intersect_rectangle (intersection_region,
|
cairo_region_intersect_rectangle (intersection_region,
|
||||||
@ -428,7 +432,10 @@ meta_surface_actor_is_obscured_on_stage_view (MetaSurfaceActor *self,
|
|||||||
clutter_content_get_preferred_size (CLUTTER_CONTENT (priv->texture),
|
clutter_content_get_preferred_size (CLUTTER_CONTENT (priv->texture),
|
||||||
&bounds_width,
|
&bounds_width,
|
||||||
&bounds_height);
|
&bounds_height);
|
||||||
bounds_size = bounds_width * bounds_height;
|
graphene_rect_init (&actor_bounds, 0, 0, bounds_width, bounds_height);
|
||||||
|
graphene_matrix_transform_bounds (&transform, &actor_bounds, &actor_bounds);
|
||||||
|
graphene_rect_round_extents (&actor_bounds, &actor_bounds);
|
||||||
|
bounds_size = graphene_rect_get_area (&actor_bounds);
|
||||||
|
|
||||||
n_rects = cairo_region_num_rectangles (intersection_region);
|
n_rects = cairo_region_num_rectangles (intersection_region);
|
||||||
for (i = 0; i < n_rects; i++)
|
for (i = 0; i < n_rects; i++)
|
||||||
|
Loading…
Reference in New Issue
Block a user