From a5b89d8ab3f647b0aa92b82ab7961b5b6693f323 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Tue, 29 Mar 2016 14:52:32 +0900 Subject: [PATCH] Evas.Image: Remove pixels_dirty and pixels_callback Those APIs belong to legacy, not Eo. Also, the image object shouldn't be used directly for GL rendering, instead the GLview widget should be used. --- src/lib/evas/Evas_Legacy.h | 32 +++++++++++++++++++++ src/lib/evas/canvas/evas_image.eo | 37 ------------------------- src/lib/evas/canvas/evas_image_legacy.c | 36 ++++++++++++++++++++++++ src/lib/evas/canvas/evas_object_image.c | 30 -------------------- 4 files changed, 68 insertions(+), 67 deletions(-) diff --git a/src/lib/evas/Evas_Legacy.h b/src/lib/evas/Evas_Legacy.h index ec276ea33e..686739c22c 100644 --- a/src/lib/evas/Evas_Legacy.h +++ b/src/lib/evas/Evas_Legacy.h @@ -3700,6 +3700,38 @@ EAPI void evas_object_image_source_visible_set(Evas_Object *obj, Eina_Bool visib */ EAPI Eina_Bool evas_object_image_source_visible_get(const Evas_Object *obj); +/** + * @brief Mark whether the given image object is dirty and needs to request its + * pixels. + * + * This function will only properly work if a pixels get callback has been set. + * + * @warning Use this function if you really know what you are doing. + * + * @param[in] dirty Whether the image is dirty. + */ +EAPI void evas_object_image_pixels_dirty_set(Evas_Object *obj, Eina_Bool dirty); + +/** + * @brief Retrieves whether the given image object is dirty (needs to be + * redrawn). + * + * @return Whether the image is dirty. + */ +EAPI Eina_Bool evas_object_image_pixels_dirty_get(const Evas_Object *obj); + +/** + * @brief Set the callback function to get pixels from a canvas' image. + * + * This functions sets a function to be the callback function that get pixels + * from a image of the canvas. + * + * @param[in] func The callback function. + * @param[in] data The data pointer to be passed to @c func. + */ +EAPI void evas_object_image_pixels_get_callback_set(Evas_Object *obj, Evas_Object_Image_Pixels_Get_Cb func, void *data) EINA_ARG_NONNULL(2); + + /** * @typedef Evas_Video_Surface * diff --git a/src/lib/evas/canvas/evas_image.eo b/src/lib/evas/canvas/evas_image.eo index f1685b4df8..529e90f1ef 100644 --- a/src/lib/evas/canvas/evas_image.eo +++ b/src/lib/evas/canvas/evas_image.eo @@ -6,43 +6,6 @@ class Evas.Image (Evas.Object, Evas.Filter, /* Legacy is implement inside Efl.Canvas.Image */ legacy_prefix: evas_object_image; eo_prefix: null; - methods { - /* GL View */ - @property pixels_dirty { - set { - [[Mark whether the given image object is dirty and needs to - request its pixels. - - This function will only properly work if a pixels get - callback has been set. - - Warning: Use this function if you really know what you are - doing. - ]] - } - get { - [[Retrieves whether the given image object is dirty (needs to - be redrawn). - ]] - } - values { - dirty: bool; [[Whether the image is dirty.]] - } - } - @property pixels_get_callback { - set { - [[Set the callback function to get pixels from a canvas' image. - - This functions sets a function to be the callback function - that get pixels from a image of the canvas. - ]] - } - values { - func: Evas_Object_Image_Pixels_Get_Cb @nonull; [[The callback function.]] - data: void *; [[The data pointer to be passed to $func.]] - } - } - } implements { Eo.Base.constructor; Eo.Base.destructor; diff --git a/src/lib/evas/canvas/evas_image_legacy.c b/src/lib/evas/canvas/evas_image_legacy.c index 6103cc6df4..6d719e9987 100644 --- a/src/lib/evas/canvas/evas_image_legacy.c +++ b/src/lib/evas/canvas/evas_image_legacy.c @@ -471,6 +471,42 @@ evas_object_image_native_surface_get(const Evas_Object *eo_obj) return _evas_image_native_surface_get(eo_obj); } +EAPI void +evas_object_image_pixels_get_callback_set(Eo *eo_obj, Evas_Object_Image_Pixels_Get_Cb func, void *data) +{ + Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS); + Evas_Image_Data *o = eo_data_scope_get(eo_obj, EVAS_IMAGE_CLASS); + + evas_object_async_block(obj); + EINA_COW_PIXEL_WRITE_BEGIN(o, pixi_write) + { + pixi_write->func.get_pixels = func; + pixi_write->func.get_pixels_data = data; + } + EINA_COW_PIXEL_WRITE_END(o, pixi_write); +} + +EAPI void +evas_object_image_pixels_dirty_set(Eo *eo_obj, Eina_Bool dirty) +{ + Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS); + Evas_Image_Data *o = eo_data_scope_get(eo_obj, EVAS_IMAGE_CLASS); + + evas_object_async_block(obj); + if (dirty) o->dirty_pixels = EINA_TRUE; + else o->dirty_pixels = EINA_FALSE; + o->changed = EINA_TRUE; + evas_object_change(eo_obj, obj); +} + +EAPI Eina_Bool +evas_object_image_pixels_dirty_get(const Eo *eo_obj) +{ + Evas_Image_Data *o = eo_data_scope_get(eo_obj, EVAS_IMAGE_CLASS); + + return (o->dirty_pixels ? 1 : 0); +} + EAPI void evas_object_image_data_set(Eo *eo_obj, void *data) { diff --git a/src/lib/evas/canvas/evas_object_image.c b/src/lib/evas/canvas/evas_object_image.c index f275120605..8678e48b97 100644 --- a/src/lib/evas/canvas/evas_object_image.c +++ b/src/lib/evas/canvas/evas_object_image.c @@ -931,36 +931,6 @@ _evas_image_efl_file_save(const Eo *eo_obj, Evas_Image_Data *o, const char *file return ok; } -EOLIAN static void -_evas_image_pixels_get_callback_set(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o, Evas_Object_Image_Pixels_Get_Cb func, void *data) -{ - Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS); - evas_object_async_block(obj); - EINA_COW_PIXEL_WRITE_BEGIN(o, pixi_write) - { - pixi_write->func.get_pixels = func; - pixi_write->func.get_pixels_data = data; - } - EINA_COW_PIXEL_WRITE_END(o, pixi_write); -} - -EOLIAN static void -_evas_image_pixels_dirty_set(Eo *eo_obj, Evas_Image_Data *o, Eina_Bool dirty) -{ - Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS); - evas_object_async_block(obj); - if (dirty) o->dirty_pixels = EINA_TRUE; - else o->dirty_pixels = EINA_FALSE; - o->changed = EINA_TRUE; - evas_object_change(eo_obj, obj); -} - -EOLIAN static Eina_Bool -_evas_image_pixels_dirty_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o) -{ - return (o->dirty_pixels ? 1 : 0); -} - EOLIAN static Efl_Gfx_Colorspace _evas_image_efl_gfx_buffer_colorspace_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o) {