[mutter/gnome-40] wayland/surface: Use correct default viewport for surface damage



commit d412d4444dcfcbf21a716fbf46523a1bf729c219
Author: Robert Mader <robert mader collabora com>
Date:   Sat Dec 18 21:45:52 2021 +0100

    wayland/surface: Use correct default viewport for surface damage
    
    If no viewport is set, the neutral viewport is the surface size
    without viewport destination size applied - i.e. transform and
    scale applied to the buffer size. Change it accordingly, giving
    us the same values we'd return in `get_width` in this case.
    
    As result, this only changes cases where a viewport destination
    size but no viewport source rectangle is set.
    
    The change fixes exactly such cases, e.g. the Gstreamer Wayland
    sink. Can be tested with: `gst-play-1.0 --videosink=waylandsink`.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2168>
    
    (cherry picked from commit c1668116959664f04e509130e76a18d55429ca65)

 src/wayland/meta-wayland-surface.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c
index d8a052e480..f25b9fcdc3 100644
--- a/src/wayland/meta-wayland-surface.c
+++ b/src/wayland/meta-wayland-surface.c
@@ -367,9 +367,22 @@ surface_process_damage (MetaWaylandSurface *surface,
     }
   else
     {
+      int width, height;
+
+      if (meta_monitor_transform_is_rotated (surface->buffer_transform))
+        {
+          width = get_buffer_height (surface);
+          height = get_buffer_width (surface);
+        }
+      else
+        {
+          width = get_buffer_width (surface);
+          height = get_buffer_height (surface);
+        }
+
       src_rect = (graphene_rect_t) {
-        .size.width = surface_rect.width,
-        .size.height = surface_rect.height
+        .size.width = width / surface->scale,
+        .size.height = height / surface->scale
       };
     }
   viewport_region = meta_region_crop_and_scale (surface_region,


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