engine_image_set {
[[Attach this ector buffer to an existing engine image.]]
params {
- @in evas: Evas.Canvas; [[The current Evas.]]
+ @in engine: void_ptr; [[The current Evas.]]
@in image: void_ptr; [[The RGBA_Image or Evas_GL_Image.]]
}
}
struct _Evas_Ector_GL_Buffer_Data
{
- Evas_Public_Data *evas;
+ Render_Engine_GL_Generic *re;
Evas_GL_Image *glim;
Eina_Bool alpha_only, was_render;
Ector_GL_Buffer_Map *maps;
};
+void *eng_image_data_put(void *data, void *image, DATA32 *image_data);
+void *eng_image_data_get(void *data, void *image, int to_write, DATA32 **image_data, int *err, Eina_Bool *tofree);
+void eng_image_free(void *data, void *image);
+
#undef ENFN
#undef ENDT
#undef ENC
-#define ENFN pd->evas->engine.func
-#define ENC _evas_engine_context(pd->evas)
+#define ENC pd->re
// testing out some macros to maybe add to eina
#define EINA_INLIST_REMOVE(l,i) do { l = (__typeof__(l)) eina_inlist_remove(EINA_INLIST_GET(l), EINA_INLIST_GET(i)); } while (0)
EOLIAN static void
_evas_ector_gl_buffer_gl_buffer_prepare(Eo *obj, Evas_Ector_GL_Buffer_Data *pd,
- Evas_Canvas *eo_evas,
+ void *engine,
int w, int h, Efl_Gfx_Colorspace cspace,
Ector_Buffer_Flag flags EINA_UNUSED)
{
- Render_Engine_GL_Generic *re;
+ Render_Engine_GL_Generic *re = engine;
Evas_Engine_GL_Context *gc;
Evas_GL_Image *im;
// this is meant to be called only once
- EINA_SAFETY_ON_FALSE_GOTO(!pd->evas, on_fail);
+ EINA_SAFETY_ON_FALSE_GOTO(!pd->re, on_fail);
EINA_SAFETY_ON_FALSE_GOTO(!efl_finalized_get(obj), on_fail);
if (cspace == EFL_GFX_COLORSPACE_ARGB8888)
else
fail("Unsupported colorspace: %u", cspace);
- // FIXME: we should not rely on evas canvas in the module (just evas engine)
- pd->evas = efl_data_xref(eo_evas, EVAS_CANVAS_CLASS, obj);
- re = ENC;
+ pd->re = re;
gc = re->window_gl_context_get(re->software.ob);
im = evas_gl_common_image_surface_new(gc, w, h, EINA_TRUE, EINA_FALSE);
if (write && _evas_gl_image_is_fbo(pd->glim))
{
// Can not open FBO data to write!
- im = ENFN->image_data_get(ENC, pd->glim, EINA_FALSE, &data, &err, &tofree);
+ im = eng_image_data_get(ENC, pd->glim, EINA_FALSE, &data, &err, &tofree);
if (!im) return NULL;
}
else
{
- im = ENFN->image_data_get(ENC, pd->glim, write, &data, &err, &tofree);
+ im = eng_image_data_get(ENC, pd->glim, write, &data, &err, &tofree);
if (!im) return NULL;
}
if (map->im)
{
MAP_DUMP(map->im, "out_ro_free");
- ENFN->image_free(ENC, map->im);
+ eng_image_free(ENC, map->im);
}
else
{
MAP_DUMP(pd->glim, "out_ro_nofree");
- ENFN->image_data_put(ENC, pd->glim, map->image_data);
+ eng_image_data_put(ENC, pd->glim, map->image_data);
}
}
if (map->allocated)
_evas_ector_gl_buffer_efl_object_destructor(Eo *obj, Evas_Ector_GL_Buffer_Data *pd)
{
evas_gl_common_image_free(pd->glim);
- efl_data_xunref(pd->evas->evas, pd->evas, obj);
efl_destructor(efl_super(obj, MY_CLASS));
}
gl_buffer_prepare {
[[Set the main properties to create a gl buffer.]]
params {
- evas: Evas.Canvas; [[The current canvas]]
+ engine: void_ptr; [[The current canvas engine]]
w: int; [[Width]]
h: int; [[Height]]
cspace: Efl.Gfx.Colorspace; [[Alpha or RGBA]]
struct _Evas_Ector_GL_Image_Buffer_Data
{
- Evas_Public_Data *evas;
+ Render_Engine_GL_Generic *re;
Evas_GL_Image *glim;
Ector_GL_Buffer_Map *maps;
};
#undef ENDT
#undef ENC
-// FIXME: It should not use evas canvas, just the engine
-#define ENFN pd->evas->engine.func
-#define ENC _evas_engine_context(pd->evas)
+#define ENC pd->re
+
+void *eng_image_data_put(void *data, void *image, DATA32 *image_data);
+void *eng_image_data_get(void *data, void *image, int to_write, DATA32 **image_data, int *err, Eina_Bool *tofree);
+void eng_image_free(void *data, void *image);
// testing out some macros to maybe add to eina
#define EINA_INLIST_REMOVE(l,i) do { l = (__typeof__(l)) eina_inlist_remove(EINA_INLIST_GET(l), EINA_INLIST_GET(i)); } while (0)
}
EOLIAN static void
-_evas_ector_gl_image_buffer_evas_ector_buffer_engine_image_set(Eo *obj, Evas_Ector_GL_Image_Buffer_Data *pd,
- Evas *eo_evas, void *image)
+_evas_ector_gl_image_buffer_evas_ector_buffer_engine_image_set(Eo *obj EINA_UNUSED,
+ Evas_Ector_GL_Image_Buffer_Data *pd,
+ void *engine, void *image)
{
+ Render_Engine_GL_Generic *re = engine;
Evas_GL_Image *im = image;
- Evas_Public_Data *evas;
EINA_SAFETY_ON_FALSE_RETURN(!pd->glim);
EINA_SAFETY_ON_NULL_RETURN(im);
- evas = efl_data_xref(eo_evas, EVAS_CANVAS_CLASS, obj);
if (!im->tex)
{
- Render_Engine_GL_Generic *re = ENC;
Evas_Engine_GL_Context *gc;
gc = re->window_gl_context_get(re->software.ob);
fail("Image has no texture!");
}
- pd->evas = evas;
+ pd->re = re;
evas_gl_common_image_ref(im);
pd->glim = im;
-on_fail:
- efl_data_xunref(eo_evas, evas, obj);
+ on_fail:
return;
}
if (!h) h = H - y;
if ((x + w > W) || (y + h > H)) return NULL;
- im = ENFN->image_data_get(ENC, pd->glim, EINA_FALSE, &data, &err, &tofree);
+ im = eng_image_data_get(ENC, pd->glim, EINA_FALSE, &data, &err, &tofree);
if (!im) return NULL;
map = calloc(1, sizeof(*map));
{
EINA_INLIST_REMOVE(pd->maps, map);
if (map->free_image)
- ENFN->image_free(ENC, map->im);
+ eng_image_free(ENC, map->im);
else
- ENFN->image_data_put(ENC, map->im, map->image_data);
+ eng_image_data_put(ENC, map->im, map->image_data);
if (map->allocated)
free(map->base_data);
free(map);
_evas_ector_gl_image_buffer_efl_object_destructor(Eo *obj, Evas_Ector_GL_Image_Buffer_Data *pd)
{
evas_gl_common_image_free(pd->glim);
- efl_data_xunref(pd->evas->evas, pd->evas, obj);
efl_destructor(efl_super(obj, MY_CLASS));
}
return evas_gl_common_image_new_from_copied_data(gl_context, w, h, image_data, alpha, cspace);
}
-static void
+void
eng_image_free(void *data, void *image)
{
Render_Engine_GL_Generic *re = data;
return im2;
}
-static void *
+void *
eng_image_data_get(void *data, void *image, int to_write, DATA32 **image_data, int *err, Eina_Bool *tofree)
{
Render_Engine_GL_Generic *re = data;
return im_new;
}
-static void *
+void *
eng_image_data_put(void *data, void *image, DATA32 *image_data)
{
Render_Engine_GL_Generic *re = data;
}
static Ector_Buffer *
-eng_ector_buffer_new(void *data EINA_UNUSED, Evas *evas, int w, int h,
+eng_ector_buffer_new(void *data, Evas *evas, int w, int h,
Efl_Gfx_Colorspace cspace, Ector_Buffer_Flag flags)
{
return efl_add(EVAS_ECTOR_GL_BUFFER_CLASS, evas,
- evas_ector_gl_buffer_prepare(efl_added, evas, w, h, cspace, flags));
+ evas_ector_gl_buffer_prepare(efl_added, data, w, h, cspace, flags));
}
static Efl_Gfx_Render_Op
typedef struct {
Ector_Software_Buffer_Base_Data *base;
- Evas_Public_Data *evas;
RGBA_Image *image;
} Evas_Ector_Software_Buffer_Data;
// eg. in the filters.
EOLIAN static void
-_evas_ector_software_buffer_evas_ector_buffer_engine_image_set(Eo *obj, Evas_Ector_Software_Buffer_Data *pd,
- Evas *evas, void *image)
+_evas_ector_software_buffer_evas_ector_buffer_engine_image_set(Eo *obj,
+ Evas_Ector_Software_Buffer_Data *pd,
+ void *engine EINA_UNUSED,
+ void *image)
{
RGBA_Image *im = image;
EINA_SAFETY_ON_FALSE_RETURN(!efl_finalized_get(obj));
EINA_SAFETY_ON_NULL_RETURN(im->image.data);
- pd->evas = efl_data_xref(evas, EVAS_CANVAS_CLASS, obj);
evas_cache_image_ref(&im->cache_entry);
pd->image = im;
{
efl_data_xunref(obj, pd->base, obj);
evas_cache_image_drop(&pd->image->cache_entry);
- if (pd->evas)
- efl_data_xunref(pd->evas->evas, pd->evas, obj);
efl_destructor(efl_super(obj, MY_CLASS));
}
}
static Ector_Buffer *
-eng_ector_buffer_wrap(void *data EINA_UNUSED, Evas *e, void *engine_image)
+eng_ector_buffer_wrap(void *data, Evas *e EINA_UNUSED, void *engine_image)
{
Image_Entry *ie = engine_image;
Ector_Buffer *buf = NULL;
if (!efl_domain_current_push(EFL_ID_DOMAIN_SHARED))
return NULL;
buf = efl_add(EVAS_ECTOR_SOFTWARE_BUFFER_CLASS, NULL,
- evas_ector_buffer_engine_image_set(efl_added, e, ie));
+ evas_ector_buffer_engine_image_set(efl_added, data, ie));
efl_domain_current_pop();
return buf;