Commit 70decd5b authored by Philipp Zabel's avatar Philipp Zabel

libweston: add weston_view_is_opaque()

Use the weston_surface is_opaque property, the opaque region, and the view
alpha value to determine whether the weston_view is opaque in a specific
Signed-off-by: Philipp Zabel's avatarPhilipp Zabel <>
parent 195dadeb
......@@ -1681,6 +1681,43 @@ weston_view_is_mapped(struct weston_view *view)
return view->is_mapped;
/* Check if view is opaque in specified region
* \param view The view to check for opacity.
* \param region The region to check for opacity, in view coordinates.
* Returns true if the view is opaque in the specified region, because view
* alpha is 1.0 and either the opaque region set by the client contains the
* specified region, or the buffer pixel format or solid color is opaque.
weston_view_is_opaque(struct weston_view *ev, pixman_region32_t *region)
pixman_region32_t r;
bool ret = false;
if (ev->alpha < 1.0)
return false;
if (ev->surface->is_opaque)
return true;
if (ev->transform.dirty) {
weston_log("%s: transform dirty", __func__);
return false;
pixman_region32_subtract(&r, region, &ev->transform.opaque);
if (!pixman_region32_not_empty(&r))
ret = true;
return ret;
/* Check if a surface has a view assigned to it
* The indicator is set manually when mapping
......@@ -1868,6 +1868,9 @@ weston_view_set_mask_infinite(struct weston_view *view);
weston_view_is_mapped(struct weston_view *view);
weston_view_is_opaque(struct weston_view *ev, pixman_region32_t *region);
weston_view_schedule_repaint(struct weston_view *view);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment