From 73e5bb84a137e1b5472599b87caa2af85b35d787 Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Mon, 22 Oct 2018 10:20:28 -0500 Subject: [PATCH] evas_object: Add function to test if an object is on a hardware plane Signed-off-by: Derek Foreman Reviewed-by: Cedric BAIL Differential Revision: https://phab.enlightenment.org/D7190 --- src/lib/evas/canvas/evas_object_image.c | 12 +++++++++++- src/lib/evas/include/evas_inline.x | 8 ++++++++ src/lib/evas/include/evas_private.h | 1 + 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/lib/evas/canvas/evas_object_image.c b/src/lib/evas/canvas/evas_object_image.c index 594aa57e85..cd11d54914 100644 --- a/src/lib/evas/canvas/evas_object_image.c +++ b/src/lib/evas/canvas/evas_object_image.c @@ -54,6 +54,7 @@ static void evas_object_image_render_prepare(Evas_Object *obj, Evas_Obje static void evas_object_image_filled_resize_listener(void *data, Evas *eo_e, Evas_Object *eo_obj, void *einfo); +static int evas_object_image_is_on_plane(Evas_Object *obj EINA_UNUSED, Evas_Object_Protected_Data *pd EINA_UNUSED, void *type_private_data); static const Evas_Object_Func object_func = { /* methods (compulsory) */ @@ -73,7 +74,8 @@ static const Evas_Object_Func object_func = evas_object_image_has_opaque_rect, evas_object_image_get_opaque_rect, evas_object_image_can_map, - evas_object_image_render_prepare // render_prepare + evas_object_image_render_prepare, // render_prepare + evas_object_image_is_on_plane, }; static const Evas_Object_Image_Load_Opts default_load_opts = { @@ -1743,6 +1745,14 @@ _evas_object_image_can_use_plane(Evas_Object_Protected_Data *obj, return EINA_TRUE; } +static int +evas_object_image_is_on_plane(Evas_Object *obj EINA_UNUSED, Evas_Object_Protected_Data *pd EINA_UNUSED, void *type_private_data) +{ + Evas_Image_Data *o = type_private_data; + + if (o->plane) return 1; + return 0; +} static void evas_object_image_render(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, void *type_private_data, void *engine, void *output, void *context, void *surface, int x, int y, Eina_Bool do_async) diff --git a/src/lib/evas/include/evas_inline.x b/src/lib/evas/include/evas_inline.x index a2b96b1789..739a59b32d 100644 --- a/src/lib/evas/include/evas_inline.x +++ b/src/lib/evas/include/evas_inline.x @@ -117,6 +117,14 @@ evas_object_is_opaque(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj) return 0; } +static inline int +evas_object_is_on_plane(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj) +{ + if (obj->func->is_on_plane) + return obj->func->is_on_plane(eo_obj, obj, obj->private_data); + return 0; +} + static inline int evas_event_freezes_through(Evas_Object *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj) { diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h index 3d5020fdd6..db2498708a 100644 --- a/src/lib/evas/include/evas_private.h +++ b/src/lib/evas/include/evas_private.h @@ -1260,6 +1260,7 @@ struct _Evas_Object_Func // preparation - may include rendering content to buffer or loading data // from disk or uploading to texture etc. void (*render_prepare) (Evas_Object *obj, Evas_Object_Protected_Data *pd, Eina_Bool do_async); + int (*is_on_plane) (Evas_Object *obj, Evas_Object_Protected_Data *pd, void *type_private_data); }; struct _Evas_Func