aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/evas/canvas/evas_object_image.c
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2015-05-09 20:02:13 +0200
committerCedric BAIL <cedric@osg.samsung.com>2015-08-05 15:12:33 +0200
commit033658d1caf0624fac71d482be5c8f14622b09b7 (patch)
tree3df916048def3d0b82ce07890daec126e54ec884 /src/lib/evas/canvas/evas_object_image.c
parentevas: prepare refactoring necessary for snapshot. (diff)
downloadefl-033658d1caf0624fac71d482be5c8f14622b09b7.tar.gz
evas: implementation of snapshot feature.
This should theorically work, need some test. Design is easy to understand. Render every part of a snapshot object by rendering the content below it, before rendering the stack above it using that object content.
Diffstat (limited to 'src/lib/evas/canvas/evas_object_image.c')
-rw-r--r--src/lib/evas/canvas/evas_object_image.c41
1 files changed, 40 insertions, 1 deletions
diff --git a/src/lib/evas/canvas/evas_object_image.c b/src/lib/evas/canvas/evas_object_image.c
index 32191fdabf..2f8561f219 100644
--- a/src/lib/evas/canvas/evas_object_image.c
+++ b/src/lib/evas/canvas/evas_object_image.c
@@ -69,6 +69,8 @@ struct _Evas_Object_Image_Pixels
Evas_Video_Surface video;
unsigned int video_caps;
+
+ int surface_w, surface_h; /* used by snapshot feature */
};
struct _Evas_Object_Image_State
@@ -233,7 +235,7 @@ static const Evas_Object_Image_Load_Opts default_load_opts = {
};
static const Evas_Object_Image_Pixels default_pixels = {
- NULL, { NULL, NULL }, { 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL }, ~0x0
+ NULL, { NULL, NULL }, { 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL }, ~0x0, 0, 0
};
static const Evas_Object_Image_State default_state = {
@@ -3301,6 +3303,14 @@ _evas_image_render(Eo *eo_obj, Evas_Object_Protected_Data *obj,
uvw = imagew;
uvh = imageh;
}
+ else if (obj->cur->snapshot)
+ {
+ pixels = o->engine_data;
+ imagew = o->pixels->surface_w;
+ imageh = o->pixels->surface_h;
+ uvw = imagew;
+ uvh = imageh;
+ }
else if (!o->cur->source)
{
pixels = evas_process_dirty_pixels(eo_obj, obj, o, output, surface, o->engine_data);
@@ -3322,6 +3332,7 @@ _evas_image_render(Eo *eo_obj, Evas_Object_Protected_Data *obj,
((Evas_Image_Data *)eo_data_scope_get(o->cur->source, MY_CLASS))->engine_data)
{
Evas_Image_Data *oi;
+
oi = eo_data_scope_get(o->cur->source, MY_CLASS);
pixels = oi->engine_data;
imagew = oi->cur->image.w;
@@ -4758,6 +4769,34 @@ _evas_image_snapshot_get(Eo *eo, Evas_Image_Data *pd EINA_UNUSED)
return obj->cur->snapshot;
}
+void *
+_evas_object_image_surface_get(Evas_Object *eo, Evas_Object_Protected_Data *obj)
+{
+ Evas_Image_Data *pd = eo_data_scope_get(eo, EVAS_IMAGE_CLASS);
+
+ if (pd->engine_data &&
+ pd->pixels->surface_w == obj->cur->geometry.w &&
+ pd->pixels->surface_h == obj->cur->geometry.h)
+ return pd->engine_data;
+
+ if (pd->engine_data)
+ ENFN->image_free(ENDT, pd->engine_data);
+
+ // FIXME: alpha forced to 1 for now, need to figure out Evas alpha here
+ EINA_COW_PIXEL_WRITE_BEGIN(pd, pixi_write)
+ {
+ pd->engine_data = ENFN->image_map_surface_new(ENDT,
+ obj->cur->geometry.w,
+ obj->cur->geometry.h,
+ 1);
+ pixi_write->surface_w = obj->cur->geometry.w;
+ pixi_write->surface_h = obj->cur->geometry.h;
+ }
+ EINA_COW_PIXEL_WRITE_END(pd, pixi_write);
+
+ return pd->engine_data;
+}
+
EAPI void
evas_object_image_file_set(Eo *obj, const char *file, const char *key)
{