summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2015-04-14 21:39:55 +0200
committerCedric BAIL <cedric@osg.samsung.com>2015-04-14 21:40:32 +0200
commit74d27d6a278d7fd381639c31f0c977127f1d61cf (patch)
treeec1cabd0fdca29788718a14fff9390e63ca4b94c
parent2260b9e328eb46fe028d46efd06f15d7dd7b15dd (diff)
downloadefl-74d27d6a278d7fd381639c31f0c977127f1d61cf.tar.gz
evas: split ector surface from gl generic backend in an attempt to fix windows build.
-rw-r--r--src/Makefile_Evas.am1
-rw-r--r--src/modules/evas/engines/gl_generic/ector_surface.c101
-rw-r--r--src/modules/evas/engines/gl_generic/evas_engine.c92
3 files changed, 102 insertions, 92 deletions
diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am
index 620e02f91c..98419ad818 100644
--- a/src/Makefile_Evas.am
+++ b/src/Makefile_Evas.am
@@ -705,6 +705,7 @@ modules/evas/engines/gl_common/shader_3d/evas_gl_3d_shaders.x: modules/evas/engi
GL_GENERIC_SOURCES = \
modules/evas/engines/gl_generic/evas_engine.c \
+modules/evas/engines/gl_generic/ector_surface.c \
modules/evas/engines/gl_generic/Evas_Engine_GL_Generic.h
if EVAS_STATIC_BUILD_GL_COMMON
diff --git a/src/modules/evas/engines/gl_generic/ector_surface.c b/src/modules/evas/engines/gl_generic/ector_surface.c
new file mode 100644
index 0000000000..0cf2c405f9
--- /dev/null
+++ b/src/modules/evas/engines/gl_generic/ector_surface.c
@@ -0,0 +1,101 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h" /* so that EAPI in Evas.h is correctly defined */
+#endif
+
+#include <Ector.h>
+
+#include "cairo/Ector_Cairo.h"
+#include "software/Ector_Software.h"
+
+#include "ector_cairo_software_surface.eo.h"
+
+#define USE(Obj, Sym, Error) \
+ if (!Sym) Sym = _ector_cairo_symbol_get(Obj, #Sym); \
+ if (!Sym) return Error;
+
+static inline void *
+_ector_cairo_symbol_get(Eo *ector_surface, const char *name)
+{
+ void *sym;
+
+ eo_do(ector_surface,
+ sym = ector_cairo_surface_symbol_get(name));
+ return sym;
+}
+
+typedef struct _cairo_surface_t cairo_surface_t;
+typedef enum {
+ CAIRO_FORMAT_INVALID = -1,
+ CAIRO_FORMAT_ARGB32 = 0,
+ CAIRO_FORMAT_RGB24 = 1,
+ CAIRO_FORMAT_A8 = 2,
+ CAIRO_FORMAT_A1 = 3,
+ CAIRO_FORMAT_RGB16_565 = 4,
+ CAIRO_FORMAT_RGB30 = 5
+} cairo_format_t;
+
+static cairo_surface_t *(*cairo_image_surface_create_for_data)(unsigned char *data,
+ cairo_format_t format,
+ int width,
+ int height,
+ int stride) = NULL;
+static void (*cairo_surface_destroy)(cairo_surface_t *surface) = NULL;
+static cairo_t *(*cairo_create)(cairo_surface_t *target) = NULL;
+static void (*cairo_destroy)(cairo_t *cr) = NULL;
+
+typedef struct _Ector_Cairo_Software_Surface_Data Ector_Cairo_Software_Surface_Data;
+struct _Ector_Cairo_Software_Surface_Data
+{
+ cairo_surface_t *surface;
+ cairo_t *ctx;
+
+ void *pixels;
+
+ unsigned int width;
+ unsigned int height;
+};
+
+static void
+_ector_cairo_software_surface_surface_set(Eo *obj, Ector_Cairo_Software_Surface_Data *pd, void *pixels, unsigned int width, unsigned int height)
+{
+ USE(obj, cairo_image_surface_create_for_data, );
+ USE(obj, cairo_surface_destroy, );
+ USE(obj, cairo_create, );
+ USE(obj, cairo_destroy, );
+
+ if (pd->surface) cairo_surface_destroy(pd->surface); pd->surface = NULL;
+ if (pd->ctx) cairo_destroy(pd->ctx); pd->ctx = NULL;
+
+ pd->pixels = NULL;
+ pd->width = 0;
+ pd->height = 0;
+
+ if (pixels)
+ {
+ pd->surface = cairo_image_surface_create_for_data(pixels,
+ CAIRO_FORMAT_ARGB32,
+ width, height, width);
+ if (!pd->surface) goto end;
+
+ pd->ctx = cairo_create(pd->surface);
+ if (!pd->ctx) goto end;
+ }
+ pd->pixels = pixels;
+ pd->width = width;
+ pd->height = height;
+
+ end:
+ eo_do(obj,
+ ector_cairo_surface_context_set(pd->ctx),
+ ector_surface_size_set(pd->width, pd->height));
+}
+
+static void
+_ector_cairo_software_surface_surface_get(Eo *obj EINA_UNUSED, Ector_Cairo_Software_Surface_Data *pd, void **pixels, unsigned int *width, unsigned int *height)
+{
+ if (pixels) *pixels = pd->pixels;
+ if (width) *width = pd->width;
+ if (height) *height = pd->height;
+}
+
+#include "ector_cairo_software_surface.eo.c"
diff --git a/src/modules/evas/engines/gl_generic/evas_engine.c b/src/modules/evas/engines/gl_generic/evas_engine.c
index 4dab30bee4..ac3fd80776 100644
--- a/src/modules/evas/engines/gl_generic/evas_engine.c
+++ b/src/modules/evas/engines/gl_generic/evas_engine.c
@@ -21,7 +21,6 @@
#include "evas_cs2_private.h"
#endif
-#include "cairo/Ector_Cairo.h"
#include "software/Ector_Software.h"
#include "ector_cairo_software_surface.eo.h"
@@ -2478,94 +2477,3 @@ EVAS_MODULE_DEFINE(EVAS_MODULE_TYPE_ENGINE, engine, gl_generic);
#ifndef EVAS_STATIC_BUILD_GL_COMMON
EVAS_EINA_MODULE_DEFINE(engine, gl_generic);
#endif
-
-#define USE(Obj, Sym, Error) \
- if (!Sym) Sym = _ector_cairo_symbol_get(Obj, #Sym); \
- if (!Sym) return Error;
-
-static inline void *
-_ector_cairo_symbol_get(Eo *ector_surface, const char *name)
-{
- void *sym;
-
- eo_do(ector_surface,
- sym = ector_cairo_surface_symbol_get(name));
- return sym;
-}
-
-typedef struct _cairo_surface_t cairo_surface_t;
-typedef enum {
- CAIRO_FORMAT_INVALID = -1,
- CAIRO_FORMAT_ARGB32 = 0,
- CAIRO_FORMAT_RGB24 = 1,
- CAIRO_FORMAT_A8 = 2,
- CAIRO_FORMAT_A1 = 3,
- CAIRO_FORMAT_RGB16_565 = 4,
- CAIRO_FORMAT_RGB30 = 5
-} cairo_format_t;
-
-static cairo_surface_t *(*cairo_image_surface_create_for_data)(unsigned char *data,
- cairo_format_t format,
- int width,
- int height,
- int stride) = NULL;
-static void (*cairo_surface_destroy)(cairo_surface_t *surface) = NULL;
-static cairo_t *(*cairo_create)(cairo_surface_t *target) = NULL;
-static void (*cairo_destroy)(cairo_t *cr) = NULL;
-
-typedef struct _Ector_Cairo_Software_Surface_Data Ector_Cairo_Software_Surface_Data;
-struct _Ector_Cairo_Software_Surface_Data
-{
- cairo_surface_t *surface;
- cairo_t *ctx;
-
- void *pixels;
-
- unsigned int width;
- unsigned int height;
-};
-
-static void
-_ector_cairo_software_surface_surface_set(Eo *obj, Ector_Cairo_Software_Surface_Data *pd, void *pixels, unsigned int width, unsigned int height)
-{
- USE(obj, cairo_image_surface_create_for_data, );
- USE(obj, cairo_surface_destroy, );
- USE(obj, cairo_create, );
- USE(obj, cairo_destroy, );
-
- if (pd->surface) cairo_surface_destroy(pd->surface); pd->surface = NULL;
- if (pd->ctx) cairo_destroy(pd->ctx); pd->ctx = NULL;
-
- pd->pixels = NULL;
- pd->width = 0;
- pd->height = 0;
-
- if (pixels)
- {
- pd->surface = cairo_image_surface_create_for_data(pixels,
- CAIRO_FORMAT_ARGB32,
- width, height, width);
- if (!pd->surface) goto end;
-
- pd->ctx = cairo_create(pd->surface);
- if (!pd->ctx) goto end;
- }
- pd->pixels = pixels;
- pd->width = width;
- pd->height = height;
-
- end:
- eo_do(obj,
- ector_cairo_surface_context_set(pd->ctx),
- ector_surface_size_set(pd->width, pd->height));
-}
-
-static void
-_ector_cairo_software_surface_surface_get(Eo *obj EINA_UNUSED, Ector_Cairo_Software_Surface_Data *pd, void **pixels, unsigned int *width, unsigned int *height)
-{
- if (pixels) *pixels = pd->pixels;
- if (width) *width = pd->width;
- if (height) *height = pd->height;
-}
-
-#include "ector_cairo_software_surface.eo.c"