efl/ecore_evas: merge buffer into core, split extn apart.
authorGustavo Sverzut Barbieri <barbieri@gmail.com>
Fri, 11 Jan 2013 16:57:21 +0000 (16:57 +0000)
committerGustavo Sverzut Barbieri <barbieri@gmail.com>
Fri, 11 Jan 2013 16:57:21 +0000 (16:57 +0000)
buffer is lightweight and dependency for many engines, merge it back
into core.

extn is a module on its own, and it's the only one linking to
ecore_ipc, no need to add that to ecore_evas.

minor cosmetic changes to configure to make output consistent.

SVN revision: 82648

configure.ac
src/Makefile_Ecore_Evas.am
src/lib/ecore_evas/ecore_evas.c
src/lib/ecore_evas/ecore_evas_buffer.c [moved from src/modules/ecore_evas/engines/buffer/ecore_evas_buffer.c with 91% similarity]
src/lib/ecore_evas/ecore_evas_buffer.h [moved from src/modules/ecore_evas/engines/buffer/ecore_evas_buffer_private.h with 100% similarity]
src/lib/ecore_evas/ecore_evas_private.h
src/modules/ecore_evas/engines/extn/ecore_evas_extn.c [moved from src/modules/ecore_evas/engines/buffer/ecore_evas_extn.c with 99% similarity]

index 3d6109a..f205551 100644 (file)
@@ -2835,7 +2835,6 @@ EFL_LIB_START([Ecore_Evas])
 ### Default values
 
 have_ecore_evas="yes"
-have_extn="yes"
 
 want_ecore_evas_software_gdi="${have_evas_engine_software_gdi}"
 want_ecore_evas_software_ddraw="${have_evas_engine_software_ddraw}"
@@ -2843,7 +2842,9 @@ want_ecore_evas_gl_cocoa="${have_evas_engine_gl_cocoa}"
 want_ecore_evas_wayland_egl="${have_evas_engine_wayland_egl}"
 want_ecore_evas_extn="yes"
 
-if test "${have_windows}" = "yes"; then
+if test "x${have_ecore_ipc}" = "xno" || \
+   test "x${efl_func_shm_open}" = "xno" || \
+   test "x${have_windows}" = "xyes" ; then
    want_ecore_evas_extn="no"
 fi
 
@@ -2857,8 +2858,7 @@ EFL_INTERNAL_DEPEND_PKG([ECORE_EVAS], [evas])
 EFL_INTERNAL_DEPEND_PKG([ECORE_EVAS], [eina])
 
 ## modules
-
-ECORE_EVAS_MODULE([buffer], [static])
+ECORE_EVAS_MODULE([extn], [${want_ecore_evas_extn}])
 ECORE_EVAS_MODULE([ews], [yes])
 ECORE_EVAS_MODULE([fb], [${want_fb}])
 ECORE_EVAS_MODULE([psl1ght], [${have_ps3}])
@@ -2901,24 +2901,6 @@ fi
 AM_CONDITIONAL([BUILD_ECORE_EVAS_WIN32],
    [test "${build_ecore_evas_win32}" = "yes"])
 
-# XXX TODO: ecore_evas_extn
-
-if test "x${have_ecore_ipc}" = "xno" || \
-   test "x${have_ecore_evas_software_buffer}" = "xno" || \
-   test "x${have_shm_open}" = "xno" || \
-   test "x${have_windows}" = "xyes" ; then
-   have_extn="no"
-fi
-
-dnl THIS IS SPECIAL - dont use normal ECORE_EVAS_CHECK_MODULE
-have_ecore_evas_extn="no"
-if test "x${want_ecore_evas_extn}" = "xyes" && \
-   test "x${have_extn}" = "xyes" && \
-   test "x${have_ecore_evas}" = "xyes"; then
-   have_ecore_evas_extn="yes"
-   AC_DEFINE([BUILD_ECORE_EVAS_EXTN], [1], [Support for Extn Engine in Ecore_Evas])
-fi
-
 
 # XXX TODO: ecore_evas_x11
 
