[PATCH weston 3/3] compositor: turn weston_view boundingbox into masked
Pekka Paalanen
ppaalanen at gmail.com
Thu Feb 19 01:27:48 PST 2015
From: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
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 <pekka.paalanen at collabora.co.uk>
Cc: Giulio Camuffo <giuliocamuffo at gmail.com>
---
src/compositor.c | 14 ++++++--------
src/compositor.h | 1 -
src/gl-renderer.c | 2 +-
src/pixman-renderer.c | 2 +-
4 files changed, 8 insertions(+), 11 deletions(-)
diff --git a/src/compositor.c b/src/compositor.c
index 70a7768..fdafcaf 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,
@@ -1203,7 +1202,6 @@ weston_view_update_transform(struct weston_view *view)
{
struct weston_view *parent = view->geometry.parent;
struct weston_layer *layer;
- pixman_region32_t mask;
if (!view->transform.dirty)
return;
@@ -1233,9 +1231,11 @@ weston_view_update_transform(struct weston_view *view)
layer = get_view_layer(view);
if (layer) {
+ pixman_region32_t mask;
+
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 +1538,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 +1631,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.0.5
More information about the wayland-devel
mailing list