wayland/surface: Switch order for calculating surface damage

Process surface damage in the right order, simplifying the
calculations.

No functional change intended.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2168>
This commit is contained in:
Robert Mader 2021-12-18 18:38:21 +01:00 committed by Marge Bot
parent 9fb2a2a373
commit f4717d0ac5

View File

@ -354,30 +354,28 @@ surface_process_damage (MetaWaylandSurface *surface,
/* The damage region must be in the same coordinate space as the buffer, /* The damage region must be in the same coordinate space as the buffer,
* i.e. scaled with surface->scale. */ * i.e. scaled with surface->scale. */
scaled_region = meta_region_scale (surface_region, surface->scale);
if (surface->viewport.has_src_rect) if (surface->viewport.has_src_rect)
{ {
src_rect = (graphene_rect_t) { src_rect = (graphene_rect_t) {
.origin.x = surface->viewport.src_rect.origin.x * surface->scale, .origin.x = surface->viewport.src_rect.origin.x,
.origin.y = surface->viewport.src_rect.origin.y * surface->scale, .origin.y = surface->viewport.src_rect.origin.y,
.size.width = surface->viewport.src_rect.size.width * surface->scale, .size.width = surface->viewport.src_rect.size.width,
.size.height = surface->viewport.src_rect.size.height * surface->scale .size.height = surface->viewport.src_rect.size.height
}; };
} }
else else
{ {
src_rect = (graphene_rect_t) { src_rect = (graphene_rect_t) {
.size.width = surface_rect.width * surface->scale, .size.width = surface_rect.width,
.size.height = surface_rect.height * surface->scale, .size.height = surface_rect.height
}; };
} }
viewport_region = meta_region_crop_and_scale (scaled_region, viewport_region = meta_region_crop_and_scale (surface_region,
&src_rect, &src_rect,
surface_rect.width * surface_rect.width,
surface->scale, surface_rect.height);
surface_rect.height * scaled_region = meta_region_scale (viewport_region, surface->scale);
surface->scale); transformed_region = meta_region_transform (scaled_region,
transformed_region = meta_region_transform (viewport_region,
surface->buffer_transform, surface->buffer_transform,
buffer_rect.width, buffer_rect.width,
buffer_rect.height); buffer_rect.height);