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



commit aeda2cbcd86e7f41e451c487f6d3ddadc3860c4a
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 e3efbba2d0..6459989bc4 100644
--- a/src/wayland/meta-wayland-surface.c
+++ b/src/wayland/meta-wayland-surface.c
@@ -366,9 +366,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]