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. 46
      libweston/compositor.c

@ -1513,15 +1513,20 @@ weston_view_update_transform_disable(struct weston_view *view)
view->geometry.x, view->geometry.y); view->geometry.x, view->geometry.y);
if (view->alpha == 1.0) { if (view->alpha == 1.0) {
pixman_region32_copy(&view->transform.opaque, if (view->surface->is_opaque) {
&view->surface->opaque); pixman_region32_copy(&view->transform.opaque,
if (view->geometry.scissor_enabled) &view->transform.boundingbox);
pixman_region32_intersect(&view->transform.opaque, } else {
&view->transform.opaque, pixman_region32_copy(&view->transform.opaque,
&view->geometry.scissor); &view->surface->opaque);
pixman_region32_translate(&view->transform.opaque, if (view->geometry.scissor_enabled)
view->geometry.x, pixman_region32_intersect(&view->transform.opaque,
view->geometry.y); &view->transform.opaque,
&view->geometry.scissor);
pixman_region32_translate(&view->transform.opaque,
view->geometry.x,
view->geometry.y);
}
} }
} }
@ -1568,15 +1573,20 @@ weston_view_update_transform_enable(struct weston_view *view)
if (view->alpha == 1.0 && if (view->alpha == 1.0 &&
matrix->type == WESTON_MATRIX_TRANSFORM_TRANSLATE) { matrix->type == WESTON_MATRIX_TRANSFORM_TRANSLATE) {
pixman_region32_copy(&view->transform.opaque, if (view->surface->is_opaque) {
&view->surface->opaque); pixman_region32_copy(&view->transform.opaque,
if (view->geometry.scissor_enabled) &view->transform.boundingbox);
pixman_region32_intersect(&view->transform.opaque, } else {
&view->transform.opaque, pixman_region32_copy(&view->transform.opaque,
&view->geometry.scissor); &view->surface->opaque);
pixman_region32_translate(&view->transform.opaque, if (view->geometry.scissor_enabled)
matrix->d[12], pixman_region32_intersect(&view->transform.opaque,
matrix->d[13]); &view->transform.opaque,
&view->geometry.scissor);
pixman_region32_translate(&view->transform.opaque,
matrix->d[12],
matrix->d[13]);
}
} }
return 0; return 0;

Loading…
Cancel
Save