diff --git a/libweston/compositor.c b/libweston/compositor.c index 7fd4cc1e..39ab4807 100644 --- a/libweston/compositor.c +++ b/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);