evas: introduce a engine_new/free in gl_generic backend.
authorCedric BAIL <cedric@osg.samsung.com>
Fri, 25 Aug 2017 17:50:35 +0000 (10:50 -0700)
committerCedric BAIL <cedric@osg.samsung.com>
Fri, 25 Aug 2017 17:50:35 +0000 (10:50 -0700)
src/modules/evas/engines/gl_generic/Evas_Engine_GL_Generic.h
src/modules/evas/engines/gl_generic/evas_engine.c

index 7fdcea5..f222469 100644 (file)
@@ -8,6 +8,7 @@
 #include "../gl_common/evas_gl_core.h"
 #include "../gl_common/evas_gl_core_private.h"
 
+typedef struct _Render_Engine_GL_Generic Render_Engine_GL_Generic;
 typedef struct _Render_Output_GL_Generic Render_Output_GL_Generic;
 typedef struct _Context_3D Context_3D;
 
@@ -17,6 +18,11 @@ typedef void *(*Window_EGL_Display_Get)(Outbuf *ob);
 typedef Context_3D *(*Window_GL_Context_New)(Outbuf *ob);
 typedef void (*Window_GL_Context_Use)(Context_3D *ctx);
 
+struct _Render_Engine_GL_Generic
+{
+   Render_Engine_Software_Generic software;
+};
+
 struct _Render_Output_GL_Generic
 {
    Render_Output_Software_Generic software;
index ef9bf2a..bba3c26 100644 (file)
@@ -123,6 +123,28 @@ _context_stored_reset(void *data EINA_UNUSED, void *surface)
 #define CONTEXT_STORE(data, surface, context) _context_store(data, surface, context)
 #define CONTEXT_STORED_RESET(data, surface) _context_stored_reset(data, surface)
 
+static void *
+eng_engine_new(void)
+{
+   Render_Engine_GL_Generic *engine;
+
+   engine = calloc(1, sizeof (Render_Engine_GL_Generic));
+   if (!engine) return NULL;
+
+   return engine;
+}
+
+static void
+eng_engine_free(void *engine)
+{
+   Render_Engine_GL_Generic *e = engine;
+   Render_Output_GL_Generic *output;
+
+   EINA_LIST_FREE(e->software.outputs, output)
+     ERR("Output %p not properly cleaned before engine destruction.", output);
+   free(e);
+}
+
 static void
 eng_rectangle_draw(void *engine EINA_UNUSED, void *data, void *context, void *surface, int x, int y, int w, int h, Eina_Bool do_async EINA_UNUSED)
 {
@@ -3081,6 +3103,9 @@ module_open(Evas_Module *em)
    func = pfunc;
    /* now to override methods */
 #define ORD(f) EVAS_API_OVERRIDE(f, &func, eng_)
+   ORD(engine_new);
+   ORD(engine_free);
+
    ORD(context_clip_image_set);
    ORD(context_clip_image_unset);
    ORD(context_clip_image_get);