compositor: set transform.opaque for surfaces without alpha channel

If surface->is_opaque is set then we can assume that the whole surface is
opaque. In the trivial case (no transformation or translation only) this means
that transform.boundingbox is exactly the view area and is fully opaque. So it
can be used for transform.opaque.

This is important because damage calculation uses transform.opaque. Without
this, anything underneath a surface without an explicit opaque region but a
pixel format without alpha channel is drawn unnecessarily.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
dev
Michael Olbrich 4 years ago committed by Daniel Stone
parent dfceb60274
commit e2426960d4
  1. 10
      libweston/compositor.c

@ -1513,6 +1513,10 @@ weston_view_update_transform_disable(struct weston_view *view)
view->geometry.x, view->geometry.y);
if (view->alpha == 1.0) {
if (view->surface->is_opaque) {
pixman_region32_copy(&view->transform.opaque,
&view->transform.boundingbox);
} else {
pixman_region32_copy(&view->transform.opaque,
&view->surface->opaque);
if (view->geometry.scissor_enabled)
@ -1523,6 +1527,7 @@ weston_view_update_transform_disable(struct weston_view *view)
view->geometry.x,
view->geometry.y);
}
}
}
static int
@ -1568,6 +1573,10 @@ weston_view_update_transform_enable(struct weston_view *view)
if (view->alpha == 1.0 &&
matrix->type == WESTON_MATRIX_TRANSFORM_TRANSLATE) {
if (view->surface->is_opaque) {
pixman_region32_copy(&view->transform.opaque,
&view->transform.boundingbox);
} else {
pixman_region32_copy(&view->transform.opaque,
&view->surface->opaque);
if (view->geometry.scissor_enabled)
@ -1578,6 +1587,7 @@ weston_view_update_transform_enable(struct weston_view *view)
matrix->d[12],
matrix->d[13]);
}
}
return 0;
}

Loading…
Cancel
Save