summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Makefile_Evas.am28
-rw-r--r--src/lib/ector/ector_buffer.h18
-rw-r--r--src/lib/ector/gl/ector_gl_buffer.c10
-rw-r--r--src/lib/ector/gl/ector_gl_buffer.eo2
-rw-r--r--src/lib/ector/gl/ector_gl_buffer_base.c53
-rw-r--r--src/lib/ector/gl/ector_gl_buffer_base.eo23
-rw-r--r--src/lib/ector/gl/ector_gl_private.h2
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_common.h9
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_texture.c15
-rw-r--r--src/modules/evas/engines/gl_generic/evas_ector_gl_buffer.c14
-rw-r--r--src/modules/evas/engines/gl_generic/evas_ector_gl_buffer.eo5
-rw-r--r--src/modules/evas/engines/gl_generic/evas_ector_gl_image_buffer.c117
-rw-r--r--src/modules/evas/engines/gl_generic/evas_ector_gl_image_buffer.eo12
-rw-r--r--src/modules/evas/engines/software_generic/evas_ector_software_buffer.c17
14 files changed, 279 insertions, 46 deletions
diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am
index 2c58f88997..e95fe5bbb4 100644
--- a/src/Makefile_Evas.am
+++ b/src/Makefile_Evas.am
@@ -750,7 +750,32 @@ modules/evas/engines/gl_common/shader_3d/evas_gl_3d_shaders.x: modules/evas/engi
750 750
751GL_GENERIC_SOURCES = \ 751GL_GENERIC_SOURCES = \
752modules/evas/engines/gl_generic/evas_engine.c \ 752modules/evas/engines/gl_generic/evas_engine.c \
753modules/evas/engines/gl_generic/Evas_Engine_GL_Generic.h 753modules/evas/engines/gl_generic/Evas_Engine_GL_Generic.h \
754modules/evas/engines/gl_generic/evas_ector_gl_buffer.c \
755modules/evas/engines/gl_generic/evas_ector_gl_image_buffer.c
756$(NULL)
757
758evas_gl_generic_eolian_files = \
759modules/evas/engines/gl_generic/evas_ector_gl_buffer.eo \
760modules/evas/engines/gl_generic/evas_ector_gl_image_buffer.eo \
761$(NULL)
762
763evas_gl_generic_eolian_c = $(evas_gl_generic_eolian_files:%.eo=%.eo.c)
764evas_gl_generic_eolian_h = $(evas_gl_generic_eolian_files:%.eo=%.eo.h) \
765 $(evas_gl_generic_eolian_files:%.eo=%.eo.legacy.h) \
766 $(evas_gl_generic_eolian_type_files:%.eot=%.eot.h)
767
768BUILT_SOURCES += \
769 $(evas_gl_generic_eolian_c) \
770 $(evas_gl_generic_eolian_h)
771
772CLEANFILES += \
773 $(evas_gl_generic_eolian_c) \
774 $(evas_gl_generic_eolian_h)
775
776#evaseolianfilesdir = $(datadir)/eolian/include/evas-@VMAJ@
777#evaseolianfiles_DATA += $(evas_gl_generic_eolian_files)
778
754 779
755if EVAS_STATIC_BUILD_GL_COMMON 780if EVAS_STATIC_BUILD_GL_COMMON
756lib_evas_libevas_la_SOURCES += $(GL_COMMON_SOURCES) $(GL_GENERIC_SOURCES) 781lib_evas_libevas_la_SOURCES += $(GL_COMMON_SOURCES) $(GL_GENERIC_SOURCES)
@@ -776,6 +801,7 @@ modules_evas_engines_gl_generic_module_la_SOURCES = $(GL_GENERIC_SOURCES)
776modules_evas_engines_gl_generic_module_la_CFLAGS = \ 801modules_evas_engines_gl_generic_module_la_CFLAGS = \
777-I$(top_builddir)/src/lib/efl \ 802-I$(top_builddir)/src/lib/efl \
778-I$(top_srcdir)/src/lib/evas/include \ 803-I$(top_srcdir)/src/lib/evas/include \
804-I$(top_builddir)/src/lib/evas/include \
779-I$(top_srcdir)/src/lib/evas/cserve2 \ 805-I$(top_srcdir)/src/lib/evas/cserve2 \
780-I$(top_srcdir)/src/modules/evas/engines/gl_common \ 806-I$(top_srcdir)/src/modules/evas/engines/gl_common \
781-I$(top_builddir)/src/modules/evas/engines/gl_generic \ 807-I$(top_builddir)/src/modules/evas/engines/gl_generic \
diff --git a/src/lib/ector/ector_buffer.h b/src/lib/ector/ector_buffer.h
index 9399b17214..0db6cc7d69 100644
--- a/src/lib/ector/ector_buffer.h
+++ b/src/lib/ector/ector_buffer.h
@@ -14,6 +14,7 @@ typedef Ector_Generic_Buffer Ector_Buffer;
14 14
15typedef struct _Ector_Generic_Buffer_Data Ector_Generic_Buffer_Data; 15typedef struct _Ector_Generic_Buffer_Data Ector_Generic_Buffer_Data;
16typedef struct _Ector_Software_Buffer_Base_Data Ector_Software_Buffer_Base_Data; 16typedef struct _Ector_Software_Buffer_Base_Data Ector_Software_Buffer_Base_Data;
17typedef struct _Ector_GL_Buffer_Base_Data Ector_GL_Buffer_Base_Data;
17 18
18struct _Ector_Generic_Buffer_Data 19struct _Ector_Generic_Buffer_Data
19{ 20{
@@ -21,12 +22,12 @@ struct _Ector_Generic_Buffer_Data
21 unsigned int w, h; 22 unsigned int w, h;
22 unsigned char l, r, t, b; 23 unsigned char l, r, t, b;
23 Efl_Gfx_Colorspace cspace; 24 Efl_Gfx_Colorspace cspace;
24 Eina_Bool immutable : 1; // pixels_set is forbidden 25 Eina_Bool immutable : 1; // pixels_set is forbidden
25}; 26};
26 27
27struct _Ector_Software_Buffer_Base_Data 28struct _Ector_Software_Buffer_Base_Data
28{ 29{
29 Ector_Generic_Buffer_Data *generic; /* ugly */ 30 Ector_Generic_Buffer_Data *generic;
30 union { 31 union {
31 unsigned int *u32; 32 unsigned int *u32;
32 unsigned char *u8; 33 unsigned char *u8;
@@ -40,4 +41,17 @@ struct _Ector_Software_Buffer_Base_Data
40 Eina_Bool nofree : 1; // pixel data should not be free()'ed 41 Eina_Bool nofree : 1; // pixel data should not be free()'ed
41}; 42};
42 43
44struct _Ector_GL_Buffer_Base_Data
45{
46 Ector_Generic_Buffer_Data *generic;
47 int texid;
48 int fboid;
49 struct {
50 // x,y offset within the atlas
51 // w,h size of the atlas itself
52 int x, y, w, h;
53 } atlas;
54 Eina_Bool whole : 1;
55};
56
43#endif 57#endif
diff --git a/src/lib/ector/gl/ector_gl_buffer.c b/src/lib/ector/gl/ector_gl_buffer.c
index 19840f77b0..3f956b8a2b 100644
--- a/src/lib/ector/gl/ector_gl_buffer.c
+++ b/src/lib/ector/gl/ector_gl_buffer.c
@@ -10,14 +10,4 @@
10 10
11#define MY_CLASS ECTOR_GL_BUFFER_CLASS 11#define MY_CLASS ECTOR_GL_BUFFER_CLASS
12 12
13static Eo_Base *
14_ector_gl_buffer_eo_base_constructor(Eo *obj, void *pd)
15{
16}
17
18static void
19_ector_gl_buffer_eo_base_destructor(Eo *obj, void *pd)
20{
21}
22
23#include "ector_gl_buffer.eo.c" 13#include "ector_gl_buffer.eo.c"
diff --git a/src/lib/ector/gl/ector_gl_buffer.eo b/src/lib/ector/gl/ector_gl_buffer.eo
index e83fda41f1..aabeb09455 100644
--- a/src/lib/ector/gl/ector_gl_buffer.eo
+++ b/src/lib/ector/gl/ector_gl_buffer.eo
@@ -3,7 +3,5 @@ class Ector.GL.Buffer (Eo.Base, Ector.GL.Buffer.Base)
3 legacy_prefix: null; 3 legacy_prefix: null;
4 data: null; 4 data: null;
5 implements { 5 implements {
6 Eo.Base.constructor;
7 Eo.Base.destructor;
8 } 6 }
9} 7}
diff --git a/src/lib/ector/gl/ector_gl_buffer_base.c b/src/lib/ector/gl/ector_gl_buffer_base.c
index 81cd302d44..c55963a014 100644
--- a/src/lib/ector/gl/ector_gl_buffer_base.c
+++ b/src/lib/ector/gl/ector_gl_buffer_base.c
@@ -1,5 +1,6 @@
1#define EFL_BETA_API_SUPPORT 1#ifdef HAVE_CONFIG_H
2#include <Eo.h> 2# include "config.h"
3#endif
3 4
4#include "Ector_GL.h" 5#include "Ector_GL.h"
5#include "ector_gl_private.h" 6#include "ector_gl_private.h"
@@ -8,20 +9,6 @@
8 9
9#define MY_CLASS ECTOR_GL_BUFFER_BASE_MIXIN 10#define MY_CLASS ECTOR_GL_BUFFER_BASE_MIXIN
10 11
11typedef struct
12{
13 Ector_Generic_Buffer_Data *generic;
14 int texid;
15 int fboid;
16 int w, h; // Texture size, not the atlas
17 struct {
18 // x,y offset within the atlas
19 // w,h size of the atlas itself
20 int x, y, w, h;
21 } atlas;
22 Eina_Bool whole : 1;
23} Ector_GL_Buffer_Base_Data;
24
25EOLIAN static int 12EOLIAN static int
26_ector_gl_buffer_base_texture_get(Eo *obj EINA_UNUSED, Ector_GL_Buffer_Base_Data *pd) 13_ector_gl_buffer_base_texture_get(Eo *obj EINA_UNUSED, Ector_GL_Buffer_Base_Data *pd)
27{ 14{
@@ -43,8 +30,8 @@ _ector_gl_buffer_base_whole_get(Eo *obj EINA_UNUSED, Ector_GL_Buffer_Base_Data *
43EOLIAN static void 30EOLIAN static void
44_ector_gl_buffer_base_size_get(Eo *obj EINA_UNUSED, Ector_GL_Buffer_Base_Data *pd, int *w, int *h) 31_ector_gl_buffer_base_size_get(Eo *obj EINA_UNUSED, Ector_GL_Buffer_Base_Data *pd, int *w, int *h)
45{ 32{
46 if (w) *w = pd->w; 33 if (w) *w = pd->generic->w;
47 if (h) *h = pd->h; 34 if (h) *h = pd->generic->h;
48} 35}
49 36
50EOLIAN static void 37EOLIAN static void
@@ -52,8 +39,34 @@ _ector_gl_buffer_base_vertices_get(Eo *obj EINA_UNUSED, Ector_GL_Buffer_Base_Dat
52{ 39{
53 if (x) *x = (double) pd->atlas.x / pd->atlas.w; 40 if (x) *x = (double) pd->atlas.x / pd->atlas.w;
54 if (y) *y = (double) pd->atlas.y / pd->atlas.h; 41 if (y) *y = (double) pd->atlas.y / pd->atlas.h;
55 if (w) *w = (double) pd->w / pd->atlas.w; 42 if (w) *w = (double) pd->generic->w / pd->atlas.w;
56 if (h) *h = (double) pd->h / pd->atlas.h; 43 if (h) *h = (double) pd->generic->h / pd->atlas.h;
44}
45
46EOLIAN static void
47_ector_gl_buffer_base_attach(Eo *obj EINA_UNUSED, Ector_GL_Buffer_Base_Data *pd,
48 int texid, int fboid, Efl_Gfx_Colorspace cspace,
49 int imw, int imh, int tx, int ty, int tw, int th,
50 int l, int r, int t, int b)
51{
52 EINA_SAFETY_ON_NULL_RETURN(pd->generic);
53 EINA_SAFETY_ON_FALSE_RETURN(!pd->generic->immutable);
54
55 pd->generic->cspace = cspace;
56 pd->generic->w = imw;
57 pd->generic->h = imh;
58 pd->atlas.x = tx;
59 pd->atlas.y = ty;
60 pd->atlas.w = tw;
61 pd->atlas.h = th;
62 pd->generic->l = l;
63 pd->generic->r = r;
64 pd->generic->t = t;
65 pd->generic->b = b;
66 if (!(tx - l) && !(ty - t) && ((tw + l + r) == imw) && ((th + t + b) == imh))
67 pd->whole = EINA_TRUE;
68 pd->fboid = fboid;
69 pd->texid = texid;
57} 70}
58 71
59#include "ector_gl_buffer_base.eo.c" 72#include "ector_gl_buffer_base.eo.c"
diff --git a/src/lib/ector/gl/ector_gl_buffer_base.eo b/src/lib/ector/gl/ector_gl_buffer_base.eo
index 36562aeb8d..b78388057e 100644
--- a/src/lib/ector/gl/ector_gl_buffer_base.eo
+++ b/src/lib/ector/gl/ector_gl_buffer_base.eo
@@ -35,7 +35,10 @@ mixin Ector.GL.Buffer.Base (Ector.Generic.Buffer)
35 } 35 }
36 } 36 }
37 @property vertices { 37 @property vertices {
38 [[Returns the texture vertices to use to map this image with no rotation]] 38 [[Returns the texture vertices to draw this image with no rotation
39
40 The 4 points are then defined as (x,y), (x+w,y), (x,y+h), (x+w,y+h).
41 ]]
39 get {} 42 get {}
40 values { 43 values {
41 x: double; [[X position of this image inside the texture atlas, from 0 to 1]] 44 x: double; [[X position of this image inside the texture atlas, from 0 to 1]]
@@ -44,6 +47,24 @@ mixin Ector.GL.Buffer.Base (Ector.Generic.Buffer)
44 h: double; [[Height of this image inside the texture atlas, from 0 to 1]] 47 h: double; [[Height of this image inside the texture atlas, from 0 to 1]]
45 } 48 }
46 } 49 }
50 attach @protected {
51 [[Attach to an existing texture (or FBO). Used from child classes.]]
52 params {
53 texid: int;
54 fboid: int;
55 cspace: Efl.Gfx.Colorspace;
56 imw: int;
57 imh: int;
58 tx: int;
59 ty: int;
60 tw: int;
61 th: int;
62 l: int;
63 r: int;
64 t: int;
65 b: int;
66 }
67 }
47 } 68 }
48 implements { 69 implements {
49 } 70 }
diff --git a/src/lib/ector/gl/ector_gl_private.h b/src/lib/ector/gl/ector_gl_private.h
index e67b4d1e4f..4fcfb1c04f 100644
--- a/src/lib/ector/gl/ector_gl_private.h
+++ b/src/lib/ector/gl/ector_gl_private.h
@@ -1,6 +1,8 @@
1#ifndef ECTOR_GL_PRIVATE_H_ 1#ifndef ECTOR_GL_PRIVATE_H_
2# define ECTOR_GL_PRIVATE_H_ 2# define ECTOR_GL_PRIVATE_H_
3 3
4#define EVAS_GL_NO_HEADERS
5
4#include "ector_private.h" 6#include "ector_private.h"
5 7
6#define SHADER_FLAG_SAM_BITSHIFT 3 8#define SHADER_FLAG_SAM_BITSHIFT 3
diff --git a/src/modules/evas/engines/gl_common/evas_gl_common.h b/src/modules/evas/engines/gl_common/evas_gl_common.h
index 24a5c3a122..09b4cb54fd 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_common.h
+++ b/src/modules/evas/engines/gl_common/evas_gl_common.h
@@ -18,6 +18,8 @@
18# define MESA_EGL_NO_X11_HEADERS 18# define MESA_EGL_NO_X11_HEADERS
19#endif 19#endif
20 20
21#ifndef EVAS_GL_NO_HEADERS
22
21#ifdef BUILD_ENGINE_GL_COCOA 23#ifdef BUILD_ENGINE_GL_COCOA
22# include <OpenGL/gl.h> 24# include <OpenGL/gl.h>
23# include <OpenGL/glext.h> 25# include <OpenGL/glext.h>
@@ -41,6 +43,8 @@
41# endif 43# endif
42#endif 44#endif
43 45
46#endif
47
44#include "evas_gl_define.h" 48#include "evas_gl_define.h"
45 49
46#define EVAS_GL_TILE_SIZE 16 50#define EVAS_GL_TILE_SIZE 16
@@ -649,6 +653,7 @@ Evas_GL_Texture *evas_gl_common_texture_nv12tiled_new(Evas_Engine_GL_Context *g
649void evas_gl_common_texture_nv12tiled_update(Evas_GL_Texture *tex, DATA8 **row, unsigned int w, unsigned int h); 653void evas_gl_common_texture_nv12tiled_update(Evas_GL_Texture *tex, DATA8 **row, unsigned int w, unsigned int h);
650Evas_GL_Texture *evas_gl_common_texture_rgb_a_pair_new(Evas_Engine_GL_Context *gc, RGBA_Image *im); 654Evas_GL_Texture *evas_gl_common_texture_rgb_a_pair_new(Evas_Engine_GL_Context *gc, RGBA_Image *im);
651void evas_gl_common_texture_rgb_a_pair_update(Evas_GL_Texture *tex, RGBA_Image *im); 655void evas_gl_common_texture_rgb_a_pair_update(Evas_GL_Texture *tex, RGBA_Image *im);
656Evas_Colorspace evas_gl_common_gl_format_to_colorspace(GLuint f);
652 657
653void evas_gl_common_image_alloc_ensure(Evas_GL_Image *im); 658void evas_gl_common_image_alloc_ensure(Evas_GL_Image *im);
654Evas_GL_Image *evas_gl_common_image_load(Evas_Engine_GL_Context *gc, const char *file, const char *key, Evas_Image_Load_Opts *lo, int *error); 659Evas_GL_Image *evas_gl_common_image_load(Evas_Engine_GL_Context *gc, const char *file, const char *key, Evas_Image_Load_Opts *lo, int *error);
@@ -864,6 +869,8 @@ __evas_gl_errdyn(int err, const char *file, const char *func, int line, const ch
864Eina_Bool evas_gl_common_module_open(void); 869Eina_Bool evas_gl_common_module_open(void);
865void evas_gl_common_module_close(void); 870void evas_gl_common_module_close(void);
866 871
872#ifndef EVAS_GL_NO_HEADERS
873
867static inline void 874static inline void
868_tex_sub_2d(Evas_Engine_GL_Context *gc, int x, int y, int w, int h, int fmt, int type, const void *pix) 875_tex_sub_2d(Evas_Engine_GL_Context *gc, int x, int y, int w, int h, int fmt, int type, const void *pix)
869{ 876{
@@ -880,6 +887,8 @@ _comp_tex_sub_2d(Evas_Engine_GL_Context *gc, int x, int y, int w, int h, int fmt
880 glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, x, y, w, h, fmt, imgsize, pix); 887 glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, x, y, w, h, fmt, imgsize, pix);
881} 888}
882 889
890#endif
891
883#include "evas_gl_3d_common.h" 892#include "evas_gl_3d_common.h"
884 893
885#undef EAPI 894#undef EAPI
diff --git a/src/modules/evas/engines/gl_common/evas_gl_texture.c b/src/modules/evas/engines/gl_common/evas_gl_texture.c
index 9c31dda89a..f72a3e8cf9 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_texture.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_texture.c
@@ -161,6 +161,21 @@ _evas_gl_texture_search_format(Eina_Bool alpha, Eina_Bool bgra, Evas_Colorspace
161 return -1; 161 return -1;
162} 162}
163 163
164Evas_Colorspace
165evas_gl_common_gl_format_to_colorspace(GLuint f)
166{
167 unsigned i;
168
169 for (i = 0; i < sizeof(matching_format) / sizeof(matching_format[0]); i++)
170 {
171 if (*matching_format[i].format == f)
172 return matching_format[i].cspace;
173 }
174
175 ERR("Unknown texture format!");
176 return EVAS_COLORSPACE_ARGB8888;
177}
178
164static void 179static void
165_print_tex_count(void) 180_print_tex_count(void)
166{ 181{
diff --git a/src/modules/evas/engines/gl_generic/evas_ector_gl_buffer.c b/src/modules/evas/engines/gl_generic/evas_ector_gl_buffer.c
new file mode 100644
index 0000000000..4736e6592c
--- /dev/null
+++ b/src/modules/evas/engines/gl_generic/evas_ector_gl_buffer.c
@@ -0,0 +1,14 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4
5#include <gl/Ector_GL.h>
6#include "gl/ector_gl_private.h"
7#include "evas_common_private.h"
8#include "ector_buffer.h"
9#include "evas_ector_buffer.eo.h"
10#include "evas_ector_gl_buffer.eo.h"
11
12#define MY_CLASS EVAS_ECTOR_GL_BUFFER_CLASS
13
14#include "evas_ector_gl_buffer.eo.c"
diff --git a/src/modules/evas/engines/gl_generic/evas_ector_gl_buffer.eo b/src/modules/evas/engines/gl_generic/evas_ector_gl_buffer.eo
new file mode 100644
index 0000000000..6912657250
--- /dev/null
+++ b/src/modules/evas/engines/gl_generic/evas_ector_gl_buffer.eo
@@ -0,0 +1,5 @@
1class Evas.Ector.GL.Buffer (Eo.Base, Evas.Ector.Buffer, Ector.GL.Buffer.Base)
2{
3 legacy_prefix: null;
4 data: null;
5}
diff --git a/src/modules/evas/engines/gl_generic/evas_ector_gl_image_buffer.c b/src/modules/evas/engines/gl_generic/evas_ector_gl_image_buffer.c
new file mode 100644
index 0000000000..101f0d9b99
--- /dev/null
+++ b/src/modules/evas/engines/gl_generic/evas_ector_gl_image_buffer.c
@@ -0,0 +1,117 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4
5#define ECTOR_GL_BUFFER_BASE_PROTECTED
6
7#include <gl/Ector_GL.h>
8#include "gl/ector_gl_private.h"
9#include "evas_common_private.h"
10#include "../gl_common/evas_gl_common.h"
11#include "evas_private.h"
12#include "ector_buffer.h"
13
14#include "evas_ector_buffer.eo.h"
15#include "evas_ector_gl_buffer.eo.h"
16#include "evas_ector_gl_image_buffer.eo.h"
17
18#define MY_CLASS EVAS_ECTOR_GL_IMAGE_BUFFER_CLASS
19
20typedef struct
21{
22 Ector_GL_Buffer_Base_Data *base;
23 Evas *evas;
24 Evas_GL_Image *image;
25} Evas_Ector_GL_Image_Buffer_Data;
26
27#define ENFN e->engine.func
28#define ENDT e->engine.data.output
29
30EOLIAN static void
31_evas_ector_gl_image_buffer_evas_ector_buffer_engine_image_set(Eo *obj, Evas_Ector_GL_Image_Buffer_Data *pd,
32 Evas *evas, void *image)
33{
34 Evas_Public_Data *e = eo_data_scope_get(evas, EVAS_CANVAS_CLASS);
35 Evas_GL_Image *im = image;
36 int l = 0, r = 0, t = 0, b = 0;
37
38 if (pd->base->generic->immutable)
39 {
40 CRI("Can't set image after finalize");
41 return;
42 }
43
44 pd->evas = eo_xref(evas, obj);
45 pd->image = ENFN->image_ref(ENDT, im);
46 if (!pd->image) return;
47
48 if (im->tex && im->tex->pt)
49 {
50 if (im->im)
51 {
52 l = im->im->cache_entry.borders.l;
53 r = im->im->cache_entry.borders.r;
54 t = im->im->cache_entry.borders.t;
55 b = im->im->cache_entry.borders.b;
56 }
57 else
58 {
59 // always 1 pixel border, except FBO
60 if (!im->tex->pt->fb)
61 l = r = t = b = 1;
62 }
63 eo_do(obj, ector_gl_buffer_base_attach(im->tex->pt->texture,
64 im->tex->pt->fb,
65 evas_gl_common_gl_format_to_colorspace(im->tex->pt->format),
66 im->tex->w, im->tex->h,
67 im->tex->x, im->tex->y,
68 im->tex->pt->w, im->tex->pt->h,
69 l, r, t, b));
70 }
71 else
72 {
73 ERR("What do we do now?");
74 }
75}
76
77EOLIAN static void
78_evas_ector_gl_image_buffer_evas_ector_buffer_engine_image_get(Eo *obj EINA_UNUSED,
79 Evas_Ector_GL_Image_Buffer_Data *pd,
80 Evas **evas, void **image)
81{
82 if (evas) *evas = pd->evas;
83 if (image) *image = pd->image;
84}
85
86EOLIAN static Eo_Base *
87_evas_ector_gl_image_buffer_eo_base_constructor(Eo *obj, Evas_Ector_GL_Image_Buffer_Data *pd)
88{
89 eo_do_super(obj, MY_CLASS, obj = eo_constructor());
90 pd->base = eo_data_ref(obj, ECTOR_GL_BUFFER_CLASS);
91 pd->base->generic = eo_data_ref(obj, ECTOR_GENERIC_BUFFER_MIXIN);
92 pd->base->generic->eo = obj;
93 return obj;
94}
95
96EOLIAN static Eo_Base *
97_evas_ector_gl_image_buffer_eo_base_finalize(Eo *obj, Evas_Ector_GL_Image_Buffer_Data *pd)
98{
99 EINA_SAFETY_ON_NULL_RETURN_VAL(pd->base, NULL);
100 EINA_SAFETY_ON_NULL_RETURN_VAL(pd->image, NULL);
101 pd->base->generic->immutable = EINA_TRUE;
102 return eo_do_super_ret(obj, MY_CLASS, obj, eo_finalize());
103}
104
105EOLIAN static void
106_evas_ector_gl_image_buffer_eo_base_destructor(Eo *obj, Evas_Ector_GL_Image_Buffer_Data *pd)
107{
108 Evas_Public_Data *e = eo_data_scope_get(pd->evas, EVAS_CANVAS_CLASS);
109
110 eo_data_unref(obj, pd->base->generic);
111 eo_data_unref(obj, pd->base);
112 ENFN->image_free(ENDT, pd->image);
113 eo_xunref(pd->evas, obj);
114 eo_do_super(obj, MY_CLASS, eo_destructor());
115}
116
117#include "evas_ector_gl_image_buffer.eo.c"
diff --git a/src/modules/evas/engines/gl_generic/evas_ector_gl_image_buffer.eo b/src/modules/evas/engines/gl_generic/evas_ector_gl_image_buffer.eo
new file mode 100644
index 0000000000..0b72cda8a9
--- /dev/null
+++ b/src/modules/evas/engines/gl_generic/evas_ector_gl_image_buffer.eo
@@ -0,0 +1,12 @@
1class Evas.Ector.GL.Image.Buffer (Evas.Ector.GL.Buffer)
2{
3 [[An Ector GL buffer wrapping an existing Evas_GL_Image.]]
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_ector_software_buffer.c b/src/modules/evas/engines/software_generic/evas_ector_software_buffer.c
index 44ebf8fbd3..22efa05329 100644
--- a/src/modules/evas/engines/software_generic/evas_ector_software_buffer.c
+++ b/src/modules/evas/engines/software_generic/evas_ector_software_buffer.c
@@ -15,7 +15,7 @@
15typedef struct { 15typedef struct {
16 Ector_Software_Buffer_Base_Data *base; 16 Ector_Software_Buffer_Base_Data *base;
17 Evas *evas; 17 Evas *evas;
18 Image_Entry *ie; 18 Image_Entry *image;
19} Evas_Ector_Software_Buffer_Data; 19} Evas_Ector_Software_Buffer_Data;
20 20
21#define ENFN e->engine.func 21#define ENFN e->engine.func
@@ -44,8 +44,8 @@ _evas_ector_software_buffer_evas_ector_buffer_engine_image_set(Eo *obj, Evas_Ect
44 } 44 }
45 45
46 pd->evas = eo_xref(evas, obj); 46 pd->evas = eo_xref(evas, obj);
47 pd->ie = ENFN->image_ref(ENDT, ie); 47 pd->image = ENFN->image_ref(ENDT, ie);
48 if (!pd->ie) return; 48 if (!pd->image) return;
49 49
50 eo_do(obj, ector_buffer_pixels_set(im->image.data, 50 eo_do(obj, ector_buffer_pixels_set(im->image.data,
51 im->cache_entry.w, im->cache_entry.h, 0, 51 im->cache_entry.w, im->cache_entry.h, 0,
@@ -59,7 +59,7 @@ _evas_ector_software_buffer_evas_ector_buffer_engine_image_get(Eo *obj EINA_UNUS
59 Evas **evas, void **image) 59 Evas **evas, void **image)
60{ 60{
61 if (evas) *evas = pd->evas; 61 if (evas) *evas = pd->evas;
62 if (image) *image = pd->ie; 62 if (image) *image = pd->image;
63} 63}
64 64
65EOLIAN static Eo * 65EOLIAN static Eo *
@@ -73,11 +73,8 @@ _evas_ector_software_buffer_eo_base_constructor(Eo *obj, Evas_Ector_Software_Buf
73EOLIAN static Eo * 73EOLIAN static Eo *
74_evas_ector_software_buffer_eo_base_finalize(Eo *obj, Evas_Ector_Software_Buffer_Data *pd) 74_evas_ector_software_buffer_eo_base_finalize(Eo *obj, Evas_Ector_Software_Buffer_Data *pd)
75{ 75{
76 if (!pd->ie) 76 EINA_SAFETY_ON_NULL_RETURN_VAL(pd->base, NULL);
77 { 77 EINA_SAFETY_ON_NULL_RETURN_VAL(pd->image, NULL);
78 CRI("engine_image must be set at construction time only");
79 return NULL;
80 }
81 pd->base->generic->immutable = EINA_TRUE; 78 pd->base->generic->immutable = EINA_TRUE;
82 return eo_do_super_ret(obj, MY_CLASS, obj, eo_finalize()); 79 return eo_do_super_ret(obj, MY_CLASS, obj, eo_finalize());
83} 80}
@@ -88,7 +85,7 @@ _evas_ector_software_buffer_eo_base_destructor(Eo *obj, Evas_Ector_Software_Buff
88 Evas_Public_Data *e = eo_data_scope_get(pd->evas, EVAS_CANVAS_CLASS); 85 Evas_Public_Data *e = eo_data_scope_get(pd->evas, EVAS_CANVAS_CLASS);
89 86
90 eo_data_xunref(obj, pd->base, obj); 87 eo_data_xunref(obj, pd->base, obj);
91 ENFN->image_free(ENDT, pd->ie); 88 ENFN->image_free(ENDT, pd->image);
92 eo_xunref(pd->evas, obj); 89 eo_xunref(pd->evas, obj);
93 eo_do_super(obj, MY_CLASS, eo_destructor()); 90 eo_do_super(obj, MY_CLASS, eo_destructor());
94} 91}