summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2017-11-10 13:31:00 -0600
committerDerek Foreman <derekf@osg.samsung.com>2017-11-10 13:43:45 -0600
commitabba80f3d6bea27c17ec508cd54f5f867238d315 (patch)
treedfeb3727150900e2da48e7d4e4b53b71eb02aa1a /src
parentf19a905261c6b02f788ce7b5167223555d324712 (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/lib/ecore_wl2/Ecore_Wl2.h2
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_window.c22
2 files changed, 24 insertions, 0 deletions
diff --git a/src/lib/ecore_wl2/Ecore_Wl2.h b/src/lib/ecore_wl2/Ecore_Wl2.h
index 1b15e29d58..a9a3da232d 100644
--- a/src/lib/ecore_wl2/Ecore_Wl2.h
+++ b/src/lib/ecore_wl2/Ecore_Wl2.h
@@ -1974,6 +1974,8 @@ EAPI Eina_Bool ecore_wl2_window_resizing_get(Ecore_Wl2_Window *window);
1974 */ 1974 */
1975EAPI void ecore_wl2_window_update_begin(Ecore_Wl2_Window *window); 1975EAPI void ecore_wl2_window_update_begin(Ecore_Wl2_Window *window);
1976 1976
1977EAPI void ecore_wl2_window_damage(Ecore_Wl2_Window *window, Eina_Rectangle *rects, unsigned int count);
1978
1977# endif 1979# endif
1978 1980
1979# undef EAPI 1981# undef EAPI
diff --git a/src/lib/ecore_wl2/ecore_wl2_window.c b/src/lib/ecore_wl2/ecore_wl2_window.c
index c64298f418..96988f7d44 100644
--- a/src/lib/ecore_wl2/ecore_wl2_window.c
+++ b/src/lib/ecore_wl2/ecore_wl2_window.c
@@ -1614,3 +1614,25 @@ EAPI void ecore_wl2_window_update_begin(Ecore_Wl2_Window *window)
1614 1614
1615 window->updating = EINA_TRUE; 1615 window->updating = EINA_TRUE;
1616} 1616}
1617
1618EAPI void ecore_wl2_window_damage(Ecore_Wl2_Window *window, Eina_Rectangle *rects, unsigned int count)
1619{
1620 void (*damage)(struct wl_surface *, int32_t, int32_t, int32_t, int32_t);
1621 unsigned int k;
1622 int compositor_version;
1623
1624 EINA_SAFETY_ON_NULL_RETURN(window);
1625
1626 compositor_version = window->display->wl.compositor_version;
1627
1628 if (compositor_version >= WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION)
1629 damage = wl_surface_damage_buffer;
1630 else
1631 damage = wl_surface_damage;
1632
1633 if ((rects) && (count > 0))
1634 for (k = 0; k < count; k++)
1635 damage(window->surface, rects[k].x, rects[k].y, rects[k].w, rects[k].h);
1636 else
1637 damage(window->surface, 0, 0, INT_MAX, INT_MAX);
1638}