surface-actor: Add culling offset for geometry scale

This fixes a case that was overlooked in
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1036 - when we
have a geometry scale > 1 and Wayland subsurfaces that have an offset
to their parent surface (which is often the case when the toplevel surface
includes decoration/shadows etc.), we have to add extra offset to their
opaque regions so they match their 'visible' location.

This is necessary as `meta_cullable_cull_out_children` moves the coordinate
system during culling, but does not know about geometry scale.

Also, remove the redundant check for `window_actor` - we only hit this code
path if a `window_actor` culls out its children.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1108
This commit is contained in:
Robert Mader 2020-03-06 13:42:04 +01:00
parent 1d20045247
commit 41130b08eb

View File

@ -282,7 +282,8 @@ meta_surface_actor_cull_out (MetaCullable *cullable,
MetaWindowActor *window_actor; MetaWindowActor *window_actor;
cairo_region_t *scaled_opaque_region; cairo_region_t *scaled_opaque_region;
cairo_region_t *opaque_region; cairo_region_t *opaque_region;
int geometry_scale = 1; int geometry_scale;
float x, y;
opaque_region = meta_shaped_texture_get_opaque_region (priv->texture); opaque_region = meta_shaped_texture_get_opaque_region (priv->texture);
if (opaque_region) if (opaque_region)
@ -305,12 +306,14 @@ meta_surface_actor_cull_out (MetaCullable *cullable,
return; return;
} }
window_actor = window_actor = meta_window_actor_from_actor (CLUTTER_ACTOR (surface_actor));
meta_window_actor_from_actor (CLUTTER_ACTOR (surface_actor)); geometry_scale = meta_window_actor_get_geometry_scale (window_actor);
if (window_actor) clutter_actor_get_position (CLUTTER_ACTOR (surface_actor), &x, &y);
geometry_scale = meta_window_actor_get_geometry_scale (window_actor);
cairo_region_translate (opaque_region, x, y);
scaled_opaque_region = meta_region_scale (opaque_region, geometry_scale); scaled_opaque_region = meta_region_scale (opaque_region, geometry_scale);
cairo_region_translate (scaled_opaque_region, -x, -y);
cairo_region_translate (opaque_region, -x, -y);
if (unobscured_region) if (unobscured_region)
cairo_region_subtract (unobscured_region, scaled_opaque_region); cairo_region_subtract (unobscured_region, scaled_opaque_region);