summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2015-04-14 21:26:17 +0200
committerCedric BAIL <cedric@osg.samsung.com>2015-04-14 21:40:32 +0200
commit2260b9e328eb46fe028d46efd06f15d7dd7b15dd (patch)
treedc54ee225a694d0d1733e1e7184e352b100420fa /src/modules
parenta51eceaf6d407ad574c6e95c27225ac50fff25fc (diff)
evas: split software backend use of ector surface in an attempt to fix windows build.
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/evas/engines/software_generic/ector_surface.c104
-rw-r--r--src/modules/evas/engines/software_generic/evas_engine.c99
2 files changed, 106 insertions, 97 deletions
diff --git a/src/modules/evas/engines/software_generic/ector_surface.c b/src/modules/evas/engines/software_generic/ector_surface.c
new file mode 100644
index 0000000..17edc95
--- /dev/null
+++ b/src/modules/evas/engines/software_generic/ector_surface.c
@@ -0,0 +1,104 @@
1#ifdef HAVE_CONFIG_H
2#include "config.h" /* so that EAPI in Evas.h is correctly defined */
3#endif
4
5#include <Ector.h>
6
7#include <cairo/Ector_Cairo.h>
8#include <software/Ector_Software.h>
9
10#include "ector_cairo_software_surface.eo.h"
11
12#define USE(Obj, Sym, Error) \
13 if (!Sym) Sym = _ector_cairo_symbol_get(Obj, #Sym); \
14 if (!Sym) return Error;
15
16static inline void *
17_ector_cairo_symbol_get(Eo *ector_surface, const char *name)
18{
19 void *sym;
20
21 eo_do(ector_surface,
22 sym = ector_cairo_surface_symbol_get(name));
23 return sym;
24}
25
26typedef struct _cairo_surface_t cairo_surface_t;
27typedef enum {
28 CAIRO_FORMAT_INVALID = -1,
29 CAIRO_FORMAT_ARGB32 = 0,
30 CAIRO_FORMAT_RGB24 = 1,
31 CAIRO_FORMAT_A8 = 2,
32 CAIRO_FORMAT_A1 = 3,
33 CAIRO_FORMAT_RGB16_565 = 4,
34 CAIRO_FORMAT_RGB30 = 5
35} cairo_format_t;
36
37static cairo_surface_t *(*cairo_image_surface_create_for_data)(unsigned char *data,
38 cairo_format_t format,
39 int width,
40 int height,
41 int stride) = NULL;
42static void (*cairo_surface_destroy)(cairo_surface_t *surface) = NULL;
43static cairo_t *(*cairo_create)(cairo_surface_t *target) = NULL;
44static void (*cairo_destroy)(cairo_t *cr) = NULL;
45
46typedef struct _Ector_Cairo_Software_Surface_Data Ector_Cairo_Software_Surface_Data;
47struct _Ector_Cairo_Software_Surface_Data
48{
49 cairo_surface_t *surface;
50 cairo_t *ctx;
51
52 void *pixels;
53
54 unsigned int width;
55 unsigned int height;
56};
57
58void
59_ector_cairo_software_surface_surface_set(Eo *obj, Ector_Cairo_Software_Surface_Data *pd, void *pixels, unsigned int width, unsigned int height)
60{
61 USE(obj, cairo_image_surface_create_for_data, );
62 USE(obj, cairo_surface_destroy, );
63 USE(obj, cairo_create, );
64 USE(obj, cairo_destroy, );
65
66 if (pd->surface) cairo_surface_destroy(pd->surface); pd->surface = NULL;
67 if (pd->ctx) cairo_destroy(pd->ctx); pd->ctx = NULL;
68
69 pd->pixels = NULL;
70 pd->width = 0;
71 pd->height = 0;
72
73 if (pixels)
74 {
75 pd->surface = cairo_image_surface_create_for_data(pixels,
76 CAIRO_FORMAT_ARGB32,
77 width, height, width * sizeof (int));
78 if (!pd->surface) goto end;
79
80 pd->ctx = cairo_create(pd->surface);
81 if (!pd->ctx) goto end;
82 }
83
84 pd->pixels = pixels;
85 pd->width = width;
86 pd->height = height;
87
88 end:
89 evas_common_cpu_end_opt();
90
91 eo_do(obj,
92 ector_cairo_surface_context_set(pd->ctx),
93 ector_surface_size_set(pd->width, pd->height));
94}
95
96void
97_ector_cairo_software_surface_surface_get(Eo *obj EINA_UNUSED, Ector_Cairo_Software_Surface_Data *pd, void **pixels, unsigned int *width, unsigned int *height)
98{
99 if (pixels) *pixels = pd->pixels;
100 if (width) *width = pd->width;
101 if (height) *height = pd->height;
102}
103
104#include "ector_cairo_software_surface.eo.c"
diff --git a/src/modules/evas/engines/software_generic/evas_engine.c b/src/modules/evas/engines/software_generic/evas_engine.c
index a5faae3..af26cb6 100644
--- a/src/modules/evas/engines/software_generic/evas_engine.c
+++ b/src/modules/evas/engines/software_generic/evas_engine.c
@@ -5,6 +5,8 @@
5#include "evas_cs2_private.h" 5#include "evas_cs2_private.h"
6#endif 6#endif
7 7
8#include <software/Ector_Software.h>
9
8#ifdef HAVE_DLSYM 10#ifdef HAVE_DLSYM
9# include <dlfcn.h> /* dlopen,dlclose,etc */ 11# include <dlfcn.h> /* dlopen,dlclose,etc */
10 12
@@ -18,9 +20,6 @@
18 20
19#include "Evas_Engine_Software_Generic.h" 21#include "Evas_Engine_Software_Generic.h"
20 22
21#include "cairo/Ector_Cairo.h"
22#include "software/Ector_Software.h"
23
24#include "ector_cairo_software_surface.eo.h" 23#include "ector_cairo_software_surface.eo.h"
25 24
26#ifdef EVAS_GL 25#ifdef EVAS_GL
@@ -4996,97 +4995,3 @@ void evas_engine_software_generic_shutdown(void)
4996#ifndef EVAS_STATIC_BUILD_SOFTWARE_GENERIC 4995#ifndef EVAS_STATIC_BUILD_SOFTWARE_GENERIC
4997EVAS_EINA_MODULE_DEFINE(engine, software_generic); 4996EVAS_EINA_MODULE_DEFINE(engine, software_generic);
4998#endif 4997#endif
4999
5000#define USE(Obj, Sym, Error) \
5001 if (!Sym) Sym = _ector_cairo_symbol_get(Obj, #Sym); \
5002 if (!Sym) return Error;
5003
5004static inline void *
5005_ector_cairo_symbol_get(Eo *ector_surface, const char *name)
5006{
5007 void *sym;
5008
5009 eo_do(ector_surface,
5010 sym = ector_cairo_surface_symbol_get(name));
5011 return sym;
5012}
5013
5014typedef struct _cairo_surface_t cairo_surface_t;
5015typedef enum {
5016 CAIRO_FORMAT_INVALID = -1,
5017 CAIRO_FORMAT_ARGB32 = 0,
5018 CAIRO_FORMAT_RGB24 = 1,
5019 CAIRO_FORMAT_A8 = 2,
5020 CAIRO_FORMAT_A1 = 3,
5021 CAIRO_FORMAT_RGB16_565 = 4,
5022 CAIRO_FORMAT_RGB30 = 5
5023} cairo_format_t;
5024
5025static cairo_surface_t *(*cairo_image_surface_create_for_data)(unsigned char *data,
5026 cairo_format_t format,
5027 int width,
5028 int height,
5029 int stride) = NULL;
5030static void (*cairo_surface_destroy)(cairo_surface_t *surface) = NULL;
5031static cairo_t *(*cairo_create)(cairo_surface_t *target) = NULL;
5032static void (*cairo_destroy)(cairo_t *cr) = NULL;
5033
5034typedef struct _Ector_Cairo_Software_Surface_Data Ector_Cairo_Software_Surface_Data;
5035struct _Ector_Cairo_Software_Surface_Data
5036{
5037 cairo_surface_t *surface;
5038 cairo_t *ctx;
5039
5040 void *pixels;
5041
5042 unsigned int width;
5043 unsigned int height;
5044};
5045
5046void
5047_ector_cairo_software_surface_surface_set(Eo *obj, Ector_Cairo_Software_Surface_Data *pd, void *pixels, unsigned int width, unsigned int height)
5048{
5049 USE(obj, cairo_image_surface_create_for_data, );
5050 USE(obj, cairo_surface_destroy, );
5051 USE(obj, cairo_create, );
5052 USE(obj, cairo_destroy, );
5053
5054 if (pd->surface) cairo_surface_destroy(pd->surface); pd->surface = NULL;
5055 if (pd->ctx) cairo_destroy(pd->ctx); pd->ctx = NULL;
5056
5057 pd->pixels = NULL;
5058 pd->width = 0;
5059 pd->height = 0;
5060
5061 if (pixels)
5062 {
5063 pd->surface = cairo_image_surface_create_for_data(pixels,
5064 CAIRO_FORMAT_ARGB32,
5065 width, height, width * sizeof (int));
5066 if (!pd->surface) goto end;
5067
5068 pd->ctx = cairo_create(pd->surface);
5069 if (!pd->ctx) goto end;
5070 }
5071
5072 pd->pixels = pixels;
5073 pd->width = width;
5074 pd->height = height;
5075
5076 end:
5077 evas_common_cpu_end_opt();
5078
5079 eo_do(obj,
5080 ector_cairo_surface_context_set(pd->ctx),
5081 ector_surface_size_set(pd->width, pd->height));
5082}
5083
5084void
5085_ector_cairo_software_surface_surface_get(Eo *obj EINA_UNUSED, Ector_Cairo_Software_Surface_Data *pd, void **pixels, unsigned int *width, unsigned int *height)
5086{
5087 if (pixels) *pixels = pd->pixels;
5088 if (width) *width = pd->width;
5089 if (height) *height = pd->height;
5090}
5091
5092#include "ector_cairo_software_surface.eo.c"