@@ -3663,14 +3645,14 @@ fi
 
 echo "  Ecore_Evas...................: $have_ecore_evas"
 #if test "x${have_ecore_evas}" = "xyes" ; then
-  echo "    Software X11...............: ${with_x11}"
-  echo "    OpenGL X11.................: ${with_x11} (opengl=${with_opengl})"
+  echo "    Software X11...............: $have_ecore_evas_software_x11"
+  echo "    OpenGL X11.................: $have_ecore_evas_opengl_x11 (opengl=${with_opengl})"
   echo "    Software GDI...............: $have_ecore_evas_software_gdi"
   echo "    Software DirectDraw........: $have_ecore_evas_software_ddraw"
   echo "    Software SDL...............: $have_ecore_evas_software_sdl"
   echo "    OpenGL SDL.................: $have_ecore_evas_opengl_sdl"
   echo "    OpenGL Cocoa...............: $have_ecore_evas_opengl_cocoa"
-  echo "    PSL1GHT....................: $have_ps3"
+  echo "    PSL1GHT....................: $have_ecore_evas_psl1ght"
   echo "    Software Framebuffer.......: $have_ecore_evas_fb"
   echo "    Sing.Proc. Windowing System: $have_ecore_evas_ews"
   echo "    Wayland Shm................: $have_ecore_evas_wayland_shm"
index 79875e0..62cea7f 100644 (file)
@@ -10,11 +10,13 @@ lib/ecore_evas/Ecore_Evas.h
 
 lib_ecore_evas_libecore_evas_la_SOURCES = \
 lib/ecore_evas/ecore_evas.c \
+lib/ecore_evas/ecore_evas_buffer.c \
+lib/ecore_evas/ecore_evas_buffer.h \
 lib/ecore_evas/ecore_evas_deprecated.c \
 lib/ecore_evas/ecore_evas_ews.c \
-lib/ecore_evas/ecore_evas_util.c \
 lib/ecore_evas/ecore_evas_module.c \
-lib/ecore_evas/ecore_evas_private.h
+lib/ecore_evas/ecore_evas_private.h \
+lib/ecore_evas/ecore_evas_util.c
 
 lib_ecore_evas_libecore_evas_la_CPPFLAGS = \
 -I$(top_srcdir)/src/lib/eina \
@@ -37,7 +39,6 @@ lib_ecore_evas_libecore_evas_la_CPPFLAGS = \
 lib_ecore_evas_libecore_evas_la_LIBADD = \
 lib/ecore_input/libecore_input_evas.la \
 lib/ecore_input/libecore_input.la \
-lib/ecore_ipc/libecore_ipc.la \
 lib/ecore/libecore.la \
 lib/evas/libevas.la \
 lib/eo/libeo.la \
@@ -50,18 +51,16 @@ lib_ecore_evas_libecore_evas_la_LDFLAGS = @EFL_LTLIBRARY_FLAGS@
 
 # Engines
 
