aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/evas/canvas/evas_3d_texture.c
diff options
context:
space:
mode:
authorsubhransu <subhransu@subhransu-System.(none)>2014-04-14 19:59:38 +0900
committerChunEon Park <hermet@hermet.pe.kr>2014-04-25 17:01:04 +0900
commitac7cea1eb822c007e20c5b192625074251f9c00d (patch)
tree93c33c0f9cf8fa7c21382022925bd62ee3a5471a /src/lib/evas/canvas/evas_3d_texture.c
parentEvas_3D : Eolian change (diff)
downloadefl-ac7cea1eb822c007e20c5b192625074251f9c00d.tar.gz
Evas_3D : Eolian change for Evas_3D_Object.
Conflicts: src/lib/evas/Evas_Eo.h
Diffstat (limited to '')
-rw-r--r--src/lib/evas/canvas/evas_3d_texture.c196
1 files changed, 88 insertions, 108 deletions
diff --git a/src/lib/evas/canvas/evas_3d_texture.c b/src/lib/evas/canvas/evas_3d_texture.c
index 1805091838..f36f2e43c2 100644
--- a/src/lib/evas/canvas/evas_3d_texture.c
+++ b/src/lib/evas/canvas/evas_3d_texture.c
@@ -58,22 +58,24 @@ _texture_proxy_unset(Evas_3D_Texture_Data *texture)
}
static inline void
-_texture_proxy_subrender(Evas_3D_Texture_Data *texture)
+_texture_proxy_subrender(Evas_3D_Texture *obj)
{
/* Code taken from _proxy_subrender() in file evas_object_image.c */
-
- Evas_Public_Data *e = eo_data_scope_get(texture->base.evas, EVAS_CLASS);
+ Eo *evas = NULL;
+ eo_do(obj, evas = evas_common_evas_get());
+ Evas_Public_Data *e = eo_data_scope_get(evas, EVAS_CLASS);
+ Evas_3D_Texture_Data *pd = eo_data_scope_get(obj, MY_CLASS);
Evas_Object_Protected_Data *source;
void *ctx, *image;
int w, h;
Eina_Bool is_image;
- if (!texture->source)
+ if (!pd->source)
return;
- source = eo_data_scope_get(texture->source, EVAS_OBJ_CLASS);
+ source = eo_data_scope_get(pd->source, EVAS_OBJ_CLASS);
- is_image = eo_isa(texture->source, EVAS_OBJ_IMAGE_CLASS);
+ is_image = eo_isa(pd->source, EVAS_OBJ_IMAGE_CLASS);
EINA_COW_WRITE_BEGIN(evas_object_proxy_cow, source->proxy, Evas_Object_Proxy_Data, proxy_write)
{
@@ -81,7 +83,7 @@ _texture_proxy_subrender(Evas_3D_Texture_Data *texture)
if (is_image)
{
- image = source->func->engine_data_get(texture->source);
+ image = source->func->engine_data_get(pd->source);
e->engine.func->image_size_get(e->engine.data.output, image, &w, &h);
}
else
@@ -124,7 +126,7 @@ _texture_proxy_subrender(Evas_3D_Texture_Data *texture)
if (is_image)
{
- void *image = source->func->engine_data_get(texture->source);
+ void *image = source->func->engine_data_get(pd->source);
if (image)
{
@@ -141,11 +143,11 @@ _texture_proxy_subrender(Evas_3D_Texture_Data *texture)
Evas_Proxy_Render_Data proxy_render_data = {
.eo_proxy = NULL,
.proxy_obj = NULL,
- .eo_src = texture->source,
+ .eo_src = pd->source,
.source_clip = EINA_FALSE
};
- evas_render_mapped(e, texture->source, source, ctx, proxy_write->surface,
+ evas_render_mapped(e, pd->source, source, ctx, proxy_write->surface,
-source->cur->geometry.x,
-source->cur->geometry.y,
1, 0, 0, e->output.w, e->output.h,
@@ -165,71 +167,62 @@ _texture_proxy_subrender(Evas_3D_Texture_Data *texture)
}
static void
-_texture_fini(Evas_3D_Texture_Data *texture)
+_texture_fini(Evas_3D_Texture *obj)
{
- if (texture->engine_data)
+ Eo *evas = NULL;
+ eo_do(obj, evas = evas_common_evas_get());
+ Evas_3D_Texture_Data *pd = eo_data_scope_get(obj, MY_CLASS);
+ if (pd->engine_data)
{
- Evas_Public_Data *e = eo_data_scope_get(texture->base.evas, EVAS_CLASS);
- e->engine.func->texture_free(e->engine.data.output, texture->engine_data);
- texture->engine_data = NULL;
+ Evas_Public_Data *e = eo_data_scope_get(evas, EVAS_CLASS);
+ e->engine.func->texture_free(e->engine.data.output, pd->engine_data);
+ pd->engine_data = NULL;
}
- if (texture->materials)
+ if (pd->materials)
{
- eina_hash_free(texture->materials);
- texture->materials = NULL;
+ eina_hash_free(pd->materials);
+ pd->materials = NULL;
}
- if (texture->source)
+ if (pd->source)
{
- _texture_proxy_unset(texture);
+ _texture_proxy_unset(pd);
}
}
-static void
-_texture_free(Evas_3D_Object *obj)
-{
- Evas_3D_Texture_Data *texture = (Evas_3D_Texture_Data *)obj;
-
- _texture_fini(texture);
- //free(texture);
-}
-
static Eina_Bool
_texture_material_change_notify(const Eina_Hash *hash EINA_UNUSED, const void *key,
void *data EINA_UNUSED, void *fdata)
{
Evas_3D_Material *m = *(Evas_3D_Material **)key;
- Evas_3D_Material_Data *pdm = eo_data_scope_get(m, EO_EVAS_3D_MATERIAL_CLASS);
- evas_3d_object_change(&pdm->base, EVAS_3D_STATE_MATERIAL_TEXTURE, (Evas_3D_Object *)fdata);
+ evas_3d_object_change(m, EVAS_3D_STATE_MATERIAL_TEXTURE, (Evas_3D_Object *)fdata);
return EINA_TRUE;
}
-static void
-_texture_change(Evas_3D_Object *obj, Evas_3D_State state EINA_UNUSED,
- Evas_3D_Object *ref EINA_UNUSED)
+EOLIAN static void
+_eo_evas_3d_texture_eo_evas_3d_object_change_notify(Eo *obj, Evas_3D_Texture_Data *pd, Evas_3D_State state EINA_UNUSED, Evas_3D_Object *ref EINA_UNUSED)
{
- Evas_3D_Texture_Data *texture = (Evas_3D_Texture_Data *)obj;
- if (texture->materials)
- eina_hash_foreach(texture->materials, _texture_material_change_notify, obj);
+ if (pd->materials)
+ eina_hash_foreach(pd->materials, _texture_material_change_notify, obj);
}
-static void
-_texture_update(Evas_3D_Object *obj)
+EOLIAN static void
+_eo_evas_3d_texture_eo_evas_3d_object_update_notify(Eo *obj, Evas_3D_Texture_Data *pd)
{
- Evas_3D_Texture_Data *texture = (Evas_3D_Texture_Data *)obj;
-
- if (texture->source)
+ if (pd->source)
{
- Evas_Public_Data *e = eo_data_scope_get(texture->base.evas, EVAS_CLASS);
- Evas_Object_Protected_Data *src = eo_data_scope_get(texture->source, EVAS_OBJ_CLASS);
+ Eo *evas = NULL;
+ eo_do(obj, evas = evas_common_evas_get());
+ Evas_Public_Data *e = eo_data_scope_get(evas, EVAS_CLASS);
+ Evas_Object_Protected_Data *src = eo_data_scope_get(pd->source, EVAS_OBJ_CLASS);
- if (texture->engine_data == NULL)
+ if (pd->engine_data == NULL)
{
- texture->engine_data = e->engine.func->texture_new(e->engine.data.output);
+ pd->engine_data = e->engine.func->texture_new(e->engine.data.output);
- if (texture->engine_data == NULL)
+ if (pd->engine_data == NULL)
{
ERR("Failed to create engine-side texture object.");
return;
@@ -238,28 +231,21 @@ _texture_update(Evas_3D_Object *obj)
if (src->proxy->surface && !src->proxy->redraw)
{
- e->engine.func->texture_image_set(e->engine.data.output, texture->engine_data,
+ e->engine.func->texture_image_set(e->engine.data.output, pd->engine_data,
src->proxy->surface);
return;
}
- texture->proxy_rendering = EINA_TRUE;
- _texture_proxy_subrender(texture);
+ pd->proxy_rendering = EINA_TRUE;
+ _texture_proxy_subrender(obj);
- e->engine.func->texture_image_set(e->engine.data.output, texture->engine_data,
+ e->engine.func->texture_image_set(e->engine.data.output, pd->engine_data,
src->proxy->surface);
- texture->proxy_rendering = EINA_FALSE;
+ pd->proxy_rendering = EINA_FALSE;
}
}
-static const Evas_3D_Object_Func texture_func =
-{
- _texture_free,
- _texture_change,
- _texture_update,
-};
-
void
evas_3d_texture_material_add(Evas_3D_Texture *texture, Evas_3D_Material *material)
{
@@ -301,22 +287,6 @@ evas_3d_texture_material_del(Evas_3D_Texture *texture, Evas_3D_Material *materia
eina_hash_set(pd->materials, &material, (const void *)(count - 1));
}
-// Evas_3D_Texture *
-// evas_3d_texture_new(Evas *e)
-// {
-// Evas_3D_Texture *texture = NULL;
-
-// texture = (Evas_3D_Texture *)calloc(1, sizeof(Evas_3D_Texture_Data));
-
-// if (texture == NULL)
-// {
-// ERR("Failed to allocate memory.");
-// return NULL;
-// }
-
-// evas_3d_object_init(&texture->base, e, EVAS_3D_OBJECT_TYPE_TEXTURE, &texture_func);
-// return texture;
-// }
EAPI Evas_3D_Texture *
evas_3d_texture_add(Evas *e)
@@ -327,36 +297,30 @@ evas_3d_texture_add(Evas *e)
Evas_Object *eo_obj = eo_add(MY_CLASS, e);
eo_unref(eo_obj);
return eo_obj;
- //return evas_3d_texture_new(e);
}
EOLIAN static void
-_eo_evas_3d_texture_eo_base_constructor(Eo *obj, Evas_3D_Texture_Data *pd)
+_eo_evas_3d_texture_eo_base_constructor(Eo *obj, Evas_3D_Texture_Data *pd EINA_UNUSED)
{
- Eo *e;
eo_do_super(obj, MY_CLASS, eo_constructor());
- eo_do(obj, e = eo_parent_get());
- evas_3d_object_init(&pd->base, e, EVAS_3D_OBJECT_TYPE_CAMERA, &texture_func);
+ eo_do(obj, eo_evas_3d_object_type_set(EVAS_3D_OBJECT_TYPE_TEXTURE));
}
EOLIAN static void
-_eo_evas_3d_texture_eo_base_destructor(Eo *obj EINA_UNUSED, Evas_3D_Texture_Data *pd)
-{
- evas_3d_object_unreference(&pd->base);
-}
-
-EOLIAN static Evas *
-_eo_evas_3d_texture_evas_common_interface_evas_get(Eo *obj EINA_UNUSED, Evas_3D_Texture_Data *pd)
+_eo_evas_3d_texture_eo_base_destructor(Eo *obj, Evas_3D_Texture_Data *pd EINA_UNUSED)
{
- return pd->base.evas;
+ //evas_3d_object_unreference(&pd->base);
+ _texture_fini(obj);
}
EOLIAN static void
_eo_evas_3d_texture_data_set(Eo *obj EINA_UNUSED, Evas_3D_Texture_Data *pd, Evas_3D_Color_Format color_format,
Evas_3D_Pixel_Format pixel_format, int w, int h, const void *data)
{
- Evas_Public_Data *e = eo_data_scope_get(pd->base.evas, EVAS_CLASS);
+ Eo *evas = NULL;
+ eo_do(obj, evas = evas_common_evas_get());
+ Evas_Public_Data *e = eo_data_scope_get(evas, EVAS_CLASS);
if (pd->engine_data == NULL)
pd->engine_data = e->engine.func->texture_new(e->engine.data.output);
@@ -364,35 +328,39 @@ _eo_evas_3d_texture_data_set(Eo *obj EINA_UNUSED, Evas_3D_Texture_Data *pd, Evas
e->engine.func->texture_data_set(e->engine.data.output, pd->engine_data,
color_format, pixel_format, w, h, data);
- evas_3d_object_change(&pd->base, EVAS_3D_STATE_TEXTURE_DATA, NULL);
+ evas_3d_object_change(obj, EVAS_3D_STATE_TEXTURE_DATA, NULL);
}
EOLIAN static void
-_eo_evas_3d_texture_file_set(Eo *obj EINA_UNUSED, Evas_3D_Texture_Data *pd, const char *file, const char *key)
+_eo_evas_3d_texture_file_set(Eo *obj, Evas_3D_Texture_Data *pd, const char *file, const char *key)
{
- Evas_Public_Data *e = eo_data_scope_get(pd->base.evas, EVAS_CLASS);
+ Eo *evas = NULL;
+ eo_do(obj, evas = evas_common_evas_get());
+ Evas_Public_Data *e = eo_data_scope_get(evas, EVAS_CLASS);
if (pd->engine_data == NULL)
pd->engine_data = e->engine.func->texture_new(e->engine.data.output);
e->engine.func->texture_file_set(e->engine.data.output, pd->engine_data, file, key);
- evas_3d_object_change(&pd->base, EVAS_3D_STATE_TEXTURE_DATA, NULL);
+ evas_3d_object_change(obj, EVAS_3D_STATE_TEXTURE_DATA, NULL);
}
EAPI void
_eo_evas_3d_texture_source_set(Eo *obj , Evas_3D_Texture_Data *pd, Evas_Object *source)
{
+ Eo *evas = NULL;
+ eo_do(obj, evas = evas_common_evas_get());
Evas_Object_Protected_Data *src;
if (source == pd->source)
return;
- _texture_fini(pd);
+ _texture_fini(obj);
if (source == NULL)
return;
- if (evas_object_evas_get(source) != pd->base.evas)
+ if (evas_object_evas_get(source) != evas)
{
ERR("Not matching canvas.");
return;
@@ -413,7 +381,7 @@ _eo_evas_3d_texture_source_set(Eo *obj , Evas_3D_Texture_Data *pd, Evas_Object *
}
_texture_proxy_set(obj, source, src);
- evas_3d_object_change(&pd->base, EVAS_3D_STATE_TEXTURE_DATA, NULL);
+ evas_3d_object_change(obj, EVAS_3D_STATE_TEXTURE_DATA, NULL);
}
EOLIAN static void
@@ -454,45 +422,57 @@ EOLIAN static Evas_3D_Color_Format
_eo_evas_3d_texture_color_format_get(Eo *obj EINA_UNUSED, Evas_3D_Texture_Data *pd)
{
Evas_3D_Color_Format format;
- Evas_Public_Data *e = eo_data_scope_get(pd->base.evas, EVAS_CLASS);
+ Eo *evas = NULL;
+ eo_do(obj, evas = evas_common_evas_get());
+ Evas_Public_Data *e = eo_data_scope_get(evas, EVAS_CLASS);
e->engine.func->texture_color_format_get(e->engine.data.output, pd->engine_data, &format);
return format;
}
EOLIAN static void
-_eo_evas_3d_texture_size_get(Eo *obj EINA_UNUSED, Evas_3D_Texture_Data *pd, int *w, int *h)
+_eo_evas_3d_texture_size_get(Eo *obj, Evas_3D_Texture_Data *pd, int *w, int *h)
{
- Evas_Public_Data *e = eo_data_scope_get(pd->base.evas, EVAS_CLASS);
+ Eo *evas = NULL;
+ eo_do(obj, evas = evas_common_evas_get());
+ Evas_Public_Data *e = eo_data_scope_get(evas, EVAS_CLASS);
e->engine.func->texture_size_get(e->engine.data.output, pd->engine_data, w, h);
}
EOLIAN static void
-_eo_evas_3d_texture_wrap_set(Eo *obj EINA_UNUSED, Evas_3D_Texture_Data *pd, Evas_3D_Wrap_Mode s, Evas_3D_Wrap_Mode t)
+_eo_evas_3d_texture_wrap_set(Eo *obj, Evas_3D_Texture_Data *pd, Evas_3D_Wrap_Mode s, Evas_3D_Wrap_Mode t)
{
- Evas_Public_Data *e = eo_data_scope_get(pd->base.evas, EVAS_CLASS);
+ Eo *evas = NULL;
+ eo_do(obj, evas = evas_common_evas_get());
+ Evas_Public_Data *e = eo_data_scope_get(evas, EVAS_CLASS);
e->engine.func->texture_wrap_set(e->engine.data.output, pd->engine_data, s, t);
- evas_3d_object_change(&pd->base, EVAS_3D_STATE_TEXTURE_WRAP, NULL);
+ evas_3d_object_change(obj, EVAS_3D_STATE_TEXTURE_WRAP, NULL);
}
EOLIAN static void
-_eo_evas_3d_texture_wrap_get(Eo *obj EINA_UNUSED, Evas_3D_Texture_Data *pd, Evas_3D_Wrap_Mode *s, Evas_3D_Wrap_Mode *t)
+_eo_evas_3d_texture_wrap_get(Eo *obj, Evas_3D_Texture_Data *pd, Evas_3D_Wrap_Mode *s, Evas_3D_Wrap_Mode *t)
{
- Evas_Public_Data *e = eo_data_scope_get(pd->base.evas, EVAS_CLASS);
+ Eo *evas = NULL;
+ eo_do(obj, evas = evas_common_evas_get());
+ Evas_Public_Data *e = eo_data_scope_get(evas, EVAS_CLASS);
e->engine.func->texture_wrap_get(e->engine.data.output, pd->engine_data, s, t);
}
EOLIAN static void
-_eo_evas_3d_texture_filter_set(Eo *obj EINA_UNUSED, Evas_3D_Texture_Data *pd, Evas_3D_Texture_Filter min, Evas_3D_Texture_Filter mag)
+_eo_evas_3d_texture_filter_set(Eo *obj, Evas_3D_Texture_Data *pd, Evas_3D_Texture_Filter min, Evas_3D_Texture_Filter mag)
{
- Evas_Public_Data *e = eo_data_scope_get(pd->base.evas, EVAS_CLASS);
+ Eo *evas = NULL;
+ eo_do(obj, evas = evas_common_evas_get());
+ Evas_Public_Data *e = eo_data_scope_get(evas, EVAS_CLASS);
e->engine.func->texture_filter_set(e->engine.data.output, pd->engine_data, min, mag);
- evas_3d_object_change(&pd->base, EVAS_3D_STATE_TEXTURE_FILTER, NULL);
+ evas_3d_object_change(obj, EVAS_3D_STATE_TEXTURE_FILTER, NULL);
}
EOLIAN static void
_eo_evas_3d_texture_filter_get(Eo *obj EINA_UNUSED, Evas_3D_Texture_Data *pd, Evas_3D_Texture_Filter *min, Evas_3D_Texture_Filter *mag)
{
- Evas_Public_Data *e = eo_data_scope_get(pd->base.evas, EVAS_CLASS);
+ Eo *evas = NULL;
+ eo_do(obj, evas = evas_common_evas_get());
+ Evas_Public_Data *e = eo_data_scope_get(evas, EVAS_CLASS);
e->engine.func->texture_filter_get(e->engine.data.output, pd->engine_data, min, mag);
}