forked from enlightenment/efl
ecore-wl2: Add API function to set opaque region of a subsurface
Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
parent
475ade8bf8
commit
3e1b71b3d8
|
@ -689,6 +689,25 @@ EAPI void ecore_wl2_subsurface_place_below(Ecore_Wl2_Subsurface *subsurface, str
|
|||
*/
|
||||
EAPI void ecore_wl2_subsurface_sync_set(Ecore_Wl2_Subsurface *subsurface, Eina_Bool sync);
|
||||
|
||||
/**
|
||||
* Set an opaque region for the given subsurface.
|
||||
*
|
||||
* This is an optimization hint to the compositor to allow it avoid
|
||||
* redrawing content unnecessarily. Note that marking transparent
|
||||
* content as opaque will cause repaint artifacts.
|
||||
*
|
||||
* Use a 0x0 region size to unset the opaque region.
|
||||
*
|
||||
* @param subsurface the subsurface
|
||||
* @param x coordinate in the parent surface
|
||||
* @param y coordinate in the parent surface
|
||||
* @param w width to set as opaque
|
||||
* @param h height to set as opaque
|
||||
*
|
||||
* @ingroup Ecore_Wl2_Subsurface_Group
|
||||
*/
|
||||
EAPI void ecore_wl2_subsurface_opaque_region_set(Ecore_Wl2_Subsurface *subsurface, int x, int y, int w, int h);
|
||||
|
||||
/* # ifdef __cplusplus */
|
||||
/* } */
|
||||
/* # endif */
|
||||
|
|
|
@ -143,3 +143,35 @@ ecore_wl2_subsurface_sync_set(Ecore_Wl2_Subsurface *subsurface, Eina_Bool sync)
|
|||
else
|
||||
wl_subsurface_set_desync(subsurface->wl.subsurface);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl2_subsurface_opaque_region_set(Ecore_Wl2_Subsurface *subsurface, int x, int y, int w, int h)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN(subsurface);
|
||||
EINA_SAFETY_ON_NULL_RETURN(subsurface->wl.subsurface);
|
||||
|
||||
if ((w > 0) && (h > 0))
|
||||
{
|
||||
Ecore_Wl2_Window *parent;
|
||||
|
||||
parent = subsurface->parent;
|
||||
if (parent)
|
||||
{
|
||||
struct wl_region *region;
|
||||
|
||||
region =
|
||||
wl_compositor_create_region(parent->display->wl.compositor);
|
||||
if (!region)
|
||||
{
|
||||
ERR("Failed to create opaque region: %m");
|
||||
return;
|
||||
}
|
||||
|
||||
wl_region_add(region, x, y, w, h);
|
||||
wl_surface_set_opaque_region(subsurface->wl.surface, region);
|
||||
wl_region_destroy(region);
|
||||
}
|
||||
}
|
||||
else
|
||||
wl_surface_set_opaque_region(subsurface->wl.surface, NULL);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue