compositor: turn weston_view boundingbox into masked
authorPekka Paalanen <pekka.paalanen@collabora.co.uk>
Thu, 19 Feb 2015 09:15:33 +0000 (11:15 +0200)
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>
Tue, 24 Feb 2015 07:45:55 +0000 (09:45 +0200)
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@collabora.co.uk>
[v2: don't move the decl of 'mask' in weston_view_update_transform]
Reviewed-By: Giulio Camuffo <giuliocamuffo@gmail.com>
src/compositor.c
src/compositor.h
src/gl-renderer.c
src/pixman-renderer.c

index f1933f0..0cb140e 100644 (file)
@@ -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);
index f746258..e356e33 100644 (file)
@@ -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.
index bb46acd..3a70c3b 100644 (file)
@@ -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))
index 530e2ed..937df8f 100644 (file)
@@ -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))