compositor: clip the opaque region with the scissor area

The opaque region is used to determine where the views underneath the current
view must be drawn. If the opaque is not clipped, then the area that is part of
the opaque region but not part of the scissor area is not drawn at all.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
This commit is contained in:
Michael Olbrich 2020-08-19 11:31:03 +02:00 committed by Daniel Stone
parent cb04f9894f
commit 0e4f097d08

View File

@ -1467,6 +1467,9 @@ weston_view_update_transform_disable(struct weston_view *view)
if (view->alpha == 1.0) {
pixman_region32_copy(&view->transform.opaque,
&view->surface->opaque);
pixman_region32_intersect(&view->transform.opaque,
&view->transform.opaque,
&view->geometry.scissor);
pixman_region32_translate(&view->transform.opaque,
view->geometry.x,
view->geometry.y);
@ -1504,15 +1507,6 @@ weston_view_update_transform_enable(struct weston_view *view)
return -1;
}
if (view->alpha == 1.0 &&
matrix->type == WESTON_MATRIX_TRANSFORM_TRANSLATE) {
pixman_region32_copy(&view->transform.opaque,
&view->surface->opaque);
pixman_region32_translate(&view->transform.opaque,
matrix->d[12],
matrix->d[13]);
}
pixman_region32_init_rect(&surfregion, 0, 0,
view->surface->width, view->surface->height);
@ -1523,6 +1517,18 @@ weston_view_update_transform_enable(struct weston_view *view)
view_compute_bbox(view, surfbox, &view->transform.boundingbox);
pixman_region32_fini(&surfregion);
if (view->alpha == 1.0 &&
matrix->type == WESTON_MATRIX_TRANSFORM_TRANSLATE) {
pixman_region32_copy(&view->transform.opaque,
&view->surface->opaque);
pixman_region32_intersect(&view->transform.opaque,
&view->transform.opaque,
&view->geometry.scissor);
pixman_region32_translate(&view->transform.opaque,
matrix->d[12],
matrix->d[13]);
}
return 0;
}