summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2015-12-16 16:44:57 -0800
committerCedric BAIL <cedric@osg.samsung.com>2016-01-04 01:12:19 +0100
commit0852f9b873913ae30b6783d830458bf86f5d9761 (patch)
treefc740be443cd521d066fea031eda0f82588e63c5
parent491a4b51e241961e6308559c15054a0fc46e4614 (diff)
downloadefl-0852f9b873913ae30b6783d830458bf86f5d9761.tar.gz
ector: add Ector.GL.Buffer.* support.
-rw-r--r--src/Makefile_Ector.am5
-rw-r--r--src/lib/ector/ector_buffer.h11
-rw-r--r--src/lib/ector/gl/Ector_GL.h4
-rw-r--r--src/lib/ector/gl/ector_gl_buffer.c43
-rw-r--r--src/lib/ector/gl/ector_gl_buffer_base.c59
-rw-r--r--src/lib/ector/gl/ector_gl_buffer_base.eo54
-rw-r--r--src/lib/ector/gl/ector_gl_buffer_fbo.c138
-rw-r--r--src/lib/ector/gl/ector_gl_buffer_fbo.eo33
-rw-r--r--src/lib/ector/gl/ector_gl_buffer_tex.c116
-rw-r--r--src/lib/ector/gl/ector_gl_buffer_tex.eo37
-rw-r--r--src/lib/ector/gl/ector_gl_private.h2
-rw-r--r--src/lib/ector/software/ector_software_buffer.c4
12 files changed, 449 insertions, 57 deletions
diff --git a/src/Makefile_Ector.am b/src/Makefile_Ector.am
index e404df3402..ce9d9eca4f 100644
--- a/src/Makefile_Ector.am
+++ b/src/Makefile_Ector.am
@@ -38,6 +38,8 @@ ector_eolian_files_gl = \
lib/ector/gl/ector_gl_surface.eo \
lib/ector/gl/ector_gl_buffer.eo \
lib/ector/gl/ector_gl_buffer_base.eo \
+ lib/ector/gl/ector_gl_buffer_fbo.eo \
+ lib/ector/gl/ector_gl_buffer_tex.eo \
lib/ector/gl/ector_renderer_gl_base.eo \
lib/ector/gl/ector_renderer_gl_shape.eo \
lib/ector/gl/ector_renderer_gl_gradient_radial.eo \
@@ -134,6 +136,9 @@ lib/ector/gl/ector_renderer_gl_gradient_radial.c \
lib/ector/gl/ector_renderer_gl_shape.c \
lib/ector/gl/ector_renderer_gl_base.c \
lib/ector/gl/ector_gl_buffer.c \
+lib/ector/gl/ector_gl_buffer_base.c \
+lib/ector/gl/ector_gl_buffer_tex.c \
+lib/ector/gl/ector_gl_buffer_fbo.c \
lib/ector/gl/ector_gl_surface.c \
lib/ector/gl/ector_gl_private.h \
lib/ector/gl/shader/ector_gl_shaders.x \
diff --git a/src/lib/ector/ector_buffer.h b/src/lib/ector/ector_buffer.h
index 0e12c79f68..9399b17214 100644
--- a/src/lib/ector/ector_buffer.h
+++ b/src/lib/ector/ector_buffer.h
@@ -12,16 +12,19 @@
*/
typedef Ector_Generic_Buffer Ector_Buffer;
-typedef struct _Ector_Generic_Buffer_Data
+typedef struct _Ector_Generic_Buffer_Data Ector_Generic_Buffer_Data;
+typedef struct _Ector_Software_Buffer_Base_Data Ector_Software_Buffer_Base_Data;
+
+struct _Ector_Generic_Buffer_Data
{
Ector_Buffer *eo;
unsigned int w, h;
unsigned char l, r, t, b;
Efl_Gfx_Colorspace cspace;
Eina_Bool immutable : 1; // pixels_set is forbidden
-} Ector_Generic_Buffer_Data;
+};
-typedef struct _Ector_Software_Buffer_Base_Data
+struct _Ector_Software_Buffer_Base_Data
{
Ector_Generic_Buffer_Data *generic; /* ugly */
union {
@@ -35,6 +38,6 @@ typedef struct _Ector_Software_Buffer_Base_Data
} internal;
Eina_Bool writable : 1; // pixels can be written to
Eina_Bool nofree : 1; // pixel data should not be free()'ed
-} Ector_Software_Buffer_Base_Data;
+};
#endif
diff --git a/src/lib/ector/gl/Ector_GL.h b/src/lib/ector/gl/Ector_GL.h
index df49421813..e6dee3b649 100644
--- a/src/lib/ector/gl/Ector_GL.h
+++ b/src/lib/ector/gl/Ector_GL.h
@@ -13,8 +13,10 @@ typedef Eo Ector_Cairo_Surface;
typedef unsigned int GLuint;
typedef short GLshort;
-#include "gl/ector_gl_buffer.eo.h"
#include "gl/ector_gl_buffer_base.eo.h"
+#include "gl/ector_gl_buffer_tex.eo.h"
+#include "gl/ector_gl_buffer_fbo.eo.h"
+#include "gl/ector_gl_buffer.eo.h"
#include "gl/ector_gl_surface.eo.h"
#include "gl/ector_renderer_gl_base.eo.h"
#include "gl/ector_renderer_gl_shape.eo.h"
diff --git a/src/lib/ector/gl/ector_gl_buffer.c b/src/lib/ector/gl/ector_gl_buffer.c
index e3732b9c74..19840f77b0 100644
--- a/src/lib/ector/gl/ector_gl_buffer.c
+++ b/src/lib/ector/gl/ector_gl_buffer.c
@@ -1,50 +1,14 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
-#else
-# define EFL_BETA_API_SUPPORT
#endif
-#include <Eo.h>
+#include <Ector.h>
#include "Ector_GL.h"
#include "ector_private.h"
#include "ector_gl_private.h"
-#include "ector_generic_buffer.eo.h"
-#include "ector_gl_buffer_base.eo.h"
+#include "ector_buffer.h"
-typedef struct _Ector_GL_Buffer_Base_Data Ector_GL_Buffer_Base_Data;
-struct _Ector_GL_Buffer_Base_Data
-{
-};
-
-static Ector_Buffer_Flag
-_ector_gl_buffer_base_ector_generic_buffer_flags_get(Eo *obj, Ector_GL_Buffer_Base_Data *pd)
-{
-}
-
-static Eina_Bool
-_ector_gl_buffer_base_ector_generic_buffer_pixels_set(Eo *obj, Ector_GL_Buffer_Base_Data *pd, void *pixels, int width, int height, int stride, Efl_Gfx_Colorspace cspace, Eina_Bool writable, unsigned char l, unsigned char r, unsigned char t, unsigned char b)
-{
-}
-
-static uint8_t *
-_ector_gl_buffer_base_ector_generic_buffer_span_get(Eo *obj, Ector_GL_Buffer_Base_Data *pd, int x, int y, unsigned int w, Efl_Gfx_Colorspace cspace, unsigned int *length)
-{
-}
-
-static void
-_ector_gl_buffer_base_ector_generic_buffer_span_free(Eo *obj, Ector_GL_Buffer_Base_Data *pd, uint8_t *data)
-{
-}
-
-static uint8_t *
-_ector_gl_buffer_base_ector_generic_buffer_map(Eo *obj, Ector_GL_Buffer_Base_Data *pd, int *offset, unsigned int *length, Ector_Buffer_Access_Flag mode, unsigned int x, unsigned int y, unsigned int w, unsigned int h, Efl_Gfx_Colorspace cspace, unsigned int *stride)
-{
-}
-
-static void
-_ector_gl_buffer_base_ector_generic_buffer_unmap(Eo *obj, Ector_GL_Buffer_Base_Data *pd, void *data, int offset, unsigned int length)
-{
-}
+#define MY_CLASS ECTOR_GL_BUFFER_CLASS
static Eo_Base *
_ector_gl_buffer_eo_base_constructor(Eo *obj, void *pd)
@@ -57,4 +21,3 @@ _ector_gl_buffer_eo_base_destructor(Eo *obj, void *pd)
}
#include "ector_gl_buffer.eo.c"
-#include "ector_gl_buffer_base.eo.c"
diff --git a/src/lib/ector/gl/ector_gl_buffer_base.c b/src/lib/ector/gl/ector_gl_buffer_base.c
new file mode 100644
index 0000000000..81cd302d44
--- /dev/null
+++ b/src/lib/ector/gl/ector_gl_buffer_base.c
@@ -0,0 +1,59 @@
+#define EFL_BETA_API_SUPPORT
+#include <Eo.h>
+
+#include "Ector_GL.h"
+#include "ector_gl_private.h"
+#include "ector_buffer.h"
+#include "ector_gl_buffer_base.eo.h"
+
+#define MY_CLASS ECTOR_GL_BUFFER_BASE_MIXIN
+
+typedef struct
+{
+ Ector_Generic_Buffer_Data *generic;
+ int texid;
+ int fboid;
+ int w, h; // Texture size, not the atlas
+ struct {
+ // x,y offset within the atlas
+ // w,h size of the atlas itself
+ int x, y, w, h;
+ } atlas;
+ Eina_Bool whole : 1;
+} Ector_GL_Buffer_Base_Data;
+
+EOLIAN static int
+_ector_gl_buffer_base_texture_get(Eo *obj EINA_UNUSED, Ector_GL_Buffer_Base_Data *pd)
+{
+ return pd->texid;
+}
+
+EOLIAN static int
+_ector_gl_buffer_base_fbo_get(Eo *obj EINA_UNUSED, Ector_GL_Buffer_Base_Data *pd)
+{
+ return pd->fboid;
+}
+
+EOLIAN static Eina_Bool
+_ector_gl_buffer_base_whole_get(Eo *obj EINA_UNUSED, Ector_GL_Buffer_Base_Data *pd)
+{
+ return pd->whole;
+}
+
+EOLIAN static void
+_ector_gl_buffer_base_size_get(Eo *obj EINA_UNUSED, Ector_GL_Buffer_Base_Data *pd, int *w, int *h)
+{
+ if (w) *w = pd->w;
+ if (h) *h = pd->h;
+}
+
+EOLIAN static void
+_ector_gl_buffer_base_vertices_get(Eo *obj EINA_UNUSED, Ector_GL_Buffer_Base_Data *pd, double *x, double *y, double *w, double *h)
+{
+ if (x) *x = (double) pd->atlas.x / pd->atlas.w;
+ if (y) *y = (double) pd->atlas.y / pd->atlas.h;
+ if (w) *w = (double) pd->w / pd->atlas.w;
+ if (h) *h = (double) pd->h / pd->atlas.h;
+}
+
+#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 441f7814fe..36562aeb8d 100644
--- a/src/lib/ector/gl/ector_gl_buffer_base.eo
+++ b/src/lib/ector/gl/ector_gl_buffer_base.eo
@@ -1,14 +1,50 @@
mixin Ector.GL.Buffer.Base (Ector.Generic.Buffer)
{
- [[A buffer in Ector GL is a readable & optionally writable image]]
- eo_prefix: ector_gl_buffer;
legacy_prefix: null;
+ methods {
+ @property texture {
+ get {}
+ values {
+ texid: int; [[GL texture ID]]
+ }
+ }
+ @property fbo {
+ get {}
+ values {
+ fboid: int; [[GL framebuffer ID, 0 if there is no FBO]]
+ }
+ }
+ @property whole {
+ [[If $true, the image is covering the entire GL texture, ie. it's not
+ part of an atlas.
+ ]]
+ get {}
+ values {
+ is_whole: bool;
+ }
+ }
+ @property size {
+ [[The size in pixels of this image.
+
+ If the image is whole, then this is equal to the atlas size.
+ ]]
+ get {}
+ values {
+ w: int;
+ h: int;
+ }
+ }
+ @property vertices {
+ [[Returns the texture vertices to use to map this image with no rotation]]
+ get {}
+ values {
+ x: double; [[X position of this image inside the texture atlas, from 0 to 1]]
+ y: double; [[Y position of this image inside the texture atlas, from 0 to 1]]
+ w: double; [[Width of this image inside the texture atlas, from 0 to 1]]
+ h: double; [[Height of this image inside the texture atlas, from 0 to 1]]
+ }
+ }
+ }
implements {
- Ector.Generic.Buffer.flags.get;
- Ector.Generic.Buffer.pixels_set;
- Ector.Generic.Buffer.span_get;
- Ector.Generic.Buffer.span_free;
- Ector.Generic.Buffer.map;
- Ector.Generic.Buffer.unmap;
- }
+ }
}
diff --git a/src/lib/ector/gl/ector_gl_buffer_fbo.c b/src/lib/ector/gl/ector_gl_buffer_fbo.c
new file mode 100644
index 0000000000..67e11cd577
--- /dev/null
+++ b/src/lib/ector/gl/ector_gl_buffer_fbo.c
@@ -0,0 +1,138 @@
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#else
+# define EFL_BETA_API_SUPPORT
+# include <Eo.h>
+#endif
+
+#include <Ector.h>
+#include "ector_gl_private.h"
+#include "ector_gl_buffer_fbo.eo.h"
+
+#define MY_CLASS ECTOR_GL_BUFFER_FBO_CLASS
+
+typedef struct
+{
+ Ector_Generic_Buffer_Data *generic;
+ unsigned int fbo, tex;
+ Eina_Bool bgra;
+} Ector_Gl_Buffer_Fbo_Data;
+
+EOLIAN static void *
+_ector_gl_buffer_fbo_ector_generic_buffer_map(Eo *obj, Ector_Gl_Buffer_Fbo_Data *pd, unsigned int *length, Ector_Buffer_Access_Flag mode, unsigned int x, unsigned int y, unsigned int w, unsigned int h, Efl_Gfx_Colorspace cspace, unsigned int *stride)
+{
+
+}
+
+EOLIAN static void
+_ector_gl_buffer_fbo_ector_generic_buffer_unmap(Eo *obj, Ector_Gl_Buffer_Fbo_Data *pd, void *data, unsigned int length)
+{
+
+}
+
+EOLIAN static Eina_Bool
+_ector_gl_buffer_fbo_ector_generic_buffer_pixels_set(Eo *obj, Ector_Gl_Buffer_Fbo_Data *pd, void *pixels, int width, int height, int stride, Efl_Gfx_Colorspace cspace, Eina_Bool writable, unsigned char l, unsigned char r, unsigned char t, unsigned char b)
+{
+
+}
+
+EOLIAN static uint8_t *
+_ector_gl_buffer_fbo_ector_generic_buffer_span_get(Eo *obj, Ector_Gl_Buffer_Fbo_Data *pd, int x, int y, unsigned int w, Efl_Gfx_Colorspace cspace, unsigned int *length)
+{
+
+}
+
+EOLIAN static void
+_ector_gl_buffer_fbo_ector_generic_buffer_span_free(Eo *obj, Ector_Gl_Buffer_Fbo_Data *pd, uint8_t *data)
+{
+
+}
+
+EOLIAN static Ector_Buffer_Flag
+_ector_gl_buffer_fbo_ector_generic_buffer_flags_get(Eo *obj, Ector_Gl_Buffer_Fbo_Data *pd)
+{
+
+}
+
+EOLIAN static Eina_Bool
+_ector_gl_buffer_fbo_generate(Eo *obj, Ector_Gl_Buffer_Fbo_Data *pd, int width, int height, Eina_Bool bgra)
+{
+ int fnum, tnum, fmt;
+ Eina_Bool ret;
+
+ if (pd->generic->immutable)
+ return EINA_FALSE;
+
+ pd->bgra = bgra;
+ if (pd->bgra)
+ fmt = GL_BGRA_EXT;
+ else
+ fmt = GL_RGBA;
+
+ GL.glGetIntegerv(GL_FRAMEBUFFER_BINDING, &fnum);
+ GL.glGetIntegerv(GL_TEXTURE_BINDING_2D, &tnum);
+
+ GL.glGenTextures(1, &pd->tex);
+ GL.glBindTexture(GL_TEXTURE_2D, pd->tex);
+ GL.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ GL.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ GL.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ GL.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ GL.glTexImage2D(GL_TEXTURE_2D, 0, fmt, width, height, 0, fmt, GL_UNSIGNED_BYTE, NULL);
+
+ GL.glGenFramebuffers(1, &pd->fbo);
+ GL.glBindFramebuffer(GL_FRAMEBUFFER, pd->fbo);
+ GL.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, pd->tex, 0);
+
+ GL.glBindFramebuffer(GL_FRAMEBUFFER, fnum);
+ GL.glBindTexture(GL_TEXTURE_2D, tnum);
+
+ return EINA_TRUE;
+}
+
+EOLIAN static Eina_Bool
+_ector_gl_buffer_fbo_attach(Eo *obj, Ector_Gl_Buffer_Fbo_Data *pd, unsigned int fbo)
+{
+ Eina_Bool ret;
+ if (eo_do_ret(obj, ret, eo_finalized_get()))
+ {
+ ERR("Can not change attached FBO");
+ return EINA_FALSE;
+ }
+
+ // note: no references in GL, good luck.
+ pd->fbo = fbo;
+
+ return EINA_TRUE;
+}
+
+EOLIAN static Eo_Base *
+_ector_gl_buffer_fbo_eo_base_constructor(Eo *obj, Ector_Gl_Buffer_Fbo_Data *pd)
+{
+ if (!GL.init) return NULL;
+ eo_do_super(obj, MY_CLASS, obj = eo_constructor());
+ pd->generic = eo_data_ref(obj, ECTOR_GENERIC_BUFFER_MIXIN);
+ return obj;
+}
+
+EOLIAN static Eo_Base *
+_ector_gl_buffer_fbo_eo_base_finalize(Eo *obj, Ector_Gl_Buffer_Fbo_Data *pd)
+{
+ if (!pd->fbo)
+ {
+ CRI("FBO buffer not attached to any FBO");
+ return NULL;
+ }
+ pd->generic->immutable = EINA_TRUE;
+ eo_do_super(obj, MY_CLASS, obj = eo_finalize());
+ return obj;
+}
+
+EOLIAN static void
+_ector_gl_buffer_fbo_eo_base_destructor(Eo *obj, Ector_Gl_Buffer_Fbo_Data *pd)
+{
+ eo_data_unref(obj, pd->generic);
+ eo_do_super(obj, MY_CLASS, eo_destructor());
+}
+
+#include "ector_gl_buffer_fbo.eo.c"
diff --git a/src/lib/ector/gl/ector_gl_buffer_fbo.eo b/src/lib/ector/gl/ector_gl_buffer_fbo.eo
new file mode 100644
index 0000000000..1c371b34fb
--- /dev/null
+++ b/src/lib/ector/gl/ector_gl_buffer_fbo.eo
@@ -0,0 +1,33 @@
+class Ector.Gl.Buffer.Fbo (Eo.Base, Ector.Generic.Buffer)
+{
+ legacy_prefix: null;
+ methods {
+ generate {
+ [[Create a new FBO from scratch given its size]]
+ params {
+ width: int;
+ height: int;
+ bgra: bool; [[Evas should know whether BGRA is supported or not]]
+ }
+ return: bool; [[$true in case of success]]
+ }
+ attach {
+ [[Attach to an existing FBO. Beware of other references.]]
+ params {
+ fbo: uint;
+ }
+ return: bool;
+ }
+ }
+ implements {
+ Eo.Base.constructor;
+ Eo.Base.finalize;
+ Eo.Base.destructor;
+ Ector.Generic.Buffer.map;
+ Ector.Generic.Buffer.unmap;
+ Ector.Generic.Buffer.pixels_set;
+ Ector.Generic.Buffer.span_get;
+ Ector.Generic.Buffer.span_free;
+ Ector.Generic.Buffer.flags.get;
+ }
+}
diff --git a/src/lib/ector/gl/ector_gl_buffer_tex.c b/src/lib/ector/gl/ector_gl_buffer_tex.c
new file mode 100644
index 0000000000..fa448f5c3b
--- /dev/null
+++ b/src/lib/ector/gl/ector_gl_buffer_tex.c
@@ -0,0 +1,116 @@
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <Ector.h>
+#include "ector_private.h"
+#include "ector_gl_private.h"
+#include "ector_buffer.h"
+#include "ector_gl_buffer_tex.eo.h"
+
+#define MY_CLASS ECTOR_GL_BUFFER_TEX_CLASS
+
+typedef struct
+{
+ Ector_Generic_Buffer_Data *generic;
+ unsigned int tex;
+ Eina_Bool nodel; // if true, don't delete this tex id, it belongs to evas
+} Ector_Gl_Buffer_Tex_Data;
+
+EOLIAN static Eina_Bool
+_ector_gl_buffer_tex_attach(Eo *obj EINA_UNUSED, Ector_Gl_Buffer_Tex_Data *pd,
+ unsigned int tex, int width, int height,
+ int l, int r, int t, int b,
+ int tex_x, int tex_y, int tex_w, int tex_h,
+ int atlas_w, int atlas_h,
+ Efl_Gfx_Colorspace cspace)
+{
+ if (pd->generic->immutable)
+ return EINA_FALSE;
+
+ pd->nodel = EINA_TRUE;
+ pd->tex = tex;
+ pd->generic->cspace = cspace;
+ pd->generic->w = width;
+ pd->generic->h = height;
+
+ return EINA_TRUE;
+}
+
+EOLIAN static Eina_Bool
+_ector_gl_buffer_tex_ector_generic_buffer_pixels_set(Eo *obj, Ector_Gl_Buffer_Tex_Data *pd,
+ void *pixels, int width, int height,
+ int stride, Efl_Gfx_Colorspace cspace,
+ Eina_Bool writable,
+ unsigned char l, unsigned char r,
+ unsigned char t, unsigned char b)
+{
+ if (pd->generic->immutable)
+ return EINA_FALSE;
+
+ GL.glGenTextures(1, &pd->tex);
+
+
+ return EINA_TRUE;
+}
+
+EOLIAN static void *
+_ector_gl_buffer_tex_ector_generic_buffer_map(Eo *obj, Ector_Gl_Buffer_Tex_Data *pd, unsigned int *length, Ector_Buffer_Access_Flag mode, unsigned int x, unsigned int y, unsigned int w, unsigned int h, Efl_Gfx_Colorspace cspace, unsigned int *stride)
+{
+
+}
+
+EOLIAN static void
+_ector_gl_buffer_tex_ector_generic_buffer_unmap(Eo *obj, Ector_Gl_Buffer_Tex_Data *pd, void *data, unsigned int length)
+{
+
+}
+
+EOLIAN static uint8_t *
+_ector_gl_buffer_tex_ector_generic_buffer_span_get(Eo *obj, Ector_Gl_Buffer_Tex_Data *pd, int x, int y, unsigned int w, Efl_Gfx_Colorspace cspace, unsigned int *length)
+{
+
+}
+
+EOLIAN static void
+_ector_gl_buffer_tex_ector_generic_buffer_span_free(Eo *obj, Ector_Gl_Buffer_Tex_Data *pd, uint8_t *data)
+{
+
+}
+
+EOLIAN static Ector_Buffer_Flag
+_ector_gl_buffer_tex_ector_generic_buffer_flags_get(Eo *obj EINA_UNUSED, Ector_Gl_Buffer_Tex_Data *pd)
+{
+ return ECTOR_BUFFER_FLAG_CPU_READABLE | ECTOR_BUFFER_FLAG_DRAWABLE;
+}
+
+EOLIAN static Eo_Base *
+_ector_gl_buffer_tex_eo_base_constructor(Eo *obj, Ector_Gl_Buffer_Tex_Data *pd)
+{
+ EINA_SAFETY_ON_FALSE_RETURN_VAL(GL.init, NULL);
+ eo_do_super(obj, MY_CLASS, obj = eo_constructor());
+ pd->generic = eo_data_ref(obj, ECTOR_GENERIC_BUFFER_MIXIN);
+ return obj;
+}
+
+EOLIAN static Eo_Base *
+_ector_gl_buffer_tex_eo_base_finalize(Eo *obj, Ector_Gl_Buffer_Tex_Data *pd)
+{
+ if (!pd->tex)
+ {
+ CRI("FBO buffer not attached to any FBO");
+ return NULL;
+ }
+ pd->generic->immutable = EINA_TRUE;
+ eo_do_super(obj, MY_CLASS, obj = eo_finalize());
+ return obj;
+}
+
+EOLIAN static void
+_ector_gl_buffer_tex_eo_base_destructor(Eo *obj, Ector_Gl_Buffer_Tex_Data *pd)
+{
+ eo_data_unref(obj, pd->generic);
+ eo_do_super(obj, MY_CLASS, eo_destructor());
+}
+
+#include "ector_gl_buffer_tex.eo.c"
diff --git a/src/lib/ector/gl/ector_gl_buffer_tex.eo b/src/lib/ector/gl/ector_gl_buffer_tex.eo
new file mode 100644
index 0000000000..cb312dbbb0
--- /dev/null
+++ b/src/lib/ector/gl/ector_gl_buffer_tex.eo
@@ -0,0 +1,37 @@
+class Ector.Gl.Buffer.Tex (Eo.Base, Ector.Generic.Buffer)
+{
+ legacy_prefix: null;
+ methods {
+ attach {
+ [[Attach to an existing texture. Beware of other references.]]
+ params {
+ tex: uint;
+ width: int;
+ height: int;
+ l: int;
+ r: int;
+ t: int;
+ b: int;
+ tex_x: int; [[Coordinate inside the texture atlas]]
+ tex_y: int; [[Coordinate inside the texture atlas]]
+ tex_w: int; [[Coordinate inside the texture atlas]]
+ tex_h: int; [[Coordinate inside the texture atlas]]
+ atlas_w: int; [[Size of the texture atlas]]
+ atlas_h: int; [[Size of the texture atlas]]
+ cspace: Efl.Gfx.Colorspace;
+ }
+ return: bool;
+ }
+ }
+ implements {
+ Eo.Base.constructor;
+ Eo.Base.finalize;
+ Eo.Base.destructor;
+ Ector.Generic.Buffer.map;
+ Ector.Generic.Buffer.unmap;
+ Ector.Generic.Buffer.pixels_set;
+ Ector.Generic.Buffer.span_get;
+ Ector.Generic.Buffer.span_free;
+ Ector.Generic.Buffer.flags.get;
+ }
+}
diff --git a/src/lib/ector/gl/ector_gl_private.h b/src/lib/ector/gl/ector_gl_private.h
index 0362e7e723..e67b4d1e4f 100644
--- a/src/lib/ector/gl/ector_gl_private.h
+++ b/src/lib/ector/gl/ector_gl_private.h
@@ -1,6 +1,8 @@
#ifndef ECTOR_GL_PRIVATE_H_
# define ECTOR_GL_PRIVATE_H_
+#include "ector_private.h"
+
#define SHADER_FLAG_SAM_BITSHIFT 3
#define SHADER_FLAG_MASKSAM_BITSHIFT 6
diff --git a/src/lib/ector/software/ector_software_buffer.c b/src/lib/ector/software/ector_software_buffer.c
index 376228f5c8..b846761de1 100644
--- a/src/lib/ector/software/ector_software_buffer.c
+++ b/src/lib/ector/software/ector_software_buffer.c
@@ -166,9 +166,7 @@ _ector_software_buffer_base_ector_generic_buffer_map(Eo *obj EINA_UNUSED, Ector_
if (!pd->pixels.u8 || !pd->stride)
fail("Buffer has no pixel data yet");
- if (cspace != pd->generic->cspace)
- fail("Invalid colorspace");
- if (!w || !h || ((x + w) > pd->generic->w) || (y + h > pd->generic->h))
+ if (((x + w) > pd->generic->w) || (y + h > pd->generic->h))
fail("Invalid region requested: wanted %u,%u %ux%u but image is %ux%u",
x, y, w, h, pd->generic->w, pd->generic->h);
if ((mode & ECTOR_BUFFER_ACCESS_FLAG_WRITE) && !pd->writable)