ecore_wl2: Add API for adding damage to a window

This was done in the engine previously, but would be better as a library
function.
This commit is contained in:
Derek Foreman 2017-11-10 13:31:00 -06:00
parent f19a905261
commit abba80f3d6
2 changed files with 24 additions and 0 deletions

View File

@ -1974,6 +1974,8 @@ EAPI Eina_Bool ecore_wl2_window_resizing_get(Ecore_Wl2_Window *window);
*/
EAPI void ecore_wl2_window_update_begin(Ecore_Wl2_Window *window);
EAPI void ecore_wl2_window_damage(Ecore_Wl2_Window *window, Eina_Rectangle *rects, unsigned int count);
# endif
# undef EAPI

View File

@ -1614,3 +1614,25 @@ EAPI void ecore_wl2_window_update_begin(Ecore_Wl2_Window *window)
window->updating = EINA_TRUE;
}
EAPI void ecore_wl2_window_damage(Ecore_Wl2_Window *window, Eina_Rectangle *rects, unsigned int count)
{
void (*damage)(struct wl_surface *, int32_t, int32_t, int32_t, int32_t);
unsigned int k;
int compositor_version;
EINA_SAFETY_ON_NULL_RETURN(window);
compositor_version = window->display->wl.compositor_version;
if (compositor_version >= WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION)
damage = wl_surface_damage_buffer;
else
damage = wl_surface_damage;
if ((rects) && (count > 0))
for (k = 0; k < count; k++)
damage(window->surface, rects[k].x, rects[k].y, rects[k].w, rects[k].h);
else
damage(window->surface, 0, 0, INT_MAX, INT_MAX);
}