-if BUILD_ECORE_EVAS_BUFFER
-BUFFERSOURCES = \
-modules/ecore_evas/engines/buffer/ecore_evas_buffer.c \
-modules/ecore_evas/engines/buffer/ecore_evas_extn.c \
-modules/ecore_evas/engines/buffer/ecore_evas_buffer_private.h
-ecoreevasenginebufferpkgdir = $(libdir)/ecore_evas/engines/buffer/$(MODULE_ARCH)
-ecoreevasenginebufferpkg_LTLIBRARIES = modules/ecore_evas/engines/buffer/module.la
-modules_ecore_evas_engines_buffer_module_la_SOURCES = $(BUFFERSOURCES)
-modules_ecore_evas_engines_buffer_module_la_CPPFLAGS = $(lib_ecore_evas_libecore_evas_la_CPPFLAGS)
-modules_ecore_evas_engines_buffer_module_la_LIBADD = lib/ecore_ipc/libecore_ipc.la  lib/ecore_evas/libecore_evas.la
-modules_ecore_evas_engines_buffer_module_la_LDFLAGS = -module @EFL_LTMODULE_FLAGS@
-modules_ecore_evas_engines_buffer_module_la_LIBTOOLFLAGS = --tag=disable-static
+if BUILD_ECORE_EVAS_EXTN
+EXTNSOURCES = \
+modules/ecore_evas/engines/extn/ecore_evas_extn.c
+ecoreevasengineextnpkgdir = $(libdir)/ecore_evas/engines/extn/$(MODULE_ARCH)
+ecoreevasengineextnpkg_LTLIBRARIES = modules/ecore_evas/engines/extn/module.la
+modules_ecore_evas_engines_extn_module_la_SOURCES = $(EXTNSOURCES)
+modules_ecore_evas_engines_extn_module_la_CPPFLAGS = $(lib_ecore_evas_libecore_evas_la_CPPFLAGS)
+modules_ecore_evas_engines_extn_module_la_LIBADD = lib/ecore_ipc/libecore_ipc.la  lib/ecore_evas/libecore_evas.la
+modules_ecore_evas_engines_extn_module_la_LDFLAGS = -module @EFL_LTMODULE_FLAGS@
+modules_ecore_evas_engines_extn_module_la_LIBTOOLFLAGS = --tag=disable-static
 endif
 
 if BUILD_ECORE_EVAS_X11
index 7d4edae..893f9d5 100644 (file)
@@ -105,11 +105,8 @@ ecore_evas_engine_type_supported_get(Ecore_Evas_Engine_Type engine)
    switch (engine)
      {
       case ECORE_EVAS_ENGINE_SOFTWARE_BUFFER:
-#ifdef BUILD_ECORE_EVAS_BUFFER
         return EINA_TRUE;
-#else
-        return EINA_FALSE;
-#endif
+
       case ECORE_EVAS_ENGINE_SOFTWARE_XLIB:
 #ifdef BUILD_ECORE_EVAS_SOFTWARE_XLIB
         return EINA_TRUE;
@@ -2669,22 +2666,6 @@ _ecore_evas_window_available_profiles_free(Ecore_Evas *ee)
      }
 }
 
-EAPI int
-ecore_evas_buffer_render(Ecore_Evas *ee)
-{
-   Ecore_Evas_Interface_Buffer *iface;
-   iface = (Ecore_Evas_Interface_Buffer *)_ecore_evas_interface_get(ee, "buffer");
-   EINA_SAFETY_ON_NULL_RETURN_VAL(iface, 0);
-
-   return iface->render(ee);
-}
-
-
-
-
-
-
-
 EAPI Eina_List *
 ecore_evas_ecore_evas_list_get(void)
 {
@@ -3050,49 +3031,10 @@ ecore_evas_x11_shape_input_apply(Ecore_Evas *ee)
 }
 
 EAPI Ecore_Evas *
