wayland: Don't scale input and opaque regions

Leave them at surface coordinates and let MetaSurfaceActor
and MetaShapedTexture handle the interactions between buffer
and geometry scale.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/409
This commit is contained in:
Georges Basile Stavracas Neto 2019-07-12 13:56:14 -03:00 committed by Jonas Ådahl
parent 2d7adb90c8
commit c747be84d9
2 changed files with 27 additions and 21 deletions

View File

@ -22,6 +22,7 @@
#include "clutter/clutter.h"
#include "compositor/meta-cullable.h"
#include "compositor/meta-shaped-texture-private.h"
#include "compositor/region-utils.h"
#include "meta/meta-shaped-texture.h"
typedef struct _MetaSurfaceActorPrivate
@ -249,17 +250,26 @@ meta_surface_actor_cull_out (MetaCullable *cullable,
if (opacity == 0xff)
{
cairo_region_t *scaled_opaque_region;
cairo_region_t *opaque_region;
double geometry_scale;
opaque_region = meta_shaped_texture_get_opaque_region (priv->texture);
if (opaque_region)
{
if (unobscured_region)
cairo_region_subtract (unobscured_region, opaque_region);
if (clip_region)
cairo_region_subtract (clip_region, opaque_region);
}
if (!opaque_region)
return;
clutter_actor_get_scale (CLUTTER_ACTOR (surface_actor),
&geometry_scale,
NULL);
scaled_opaque_region = meta_region_scale (opaque_region, geometry_scale);
if (unobscured_region)
cairo_region_subtract (unobscured_region, scaled_opaque_region);
if (clip_region)
cairo_region_subtract (clip_region, scaled_opaque_region);
cairo_region_destroy (scaled_opaque_region);
}
}

View File

@ -160,13 +160,12 @@ meta_wayland_actor_surface_real_sync_actor_state (MetaWaylandActorSurface *actor
if (surface->input_region)
{
cairo_region_t *scaled_input_region;
cairo_region_t *input_region;
scaled_input_region = meta_region_scale (surface->input_region,
geometry_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);
input_region = cairo_region_copy (surface->input_region);
cairo_region_intersect_rectangle (input_region, &surface_rect);
meta_surface_actor_set_input_region (surface_actor, input_region);
cairo_region_destroy (input_region);
}
else
{
@ -175,15 +174,12 @@ meta_wayland_actor_surface_real_sync_actor_state (MetaWaylandActorSurface *actor
if (surface->opaque_region)
{
cairo_region_t *scaled_opaque_region;
cairo_region_t *opaque_region;
/* Wayland surface coordinate space -> stage coordinate space */
scaled_opaque_region = meta_region_scale (surface->opaque_region,
geometry_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);
opaque_region = cairo_region_copy (surface->opaque_region);
cairo_region_intersect_rectangle (opaque_region, &surface_rect);
meta_surface_actor_set_opaque_region (surface_actor, opaque_region);
cairo_region_destroy (opaque_region);
}
else
{