[mutter] wayland/actor-surface: Intersect input/opaque region with surface region



commit 6a92c6f83f8eb6f5be6a43b4c36ca464f4543f88
Author: Robert Mader <robert mader posteo de>
Date:   Mon Jul 2 12:22:30 2018 +0200

    wayland/actor-surface: Intersect input/opaque region with surface region
    
    As per specification
    
    > The compositor ignores the parts of the input region that
    > fall outside of the surface.
    
    > The compositor ignores the parts of the opaque region that
    > fall outside of the surface
    
    This fixes culling problems under certain conditions.

 src/wayland/meta-wayland-actor-surface.c | 8 ++++++++
 1 file changed, 8 insertions(+)
---
diff --git a/src/wayland/meta-wayland-actor-surface.c b/src/wayland/meta-wayland-actor-surface.c
index ffa7b31e9..3c60ed56e 100644
--- a/src/wayland/meta-wayland-actor-surface.c
+++ b/src/wayland/meta-wayland-actor-surface.c
@@ -140,6 +140,7 @@ meta_wayland_actor_surface_real_sync_actor_state (MetaWaylandActorSurface *actor
   MetaShapedTexture *stex;
   double actor_scale;
   GList *l;
+  cairo_rectangle_int_t surface_rect;
 
   surface_actor = priv->actor;
   stex = meta_surface_actor_get_texture (surface_actor);
@@ -147,6 +148,11 @@ meta_wayland_actor_surface_real_sync_actor_state (MetaWaylandActorSurface *actor
   actor_scale = meta_wayland_actor_surface_calculate_scale (actor_surface);
   clutter_actor_set_scale (CLUTTER_ACTOR (stex), actor_scale, actor_scale);
 
+  surface_rect = (cairo_rectangle_int_t) {
+    .width = meta_wayland_surface_get_width (surface),
+    .height = meta_wayland_surface_get_height (surface),
+  };
+
   if (surface->input_region)
     {
       cairo_region_t *scaled_input_region;
@@ -156,6 +162,7 @@ meta_wayland_actor_surface_real_sync_actor_state (MetaWaylandActorSurface *actor
       region_scale = (int) (surface->scale * actor_scale);
       scaled_input_region = meta_region_scale (surface->input_region,
                                                region_scale);
+      cairo_region_intersect_rectangle (scaled_input_region, &surface_rect);
       meta_surface_actor_set_input_region (surface_actor, scaled_input_region);
       cairo_region_destroy (scaled_input_region);
     }
@@ -171,6 +178,7 @@ meta_wayland_actor_surface_real_sync_actor_state (MetaWaylandActorSurface *actor
       /* Wayland surface coordinate space -> stage coordinate space */
       scaled_opaque_region = meta_region_scale (surface->opaque_region,
                                                 surface->scale);
+      cairo_region_intersect_rectangle (scaled_opaque_region, &surface_rect);
       meta_surface_actor_set_opaque_region (surface_actor,
                                             scaled_opaque_region);
       cairo_region_destroy (scaled_opaque_region);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]