From d1822eb9fde9c6bd0cf194f48d1c9d3d8cf5bdeb Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Thu, 25 Jan 2018 15:13:21 -0600 Subject: [PATCH] ecore_wl2: Make the surface interface a pointer --- src/lib/ecore_wl2/ecore_wl2_private.h | 2 +- src/lib/ecore_wl2/ecore_wl2_surface.c | 33 +++++++++++++++++++-------------- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/src/lib/ecore_wl2/ecore_wl2_private.h b/src/lib/ecore_wl2/ecore_wl2_private.h index 4ed207c..67dffcd 100755 --- a/src/lib/ecore_wl2/ecore_wl2_private.h +++ b/src/lib/ecore_wl2/ecore_wl2_private.h @@ -756,7 +756,7 @@ typedef struct _Ecore_Wl2_Surface int w, h; Eina_Bool alpha : 1; - Ecore_Wl2_Surface_Interface funcs; + Ecore_Wl2_Surface_Interface *funcs; unsigned int frame_age; // TIZEN_ONLY(20171226) : evas tbm_buf backend } Ecore_Wl2_Surface; diff --git a/src/lib/ecore_wl2/ecore_wl2_surface.c b/src/lib/ecore_wl2/ecore_wl2_surface.c index c8bf2fa..f97346c 100644 --- a/src/lib/ecore_wl2/ecore_wl2_surface.c +++ b/src/lib/ecore_wl2/ecore_wl2_surface.c @@ -183,7 +183,7 @@ ecore_wl2_surface_destroy(Ecore_Wl2_Surface *surface) { EINA_SAFETY_ON_NULL_RETURN(surface); - surface->funcs.destroy(surface); + surface->funcs->destroy(surface); surface->wl2_win = NULL; free(surface); @@ -194,7 +194,7 @@ ecore_wl2_surface_reconfigure(Ecore_Wl2_Surface *surface, int w, int h, uint32_t { EINA_SAFETY_ON_NULL_RETURN(surface); - surface->funcs.reconfigure(surface, w, h, flags, force); + surface->funcs->reconfigure(surface, w, h, flags, force); } EAPI void * @@ -202,7 +202,7 @@ ecore_wl2_surface_data_get(Ecore_Wl2_Surface *surface, int *w, int *h) { EINA_SAFETY_ON_NULL_RETURN_VAL(surface, NULL); - return surface->funcs.data_get(surface, w, h); + return surface->funcs->data_get(surface, w, h); } EAPI int @@ -210,7 +210,7 @@ ecore_wl2_surface_assign(Ecore_Wl2_Surface *surface) { EINA_SAFETY_ON_NULL_RETURN_VAL(surface, 0); - return surface->funcs.assign(surface); + return surface->funcs->assign(surface); } EAPI void @@ -218,7 +218,7 @@ ecore_wl2_surface_post(Ecore_Wl2_Surface *surface, Eina_Rectangle *rects, unsign { EINA_SAFETY_ON_NULL_RETURN(surface); - surface->funcs.post(surface, rects, count); + surface->funcs->post(surface, rects, count); } EAPI void @@ -226,9 +226,20 @@ ecore_wl2_surface_flush(Ecore_Wl2_Surface *surface) { EINA_SAFETY_ON_NULL_RETURN(surface); - surface->funcs.flush(surface); + surface->funcs->flush(surface); } +static Ecore_Wl2_Surface_Interface dmabuf_smanager = +{ + .check = _evas_dmabuf_surface_check, + .destroy = _evas_dmabuf_surface_destroy, + .reconfigure = _evas_dmabuf_surface_reconfigure, + .data_get = _evas_dmabuf_surface_data_get, + .assign = _evas_dmabuf_surface_assign, + .post = _evas_dmabuf_surface_post, + .flush = _surface_flush +}; + EAPI Ecore_Wl2_Surface * ecore_wl2_surface_create(Ecore_Wl2_Window *win, Eina_Bool alpha) { @@ -251,15 +262,9 @@ ecore_wl2_surface_create(Ecore_Wl2_Window *win, Eina_Bool alpha) */ // - out->funcs.check = _evas_dmabuf_surface_check; - out->funcs.destroy = _evas_dmabuf_surface_destroy; - out->funcs.reconfigure = _evas_dmabuf_surface_reconfigure; - out->funcs.data_get = _evas_dmabuf_surface_data_get; - out->funcs.assign = _evas_dmabuf_surface_assign; - out->funcs.post = _evas_dmabuf_surface_post; - out->funcs.flush = _surface_flush; + out->funcs = &dmabuf_smanager; - if (out->funcs.check(win)) + if (out->funcs->check(win)) { win->wl2_surface = out; return out; -- 2.7.4