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>
This commit is contained in:
Robert Mader 2021-12-18 21:45:52 +01:00 committed by Marge Bot
parent f4717d0ac5
commit c166811695

View File

@ -365,9 +365,22 @@ surface_process_damage (MetaWaylandSurface *surface,
} }
else 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) { src_rect = (graphene_rect_t) {
.size.width = surface_rect.width, .size.width = width / surface->scale,
.size.height = surface_rect.height .size.height = height / surface->scale
}; };
} }
viewport_region = meta_region_crop_and_scale (surface_region, viewport_region = meta_region_crop_and_scale (surface_region,