summaryrefslogtreecommitdiff
path: root/src/modules/evas
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2015-12-08 17:29:54 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2016-01-05 15:43:43 +0900
commit7a8879ba8bf5d9aec15428f94222222eea6c0e2e (patch)
tree0ccf55e8242dff190ec53d27aa4ac42308dbea88 /src/modules/evas
parent85f23d96e7072f09ab73ab698047c3c172974b5e (diff)
ector: add engine-specific evas image buffer wrapper
Since Evas still relies entirely on Image_Entry and Evas_GL_Image, we will need an engine-specific wrapper object creating a Buffer around an existing cached image. Currently only SW support is implemented. GL will be more fun to do (with glReadPixels and whatnot).
Diffstat (limited to 'src/modules/evas')
-rw-r--r--src/modules/evas/engines/gl_generic/evas_engine.c15
-rw-r--r--src/modules/evas/engines/software_generic/evas_ector_software_buffer.c97
-rw-r--r--src/modules/evas/engines/software_generic/evas_ector_software_buffer.eo12
-rw-r--r--src/modules/evas/engines/software_generic/evas_engine.c17
4 files changed, 141 insertions, 0 deletions
diff --git a/src/modules/evas/engines/gl_generic/evas_engine.c b/src/modules/evas/engines/gl_generic/evas_engine.c
index f67ffda148..a052958637 100644
--- a/src/modules/evas/engines/gl_generic/evas_engine.c
+++ b/src/modules/evas/engines/gl_generic/evas_engine.c
@@ -2458,6 +2458,20 @@ eng_ector_destroy(void *data EINA_UNUSED, Ector_Surface *ector)
2458 if (ector) eo_del(ector); 2458 if (ector) eo_del(ector);
2459} 2459}
2460 2460
2461static Ector_Buffer *
2462eng_ector_buffer_new(void *data EINA_UNUSED, Evas *e, void *engine_image)
2463{
2464 Evas_GL_Image *im = engine_image;
2465 Ector_Buffer *buf = NULL;
2466
2467 if (!im) return NULL;
2468
2469#warning FIXME: implement me
2470 (void) e;
2471
2472 return buf;
2473}
2474
2461static Efl_Gfx_Render_Op 2475static Efl_Gfx_Render_Op
2462_evas_render_op_to_ector_rop(Evas_Render_Op op) 2476_evas_render_op_to_ector_rop(Evas_Render_Op op)
2463{ 2477{
@@ -2799,6 +2813,7 @@ module_open(Evas_Module *em)
2799 2813
2800 ORD(ector_create); 2814 ORD(ector_create);
2801 ORD(ector_destroy); 2815 ORD(ector_destroy);
2816 ORD(ector_buffer_new);
2802 ORD(ector_begin); 2817 ORD(ector_begin);
2803 ORD(ector_renderer_draw); 2818 ORD(ector_renderer_draw);
2804 ORD(ector_end); 2819 ORD(ector_end);
diff --git a/src/modules/evas/engines/software_generic/evas_ector_software_buffer.c b/src/modules/evas/engines/software_generic/evas_ector_software_buffer.c
new file mode 100644
index 0000000000..3d45862653
--- /dev/null
+++ b/src/modules/evas/engines/software_generic/evas_ector_software_buffer.c
@@ -0,0 +1,97 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4
5#include <software/Ector_Software.h>
6#include "evas_common_private.h"
7#include "evas_private.h"
8#include "draw.h"
9
10#include "evas_ector_buffer.eo.h"
11#include "evas_ector_software_buffer.eo.h"
12
13#define MY_CLASS EVAS_ECTOR_SOFTWARE_BUFFER_CLASS
14
15typedef struct {
16 Ector_Software_Buffer_Base_Data *base;
17 Evas *evas;
18 Image_Entry *ie;
19} Evas_Ector_Software_Buffer_Data;
20
21#define ENFN e->engine.func
22#define ENDT e->engine.data.output
23
24EOLIAN static void
25_evas_ector_software_buffer_evas_ector_buffer_engine_image_set(Eo *obj, Evas_Ector_Software_Buffer_Data *pd,
26 Evas *evas, void *image)
27{
28 Evas_Public_Data *e = eo_data_scope_get(evas, EVAS_CANVAS_CLASS);
29 Image_Entry *ie = image;
30 RGBA_Image *im;
31 Eina_Bool b;
32
33 if (eo_do_ret(obj, b, eo_finalized_get()))
34 {
35 CRI("engine_image must be set at construction time only");
36 return;
37 }
38
39 im = (RGBA_Image *) ie;
40 if (!im->image.data)
41 {
42 CRI("image has no pixels yet");
43 return;
44 }
45
46 pd->evas = eo_xref(evas, obj);
47 pd->ie = ENFN->image_ref(ENDT, ie);
48 if (!pd->ie) return;
49
50 eo_do(obj, ector_buffer_pixels_set(im->image.data,
51 im->cache_entry.w, im->cache_entry.h, 0,
52 _evas_to_gfx_render_op(im->cache_entry.space),
53 EINA_TRUE, 0, 0, 0, 0));
54}
55
56EOLIAN static void
57_evas_ector_software_buffer_evas_ector_buffer_engine_image_get(Eo *obj EINA_UNUSED,
58 Evas_Ector_Software_Buffer_Data *pd,
59 Evas **evas, void **image)
60{
61 if (evas) *evas = pd->evas;
62 if (image) *image = pd->ie;
63}
64
65EOLIAN static Eo *
66_evas_ector_software_buffer_eo_base_constructor(Eo *obj, Evas_Ector_Software_Buffer_Data *pd)
67{
68 eo_do_super(obj, MY_CLASS, obj = eo_constructor());
69 pd->base = eo_data_xref(obj, ECTOR_SOFTWARE_BUFFER_BASE_MIXIN, obj);
70 return obj;
71}
72
73EOLIAN static Eo *
74_evas_ector_software_buffer_eo_base_finalize(Eo *obj, Evas_Ector_Software_Buffer_Data *pd)
75{
76 if (!pd->ie)
77 {
78 CRI("engine_image must be set at construction time only");
79 return NULL;
80 }
81 pd->base->generic->immutable = EINA_TRUE;
82 return eo_do_super_ret(obj, MY_CLASS, obj, eo_finalize());
83}
84
85EOLIAN static void
86_evas_ector_software_buffer_eo_base_destructor(Eo *obj, Evas_Ector_Software_Buffer_Data *pd)
87{
88 Evas_Public_Data *e = eo_data_scope_get(pd->evas, EVAS_CANVAS_CLASS);
89
90 eo_data_xunref(obj, pd->base, obj);
91 ENFN->image_free(ENDT, pd->ie);
92 eo_xunref(pd->evas, obj);
93 eo_do_super(obj, MY_CLASS, eo_destructor());
94}
95
96#include "evas_ector_buffer.eo.c"
97#include "evas_ector_software_buffer.eo.c"
diff --git a/src/modules/evas/engines/software_generic/evas_ector_software_buffer.eo b/src/modules/evas/engines/software_generic/evas_ector_software_buffer.eo
new file mode 100644
index 0000000000..f6a1a200d3
--- /dev/null
+++ b/src/modules/evas/engines/software_generic/evas_ector_software_buffer.eo
@@ -0,0 +1,12 @@
1class Evas.Ector.Software.Buffer (Ector.Software.Buffer, Evas.Ector.Buffer)
2{
3 [[A buffer object wrapping an existing Evas Image_Entry.]]
4 legacy_prefix: null;
5 implements {
6 Eo.Base.constructor;
7 Eo.Base.finalize;
8 Eo.Base.destructor;
9 Evas.Ector.Buffer.engine_image.set;
10 Evas.Ector.Buffer.engine_image.get;
11 }
12}
diff --git a/src/modules/evas/engines/software_generic/evas_engine.c b/src/modules/evas/engines/software_generic/evas_engine.c
index b71399f04f..22967ad14d 100644
--- a/src/modules/evas/engines/software_generic/evas_engine.c
+++ b/src/modules/evas/engines/software_generic/evas_engine.c
@@ -9,6 +9,8 @@
9 9
10#include <software/Ector_Software.h> 10#include <software/Ector_Software.h>
11#include "cairo/Ector_Cairo.h" 11#include "cairo/Ector_Cairo.h"
12#include "evas_ector_buffer.eo.h"
13#include "evas_ector_software_buffer.eo.h"
12 14
13#if defined HAVE_DLSYM && ! defined _WIN32 15#if defined HAVE_DLSYM && ! defined _WIN32
14# include <dlfcn.h> /* dlopen,dlclose,etc */ 16# include <dlfcn.h> /* dlopen,dlclose,etc */
@@ -3755,6 +3757,20 @@ eng_ector_destroy(void *data EINA_UNUSED, Ector_Surface *ector)
3755 if (ector) eo_del(ector); 3757 if (ector) eo_del(ector);
3756} 3758}
3757 3759
3760static Ector_Buffer *
3761eng_ector_buffer_new(void *data EINA_UNUSED, Evas *e, void *engine_image)
3762{
3763 Image_Entry *ie = engine_image;
3764 Ector_Buffer *buf = NULL;
3765
3766 if (!ie) return NULL;
3767
3768 buf = eo_add(EVAS_ECTOR_SOFTWARE_BUFFER_CLASS, e,
3769 evas_ector_buffer_engine_image_set(e, ie));
3770
3771 return buf;
3772}
3773
3758static Efl_Gfx_Render_Op 3774static Efl_Gfx_Render_Op
3759_evas_render_op_to_ector_rop(Evas_Render_Op op) 3775_evas_render_op_to_ector_rop(Evas_Render_Op op)
3760{ 3776{
@@ -4166,6 +4182,7 @@ static Evas_Func func =
4166 NULL, // eng_texture_image_get 4182 NULL, // eng_texture_image_get
4167 eng_ector_create, 4183 eng_ector_create,
4168 eng_ector_destroy, 4184 eng_ector_destroy,
4185 eng_ector_buffer_new,
4169 eng_ector_begin, 4186 eng_ector_begin,
4170 eng_ector_renderer_draw, 4187 eng_ector_renderer_draw,
4171 eng_ector_end, 4188 eng_ector_end,