From 25c0ca57159b35e2d98004ee1e24e7d02c017e6d Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Thu, 19 Feb 2015 11:15:33 +0200 Subject: [PATCH] compositor: turn weston_view boundingbox into masked weston_view::transform.boundingbox is made to include the layer mask, which removes the need for masked_boundingbox. The following were using boundingbox when they should have used masked_boundingbox: - drm_output_prepare_overlay_view() uses boundingbox to compute overlay position, source and destination coordinates. - drm_assign_planes() uses boundingbox for view overlap checks. - is_view_not_visible() uses boundingbox, but nothing will show outside the layer mask. - weston_surface_assign_output() intersects boundingbox with output region to choose the primary output for a surface. - weston_view_assign_output() intersects boundingbox with output region to pick the outputs the view is on. This patch essentially changes all those cases to use the masked boundingbox. Therefore there are no cases which would need the boundingbox without the layer mask, and we can convert boundingbox into masked and remove the left-over member. Signed-off-by: Pekka Paalanen [v2: don't move the decl of 'mask' in weston_view_update_transform] Reviewed-By: Giulio Camuffo --- src/compositor.c | 11 ++++------- src/compositor.h | 1 - src/gl-renderer.c | 2 +- src/pixman-renderer.c | 2 +- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/compositor.c b/src/compositor.c index f1933f0..0cb140e 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -443,7 +443,6 @@ weston_view_create(struct weston_surface *surface) wl_list_init(&view->layer_link.link); pixman_region32_init(&view->clip); - pixman_region32_init(&view->transform.masked_boundingbox); view->alpha = 1.0; pixman_region32_init(&view->transform.opaque); @@ -964,7 +963,7 @@ weston_view_damage_below(struct weston_view *view) pixman_region32_t damage; pixman_region32_init(&damage); - pixman_region32_subtract(&damage, &view->transform.masked_boundingbox, + pixman_region32_subtract(&damage, &view->transform.boundingbox, &view->clip); if (view->plane) pixman_region32_union(&view->plane->damage, @@ -1234,8 +1233,8 @@ weston_view_update_transform(struct weston_view *view) layer = get_view_layer(view); if (layer) { pixman_region32_init_with_extents(&mask, &layer->mask); - pixman_region32_intersect(&view->transform.masked_boundingbox, - &view->transform.boundingbox, &mask); + pixman_region32_intersect(&view->transform.boundingbox, + &view->transform.boundingbox, &mask); pixman_region32_intersect(&view->transform.opaque, &view->transform.opaque, &mask); pixman_region32_fini(&mask); @@ -1538,8 +1537,7 @@ weston_compositor_pick_view(struct weston_compositor *compositor, wl_list_for_each(view, &compositor->view_list, link) { weston_view_from_global_fixed(view, x, y, vx, vy); if (pixman_region32_contains_point( - &view->transform.masked_boundingbox, - ix, iy, NULL) && + &view->transform.boundingbox, ix, iy, NULL) && pixman_region32_contains_point(&view->surface->input, wl_fixed_to_int(*vx), wl_fixed_to_int(*vy), @@ -1632,7 +1630,6 @@ weston_view_destroy(struct weston_view *view) pixman_region32_fini(&view->clip); pixman_region32_fini(&view->transform.boundingbox); - pixman_region32_fini(&view->transform.masked_boundingbox); pixman_region32_fini(&view->transform.opaque); weston_view_set_transform_parent(view, NULL); diff --git a/src/compositor.h b/src/compositor.h index f746258..e356e33 100644 --- a/src/compositor.h +++ b/src/compositor.h @@ -793,7 +793,6 @@ struct weston_view { pixman_region32_t boundingbox; pixman_region32_t opaque; - pixman_region32_t masked_boundingbox; /* matrix and inverse are used only if enabled = 1. * If enabled = 0, use x, y, width, height directly. diff --git a/src/gl-renderer.c b/src/gl-renderer.c index bb46acd..3a70c3b 100644 --- a/src/gl-renderer.c +++ b/src/gl-renderer.c @@ -604,7 +604,7 @@ draw_view(struct weston_view *ev, struct weston_output *output, pixman_region32_init(&repaint); pixman_region32_intersect(&repaint, - &ev->transform.masked_boundingbox, damage); + &ev->transform.boundingbox, damage); pixman_region32_subtract(&repaint, &repaint, &ev->clip); if (!pixman_region32_not_empty(&repaint)) diff --git a/src/pixman-renderer.c b/src/pixman-renderer.c index 530e2ed..937df8f 100644 --- a/src/pixman-renderer.c +++ b/src/pixman-renderer.c @@ -398,7 +398,7 @@ draw_view(struct weston_view *ev, struct weston_output *output, pixman_region32_init(&repaint); pixman_region32_intersect(&repaint, - &ev->transform.masked_boundingbox, damage); + &ev->transform.boundingbox, damage); pixman_region32_subtract(&repaint, &repaint, &ev->clip); if (!pixman_region32_not_empty(&repaint)) -- 2.7.4