compositor: update scissor region before using it

Subsurfaces inherit the scissor region from the parent surface. Currently
the region is updated at the end of weston_view_update_transform(). As a
result, the old region is used to clip the transform.boundingbox of the
subsurface.

Change the order to update the scissor region after the transform.matrix is
updated but before it is used.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
dev
Michael Olbrich 5 years ago committed by Daniel Stone
parent bce7450040
commit cb04f9894f
  1. 40
      libweston/compositor.c

@ -1415,6 +1415,25 @@ view_compute_bbox(struct weston_view *view, const pixman_box32_t *inbox,
ceilf(max_x) - int_x, ceilf(max_y) - int_y);
}
static void
weston_view_update_transform_scissor(struct weston_view *view,
pixman_region32_t *region)
{
struct weston_view *parent = view->geometry.parent;
if (parent) {
if (parent->geometry.scissor_enabled) {
view->geometry.scissor_enabled = true;
weston_view_transfer_scissor(parent, view);
} else {
view->geometry.scissor_enabled = false;
}
}
if (view->geometry.scissor_enabled)
pixman_region32_intersect(region, region,
&view->geometry.scissor);
}
static void
weston_view_update_transform_disable(struct weston_view *view)
{
@ -1439,10 +1458,8 @@ weston_view_update_transform_disable(struct weston_view *view)
0, 0,
view->surface->width,
view->surface->height);
if (view->geometry.scissor_enabled)
pixman_region32_intersect(&view->transform.boundingbox,
&view->transform.boundingbox,
&view->geometry.scissor);
weston_view_update_transform_scissor(view, &view->transform.boundingbox);
pixman_region32_translate(&view->transform.boundingbox,
view->geometry.x, view->geometry.y);
@ -1498,9 +1515,9 @@ weston_view_update_transform_enable(struct weston_view *view)
pixman_region32_init_rect(&surfregion, 0, 0,
view->surface->width, view->surface->height);
if (view->geometry.scissor_enabled)
pixman_region32_intersect(&surfregion, &surfregion,
&view->geometry.scissor);
weston_view_update_transform_scissor(view, &surfregion);
surfbox = pixman_region32_extents(&surfregion);
view_compute_bbox(view, surfbox, &view->transform.boundingbox);
@ -1560,15 +1577,6 @@ weston_view_update_transform(struct weston_view *view)
pixman_region32_fini(&mask);
}
if (parent) {
if (parent->geometry.scissor_enabled) {
view->geometry.scissor_enabled = true;
weston_view_transfer_scissor(parent, view);
} else {
view->geometry.scissor_enabled = false;
}
}
weston_view_damage_below(view);
weston_view_assign_output(view);

Loading…
Cancel
Save