-ecore_evas_buffer_new(int w, int h)
-{
-   Ecore_Evas *(*new)(int, int);
-   Eina_Module *m = _ecore_evas_engine_load("buffer");
-   EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL);
-
-   new = eina_module_symbol_get(m, "ecore_evas_buffer_new_internal");
-   EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL);
-
-   return new(w, h);
-}
-
-EAPI const void *
-ecore_evas_buffer_pixels_get(Ecore_Evas *ee)
-{
-   Ecore_Evas_Interface_Buffer *iface;
-   iface = (Ecore_Evas_Interface_Buffer *)_ecore_evas_interface_get(ee, "buffer");
-   EINA_SAFETY_ON_NULL_RETURN_VAL(iface, NULL);
-
-   return iface->pixels_get(ee);
-}
-
-EAPI Ecore_Evas *
-ecore_evas_buffer_allocfunc_new(int w, int h,
-                               void *(*alloc_func) (void *data, int size),
-                               void (*free_func) (void *data, void *pix),
-                               const void *data)
-{
-   Ecore_Evas *(*new)(int, int, void*(*)(void *, int), void(*)(void *, void *), const void *);
-   Eina_Module *m = _ecore_evas_engine_load("buffer");
-   EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL);
-
-   new = eina_module_symbol_get(m, "ecore_evas_buffer_allocfunc_new_internal");
-   EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL);
-
-   return new(w, h, alloc_func, free_func, data);
-}
-
-EAPI Ecore_Evas *
 ecore_evas_extn_socket_new(int w, int h)
 {
    Ecore_Evas *(*new)(int, int);
-   Eina_Module *m = _ecore_evas_engine_load("buffer");
+   Eina_Module *m = _ecore_evas_engine_load("extn");
    EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL);
 
    new = eina_module_symbol_get(m, "ecore_evas_extn_socket_new_internal");
@@ -3145,7 +3087,7 @@ EAPI Evas_Object *
 ecore_evas_extn_plug_new(Ecore_Evas *ee_target)
 {
    Evas_Object *(*new)(Ecore_Evas *);
-   Eina_Module *m = _ecore_evas_engine_load("buffer");
+   Eina_Module *m = _ecore_evas_engine_load("extn");
    EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL);
 
    new = eina_module_symbol_get(m, "ecore_evas_extn_plug_new_internal");
@@ -3169,19 +3111,6 @@ ecore_evas_extn_plug_connect(Evas_Object *obj, const char *svcname, int svcnum,
    return iface->connect(ee, svcname, svcnum, svcsys);
 }
 
-EAPI Evas_Object *
-ecore_evas_object_image_new(Ecore_Evas *ee_target)
-{
-   Evas_Object *(*new)(Ecore_Evas *ee_target);
-   Eina_Module *m = _ecore_evas_engine_load("buffer");
-   EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL);
-
-   new = eina_module_symbol_get(m, "ecore_evas_object_image_new_internal");
-   EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL);
-
-   return new(ee_target);
-}
-
 EAPI Ecore_Evas *
 ecore_evas_sdl_new(const char* name, int w, int h, int fullscreen,
                   int hwsurface, int noframe, int alpha)
@@ -2,30 +2,7 @@
 # include <config.h>
 #endif
 
-#include "ecore_evas_buffer_private.h"
-
-static int _ecore_evas_init_count = 0;
-
-static const char *interface_buffer_name = "buffer";
-static const int   interface_buffer_version = 1;
-
-
-static Ecore_Evas_Interface_Buffer *_ecore_evas_buffer_interface_new(void);
-
-static int
-_ecore_evas_buffer_init(void)
-{
-   _ecore_evas_init_count++;
-   return _ecore_evas_init_count;
-}
-
-static int
-_ecore_evas_buffer_shutdown(void)
-{
-   _ecore_evas_init_count--;
-   if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0;
-   return _ecore_evas_init_count;
-}
+#include "ecore_evas_buffer.h"
 
 static void
 _ecore_evas_buffer_free(Ecore_Evas *ee)
@@ -47,7 +24,6 @@ _ecore_evas_buffer_free(Ecore_Evas *ee)
      }
 
    free(bdata);
-   _ecore_evas_buffer_shutdown();
 }
 
 static void
@@ -128,10 +104,11 @@ static int
 _ecore_evas_buffer_render(Ecore_Evas *ee)
 {
    Eina_List *updates = NULL, *l, *ll;
-   Ecore_Evas_Engine_Buffer_Data *bdata = ee->engine.data;
+   Ecore_Evas_Engine_Buffer_Data *bdata;
    Ecore_Evas *ee2;
    int rend = 0;
 
+   bdata = ee->engine.data;
    EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2)
      {
         if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2);
@@ -170,6 +147,13 @@ _ecore_evas_buffer_render(Ecore_Evas *ee)
    return updates ? 1 : rend;
 }
 
+EAPI int
+ecore_evas_buffer_render(Ecore_Evas *ee)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(ee, 0);
+   return _ecore_evas_buffer_render(ee);
+}
+
 // NOTE: if you fix this, consider fixing ecore_evas_ews.c as it is similar!
 static void
 _ecore_evas_buffer_coord_translate(Ecore_Evas *ee, Evas_Coord *x, Evas_Coord *y)
@@ -565,19 +549,25 @@ _ecore_evas_buffer_pix_free(void *data EINA_UNUSED, void *pix)
 }
 
 EAPI Ecore_Evas *
-ecore_evas_buffer_allocfunc_new_internal(int w, int h, void *(*alloc_func) (void *data, int size), void (*free_func) (void *data, void *pix), const void *data)
+ecore_evas_buffer_allocfunc_new(int w, int h,
+                                void *(*alloc_func) (void *data, int size),
+                                void (*free_func) (void *data, void *pix),
+                                const void *data)
 {
    Evas_Engine_Info_Buffer *einfo;
    Ecore_Evas_Engine_Buffer_Data *bdata;
-   Ecore_Evas_Interface_Buffer *iface;
    Ecore_Evas *ee;
    int rmethod;
 
-   if ((!alloc_func) || (!free_func)) return NULL;
+   EINA_SAFETY_ON_NULL_RETURN_VAL(alloc_func, NULL);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(free_func, NULL);
+
    rmethod = evas_render_method_lookup("buffer");
-   if (!rmethod) return NULL;
+   EINA_SAFETY_ON_TRUE_RETURN_VAL(rmethod == 0, NULL);
+
    ee = calloc(1, sizeof(Ecore_Evas));
-   if (!ee) return NULL;
+   EINA_SAFETY_ON_NULL_RETURN_VAL(ee, NULL);
+
    bdata = calloc(1, sizeof(Ecore_Evas_Engine_Buffer_Data));
    if (!bdata)
      {
@@ -587,17 +577,12 @@ ecore_evas_buffer_allocfunc_new_internal(int w, int h, void *(*alloc_func) (void
 
    ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
 
-   _ecore_evas_buffer_init();
-
    ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_buffer_engine_func;
    ee->engine.data = bdata;
    bdata->alloc_func = alloc_func;
    bdata->free_func = free_func;
    bdata->data = (void *)data;
 
-   iface = _ecore_evas_buffer_interface_new();
-   ee->engine.ifaces = eina_list_append(ee->engine.ifaces, iface);
-
    ee->driver = "buffer";
 
    if (w < 1) w = 1;
@@ -673,43 +658,42 @@ ecore_evas_buffer_allocfunc_new_internal(int w, int h, void *(*alloc_func) (void
 }
 
 EAPI Ecore_Evas *
-ecore_evas_buffer_new_internal(int w, int h)
+ecore_evas_buffer_new(int w, int h)
 {
-    return ecore_evas_buffer_allocfunc_new_internal
+    return ecore_evas_buffer_allocfunc_new
      (w, h, _ecore_evas_buffer_pix_alloc, _ecore_evas_buffer_pix_free, NULL);
 }
 
-const void *
-_ecore_evas_buffer_pixels_get(Ecore_Evas *ee)
+EAPI const void *
+ecore_evas_buffer_pixels_get(Ecore_Evas *ee)
 {
-   Ecore_Evas_Engine_Buffer_Data *bdata = ee->engine.data;
+   Ecore_Evas_Engine_Buffer_Data *bdata;
 
-   if (!ee)
-     {
-        CRIT("Ecore_Evas is missing");
-        return NULL;
-     }
+   EINA_SAFETY_ON_NULL_RETURN_VAL(ee, NULL);
+
+   bdata = ee->engine.data;
    _ecore_evas_buffer_render(ee);
    return bdata->pixels;
 }
 
 EAPI Evas_Object *
-ecore_evas_object_image_new_internal(Ecore_Evas *ee_target)
+ecore_evas_object_image_new(Ecore_Evas *ee_target)
 {
    Evas_Object *o;
    Ecore_Evas_Engine_Buffer_Data *bdata;
    Evas_Engine_Info_Buffer *einfo;
-   Ecore_Evas_Interface_Buffer *iface;
    Ecore_Evas *ee;
    int rmethod;
    int w = 1, h = 1;
 
-   if (!ee_target) return NULL;
+   EINA_SAFETY_ON_NULL_RETURN_VAL(ee_target, NULL);
 
    rmethod = evas_render_method_lookup("buffer");
-   if (!rmethod) return NULL;
+   EINA_SAFETY_ON_TRUE_RETURN_VAL(rmethod == 0, NULL);
+
    ee = calloc(1, sizeof(Ecore_Evas));
-   if (!ee) return NULL;
+   EINA_SAFETY_ON_NULL_RETURN_VAL(ee, NULL);
+
    bdata = calloc(1, sizeof(Ecore_Evas_Engine_Buffer_Data));
    if (!bdata)
      {
@@ -718,8 +702,6 @@ ecore_evas_object_image_new_internal(Ecore_Evas *ee_target)
      }
 
    ee->engine.data = bdata;
-   iface = _ecore_evas_buffer_interface_new();
-   ee->engine.ifaces = eina_list_append(ee->engine.ifaces, iface);
 
    o = evas_object_image_add(ee_target->evas);
    evas_object_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC);
@@ -729,8 +711,6 @@ ecore_evas_object_image_new_internal(Ecore_Evas *ee_target)
 
    ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
 
-   _ecore_evas_buffer_init();
-
    ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_buffer_engine_func;
 
    ee->driver = "buffer";
@@ -851,20 +831,3 @@ ecore_evas_object_image_new_internal(Ecore_Evas *ee_target)
 
    return o;
 }
-
-static Ecore_Evas_Interface_Buffer *
-_ecore_evas_buffer_interface_new(void)
-{
-   Ecore_Evas_Interface_Buffer *iface;
-
-   iface = calloc(1, sizeof(Ecore_Evas_Interface_Buffer));
-   if (!iface) return NULL;
-
-   iface->base.name = interface_buffer_name;
-   iface->base.version = interface_buffer_version;
-
-   iface->pixels_get = _ecore_evas_buffer_pixels_get;
-   iface->render = _ecore_evas_buffer_render;
-
-   return iface;
-}
index 18d4ce2..612f7ea 100644 (file)
@@ -57,7 +57,6 @@ typedef struct _Ecore_Evas_Engine_Func Ecore_Evas_Engine_Func;
 typedef struct _Ecore_Evas_Interface Ecore_Evas_Interface;
 
 /* Engines interfaces */
-typedef struct _Ecore_Evas_Interface_Buffer Ecore_Evas_Interface_Buffer;
 typedef struct _Ecore_Evas_Interface_Extn Ecore_Evas_Interface_Extn;
 typedef struct _Ecore_Evas_Interface_X11 Ecore_Evas_Interface_X11;
 typedef struct _Ecore_Evas_Interface_Software_X11 Ecore_Evas_Interface_Software_X11;
@@ -136,13 +135,6 @@ struct _Ecore_Evas_Interface
     unsigned int version;
 };
 
-struct _Ecore_Evas_Interface_Buffer {
-   Ecore_Evas_Interface base;
-
-   const void*    (*pixels_get)(Ecore_Evas *ee);
-   int            (*render)(Ecore_Evas *ee);
-};
-
 struct _Ecore_Evas_Interface_X11 {
    Ecore_Evas_Interface base;
 
@@ -27,7 +27,7 @@
 
 #include <Ecore_Ipc.h>
 
-#include "ecore_evas_buffer_private.h"
+#include "ecore_evas_buffer.h"
 
 
 static const char *interface_extn_name = "extn";