diff options
author | Jean-Philippe Andre <jp.andre@samsung.com> | 2016-03-15 16:19:12 +0900 |
---|---|---|
committer | Jean-Philippe Andre <jp.andre@samsung.com> | 2016-03-17 13:10:35 +0900 |
commit | 6ac68c92526c21aec48cf584b23f34ef45dc5ee5 (patch) | |
tree | 884333f19acfdd6232f22de9630014e5f86062db | |
parent | 6b03d46d545ec228708ace4bebeff85704f3f1be (diff) | |
download | efl-6ac68c92526c21aec48cf584b23f34ef45dc5ee5.tar.gz |
Evas.Image: Move all legacy EAPI out of evas_object_image.c
Some of these functions are still be in use by the new EO objects,
like data_set/get/copy_set.
-rw-r--r-- | src/Makefile_Evas.am | 1 | ||||
-rw-r--r-- | src/lib/evas/canvas/evas_image_legacy.c | 824 | ||||
-rw-r--r-- | src/lib/evas/canvas/evas_image_private.h | 11 | ||||
-rw-r--r-- | src/lib/evas/canvas/evas_object_image.c | 883 |
4 files changed, 857 insertions, 862 deletions
diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am index d1588aaee2..57fe9c4546 100644 --- a/src/Makefile_Evas.am +++ b/src/Makefile_Evas.am @@ -153,6 +153,7 @@ lib/evas/canvas/evas_key_grab.c \ lib/evas/canvas/evas_layer.c \ lib/evas/canvas/evas_main.c \ lib/evas/canvas/evas_name.c \ +lib/evas/canvas/evas_image_legacy.c \ lib/evas/canvas/evas_object_image.c \ lib/evas/canvas/evas_object_main.c \ lib/evas/canvas/evas_object_inform.c \ diff --git a/src/lib/evas/canvas/evas_image_legacy.c b/src/lib/evas/canvas/evas_image_legacy.c new file mode 100644 index 0000000000..351ae9112d --- /dev/null +++ b/src/lib/evas/canvas/evas_image_legacy.c @@ -0,0 +1,824 @@ +#include "evas_image_private.h" + +#define EVAS_IMAGE_LEGACY_API(_o, ...) \ + do { EVAS_OBJECT_LEGACY_API(_o, __VA_ARGS__); \ + if (EINA_UNLIKELY(!eo_isa(_o, EVAS_IMAGE_CLASS))) { \ + EINA_SAFETY_ERROR("object is not an image!"); \ + return __VA_ARGS__; \ + } } while(0) + +EAPI Evas_Object * +evas_object_image_add(Evas *eo_e) +{ + EINA_SAFETY_ON_FALSE_RETURN_VAL(eo_isa(eo_e, EVAS_CANVAS_CLASS), NULL); + return eo_add(EVAS_IMAGE_CLASS, eo_e, + efl_gfx_fill_filled_set(eo_self, EINA_FALSE), + evas_obj_legacy_ctor(eo_self)); +} + +EAPI Evas_Object * +evas_object_image_filled_add(Evas *eo_e) +{ + EINA_SAFETY_ON_FALSE_RETURN_VAL(eo_isa(eo_e, EVAS_CANVAS_CLASS), NULL); + return eo_add(EVAS_IMAGE_CLASS, eo_e, + evas_obj_legacy_ctor(eo_self)); +} + +EAPI void +evas_object_image_memfile_set(Evas_Object *eo_obj, void *data, int size, char *format EINA_UNUSED, char *key) +{ + Eina_File *f; + + EVAS_IMAGE_LEGACY_API(eo_obj); + + f = eina_file_virtualize(NULL, data, size, EINA_TRUE); + if (!f) return ; + efl_file_mmap_set(eo_obj, f, key); + eina_file_close(f); +} + +EAPI void +evas_object_image_fill_set(Evas_Image *obj, + Evas_Coord x, Evas_Coord y, + Evas_Coord w, Evas_Coord h) +{ + efl_gfx_fill_set((Evas_Image *)obj, x, y, w, h); +} + +EAPI void +evas_object_image_preload(Evas_Object *eo_obj, Eina_Bool cancel) +{ + if (cancel) + efl_image_load_async_cancel(eo_obj); + else + efl_image_load_async_start(eo_obj); +} + +EAPI Eina_Bool +evas_object_image_filled_get(const Evas_Object *eo_obj) +{ + return efl_gfx_fill_filled_get(eo_obj); +} + +EAPI void +evas_object_image_filled_set(Evas_Object *eo_obj, Eina_Bool value) +{ + efl_gfx_fill_filled_set(eo_obj, value); +} + +EAPI void +evas_object_image_fill_get(const Evas_Image *obj, + Evas_Coord *x, Evas_Coord *y, + Evas_Coord *w, Evas_Coord *h) +{ + efl_gfx_fill_get(obj, x, y, w, h); +} + +EAPI void +evas_object_image_alpha_set(Evas_Object *obj, Eina_Bool alpha) +{ + EVAS_IMAGE_LEGACY_API(obj); + efl_gfx_buffer_alpha_set(obj, alpha); +} + +EAPI Eina_Bool +evas_object_image_alpha_get(const Evas_Object *obj) +{ + EVAS_IMAGE_LEGACY_API(obj, EINA_FALSE); + return efl_gfx_buffer_alpha_get(obj); +} + +EAPI void +evas_object_image_border_set(Evas_Object *obj, int l, int r, int t, int b) +{ + efl_image_border_set(obj, l, r, t, b); +} + +EAPI void +evas_object_image_border_get(const Evas_Object *obj, int *l, int *r, int *t, int *b) +{ + efl_image_border_get(obj, l, r, t, b); +} + +EAPI void +evas_object_image_border_scale_set(Evas_Object *obj, double scale) +{ + efl_image_border_scale_set(obj, scale); +} + +EAPI double +evas_object_image_border_scale_get(const Evas_Object *obj) +{ + return efl_image_border_scale_get(obj); +} + +EAPI void +evas_object_image_border_center_fill_set(Evas_Object *obj, Evas_Border_Fill_Mode fill) +{ + efl_image_border_center_fill_set(obj, (Efl_Gfx_Border_Fill_Mode) fill); +} + +EAPI Evas_Border_Fill_Mode +evas_object_image_border_center_fill_get(const Evas_Object *obj) +{ + return (Evas_Border_Fill_Mode) efl_image_border_center_fill_get(obj); +} + +EAPI void +evas_object_image_size_get(const Evas_Image *obj, int *w, int *h) +{ + efl_gfx_view_size_get(obj, w, h); +} + +EAPI Evas_Colorspace +evas_object_image_colorspace_get(const Evas_Object *obj) +{ + return (Evas_Colorspace) efl_gfx_buffer_colorspace_get(obj); +} + +EAPI int +evas_object_image_stride_get(const Evas_Object *obj) +{ + return efl_gfx_buffer_stride_get(obj); +} + +EAPI void +evas_object_image_data_update_add(Evas_Object *obj, int x, int y, int w, int h) +{ + efl_gfx_buffer_update_add(obj, x, y, w, h); +} + +EAPI void +evas_object_image_file_set(Eo *obj, const char *file, const char *key) +{ + efl_file_set(obj, file, key); +} + +EAPI void +evas_object_image_file_get(const Eo *obj, const char **file, const char **key) +{ + efl_file_get(obj, file, key); +} + +EAPI void +evas_object_image_mmap_set(Evas_Image *obj, const Eina_File *f, const char *key) +{ + efl_file_mmap_set(obj, f, key); +} + +EAPI void +evas_object_image_mmap_get(const Evas_Image *obj, const Eina_File **f, const char **key) +{ + efl_file_mmap_get(obj, f, key); +} + +EAPI Eina_Bool +evas_object_image_save(const Eo *obj, const char *file, const char *key, const char *flags) +{ + return efl_file_save(obj, file, key, flags); +} + +EAPI Eina_Bool +evas_object_image_animated_get(const Eo *obj) +{ + return efl_image_animated_get(obj); +} + +EAPI void +evas_object_image_animated_frame_set(Evas_Object *obj, int frame_index) +{ + efl_image_animated_frame_set(obj, frame_index); +} + +EAPI int +evas_object_image_animated_frame_count_get(const Evas_Object *obj) +{ + return efl_image_animated_frame_count_get(obj); +} + +EAPI Evas_Image_Animated_Loop_Hint +evas_object_image_animated_loop_type_get(const Evas_Object *obj) +{ + return (Evas_Image_Animated_Loop_Hint) efl_image_animated_loop_type_get(obj); +} + +EAPI int +evas_object_image_animated_loop_count_get(const Evas_Object *obj) +{ + return efl_image_animated_loop_count_get(obj); +} + +EAPI double +evas_object_image_animated_frame_duration_get(const Evas_Object *obj, int start_frame, int frame_num) +{ + return efl_image_animated_frame_duration_get(obj, start_frame, frame_num); +} + +EAPI void +evas_object_image_load_size_set(Eo *obj, int w, int h) +{ + efl_image_load_size_set(obj, w, h); +} + +EAPI void +evas_object_image_load_size_get(const Eo *obj, int *w, int *h) +{ + efl_image_load_size_get(obj, w, h); +} + +EAPI void +evas_object_image_load_dpi_set(Evas_Object *obj, double dpi) +{ + efl_image_load_dpi_set(obj, dpi); +} + +EAPI double +evas_object_image_load_dpi_get(const Evas_Object *obj) +{ + return efl_image_load_dpi_get(obj); +} + +EAPI void +evas_object_image_load_region_set(Evas_Object *obj, int x, int y, int w, int h) +{ + efl_image_load_region_set(obj, x, y, w, h); +} + +EAPI void +evas_object_image_load_region_get(const Evas_Object *obj, int *x, int *y, int *w, int *h) +{ + efl_image_load_region_get(obj, x, y, w, h); +} + +EAPI Eina_Bool +evas_object_image_region_support_get(const Evas_Image *obj) +{ + return efl_image_load_region_support_get(obj); +} + +EAPI void +evas_object_image_load_orientation_set(Evas_Object *obj, Eina_Bool enable) +{ + efl_image_load_orientation_set(obj, enable); +} + +EAPI Eina_Bool +evas_object_image_load_orientation_get(const Evas_Object *obj) +{ + return efl_image_load_orientation_get(obj); +} + +EAPI void +evas_object_image_load_scale_down_set(Evas_Object *obj, int scale_down) +{ + efl_image_load_scale_down_set(obj, scale_down); +} + +EAPI int +evas_object_image_load_scale_down_get(const Evas_Object *obj) +{ + return efl_image_load_scale_down_get(obj); +} + +EAPI Evas_Load_Error +evas_object_image_load_error_get(const Evas_Object *obj) +{ + return (Evas_Load_Error) efl_image_load_error_get(obj); +} + +EAPI void +evas_object_image_smooth_scale_set(Eo *obj, Eina_Bool smooth_scale) +{ + efl_image_smooth_scale_set(obj, smooth_scale); +} + +EAPI Eina_Bool +evas_object_image_smooth_scale_get(const Eo *obj) +{ + return efl_image_smooth_scale_get(obj); +} + +EAPI void +evas_object_image_orient_set(Evas_Image *obj, Evas_Image_Orient orient) +{ + efl_image_orientation_set(obj, (Efl_Gfx_Orientation) orient); +} + +EAPI Evas_Image_Orient +evas_object_image_orient_get(const Evas_Image *obj) +{ + return (Evas_Image_Orient) efl_image_orientation_get(obj); +} + +EAPI void +evas_object_image_snapshot_set(Evas_Object *eo, Eina_Bool s) +{ + Evas_Object_Protected_Data *obj = eo_data_scope_get(eo, EVAS_OBJECT_CLASS); + + EVAS_IMAGE_LEGACY_API(eo); + if (obj->cur->snapshot == s) return; + + EINA_COW_STATE_WRITE_BEGIN(obj, state_write, cur) + state_write->snapshot = !!s; + EINA_COW_STATE_WRITE_END(obj, state_write, cur); +} + +EAPI Eina_Bool +evas_object_image_snapshot_get(const Evas_Object *eo) +{ + Evas_Object_Protected_Data *obj = eo_data_scope_get(eo, EVAS_OBJECT_CLASS); + EVAS_IMAGE_LEGACY_API(eo, EINA_FALSE); + return obj->cur->snapshot; +} + +EAPI Eina_Bool +evas_object_image_source_set(Evas_Object *eo, Evas_Object *src) +{ + EVAS_IMAGE_LEGACY_API(eo, EINA_FALSE); + return _evas_image_proxy_source_set(eo, src); +} + +EAPI Evas_Object * +evas_object_image_source_get(const Evas_Object *eo) +{ + EVAS_IMAGE_LEGACY_API(eo, NULL); + return _evas_image_proxy_source_get(eo); +} + +EAPI Eina_Bool +evas_object_image_source_unset(Evas_Object *eo_obj) +{ + EVAS_IMAGE_LEGACY_API(eo_obj, EINA_FALSE); + return _evas_image_proxy_source_set(eo_obj, NULL); +} + +EAPI void +evas_object_image_source_clip_set(Evas_Object *eo, Eina_Bool source_clip) +{ + EVAS_IMAGE_LEGACY_API(eo); + _evas_image_proxy_source_clip_set(eo, source_clip); +} + +EAPI Eina_Bool +evas_object_image_source_clip_get(const Evas_Object *eo) +{ + EVAS_IMAGE_LEGACY_API(eo, EINA_FALSE); + return _evas_image_proxy_source_clip_get(eo); +} + +EAPI void +evas_object_image_source_events_set(Evas_Object *eo, Eina_Bool repeat) +{ + EVAS_IMAGE_LEGACY_API(eo); + _evas_image_proxy_source_events_set(eo, repeat); +} + +EAPI Eina_Bool +evas_object_image_source_events_get(const Evas_Object *eo) +{ + EVAS_IMAGE_LEGACY_API(eo, EINA_FALSE); + return _evas_image_proxy_source_events_get(eo); +} + +EAPI void +evas_object_image_content_hint_set(Evas_Object *obj, Evas_Image_Content_Hint hint) +{ + return efl_image_content_hint_set(obj, hint); +} + +EAPI Evas_Image_Content_Hint +evas_object_image_content_hint_get(const Evas_Object *obj) +{ + return efl_image_content_hint_get(obj); +} + +EAPI void +evas_object_image_scale_hint_set(Evas_Object *obj, Evas_Image_Scale_Hint hint) +{ + return efl_image_scale_hint_set(obj, (Efl_Image_Scale_Hint) hint); +} + +EAPI Evas_Image_Scale_Hint +evas_object_image_scale_hint_get(const Evas_Object *obj) +{ + return (Evas_Image_Scale_Hint) efl_image_scale_hint_get(obj); +} + +EAPI void +evas_object_image_native_surface_set(Evas_Object *eo_obj, Evas_Native_Surface *surf) +{ + EVAS_IMAGE_LEGACY_API(eo_obj); + _evas_image_native_surface_set(eo_obj, surf); +} + +EAPI Evas_Native_Surface * +evas_object_image_native_surface_get(const Evas_Object *eo_obj) +{ + EVAS_IMAGE_LEGACY_API(eo_obj, NULL); + return _evas_image_native_surface_get(eo_obj); +} + +/* eo equivalent: pixels_set(null, w, h, cspace) to (re)allocate an image */ +EAPI void +evas_object_image_size_set(Eo *eo_obj, int w, int h) +{ + 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); + + int stride = 0; + + if (o->cur->scene) return; + + evas_object_async_block(obj); + _evas_image_cleanup(eo_obj, obj, o); + if (w < 1) w = 1; + if (h < 1) h = 1; + if (w >= 32768) return; + if (h >= 32768) return; + if ((w == o->cur->image.w) && + (h == o->cur->image.h)) return; + + EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write) + { + state_write->image.w = w; + state_write->image.h = h; + } + EINA_COW_IMAGE_STATE_WRITE_END(o, state_write); + + if (o->engine_data) + o->engine_data = ENFN->image_size_set(ENDT, o->engine_data, w, h); + else + o->engine_data = ENFN->image_new_from_copied_data + (ENDT, w, h, NULL, o->cur->has_alpha, o->cur->cspace); + + if (o->engine_data) + { + if (ENFN->image_scale_hint_set) + ENFN->image_scale_hint_set(ENDT, o->engine_data, o->scale_hint); + if (ENFN->image_content_hint_set) + ENFN->image_content_hint_set(ENDT, o->engine_data, o->content_hint); + if (ENFN->image_stride_get) + ENFN->image_stride_get(ENDT, o->engine_data, &stride); + else + stride = w * 4; + } + else + stride = w * 4; + EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, cur_write) + { + cur_write->image.stride = stride; + +/* FIXME - in engine call above + if (o->engine_data) + o->engine_data = ENFN->image_alpha_set(ENDT, o->engine_data, o->cur->has_alpha); +*/ + EINA_COW_WRITE_BEGIN(evas_object_image_state_cow, o->prev, Evas_Object_Image_State, prev_write) + EVAS_OBJECT_IMAGE_FREE_FILE_AND_KEY(cur_write, prev_write); + EINA_COW_WRITE_END(evas_object_image_state_cow, o->prev, prev_write); + } + EINA_COW_IMAGE_STATE_WRITE_END(o, cur_write); + + o->written = EINA_TRUE; + o->changed = EINA_TRUE; + evas_object_inform_call_image_resize(eo_obj); + evas_object_change(eo_obj, obj); +} + +/* eo equivalent: pixels_set(null, w, h, cspace) to (re)allocate an image */ +EAPI void +evas_object_image_colorspace_set(Evas_Object *eo_obj, Evas_Colorspace cspace) +{ + 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); + + _evas_image_cleanup(eo_obj, obj, o); + + EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write) + state_write->cspace = cspace; + EINA_COW_IMAGE_STATE_WRITE_END(o, state_write); + + if (o->engine_data) + ENFN->image_colorspace_set(ENDT, o->engine_data, cspace); +} + +/* old video surfaces */ + +EAPI void +evas_object_image_video_surface_set(Evas_Object *eo_obj, Evas_Video_Surface *surf) +{ + EVAS_IMAGE_LEGACY_API(eo_obj); + + 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); + + _evas_image_cleanup(eo_obj, obj, o); + if (o->video_surface) + { + o->video_surface = EINA_FALSE; + obj->layer->evas->video_objects = eina_list_remove(obj->layer->evas->video_objects, eo_obj); + } + + if (surf) + { + if (surf->version != EVAS_VIDEO_SURFACE_VERSION) return; + + if (!surf->update_pixels || + !surf->move || + !surf->resize || + !surf->hide || + !surf->show) + return; + + o->created = EINA_TRUE; + o->video_surface = EINA_TRUE; + + EINA_COW_PIXEL_WRITE_BEGIN(o, pixi_write) + pixi_write->video = *surf; + EINA_COW_PIXEL_WRITE_END(o, pixi_write) + + obj->layer->evas->video_objects = eina_list_append(obj->layer->evas->video_objects, eo_obj); + } + else + { + if (!o->video_surface && + !o->pixels->video.update_pixels && + !o->pixels->video.move && + !o->pixels->video.resize && + !o->pixels->video.hide && + !o->pixels->video.show && + !o->pixels->video.data) + return; + + o->video_surface = EINA_FALSE; + EINA_COW_PIXEL_WRITE_BEGIN(o, pixi_write) + { + pixi_write->video.update_pixels = NULL; + pixi_write->video.move = NULL; + pixi_write->video.resize = NULL; + pixi_write->video.hide = NULL; + pixi_write->video.show = NULL; + pixi_write->video.data = NULL; + } + EINA_COW_PIXEL_WRITE_END(o, pixi_write) + } +} + +EAPI const Evas_Video_Surface* +evas_object_image_video_surface_get(const Evas_Object *eo_obj) +{ + EVAS_IMAGE_LEGACY_API(eo_obj, NULL); + + Evas_Image_Data *o = eo_data_scope_get(eo_obj, EVAS_IMAGE_CLASS); + return (!o->video_surface ? NULL : &o->pixels->video); +} + +EAPI void +evas_object_image_video_surface_caps_set(Evas_Object *eo_obj, unsigned int caps) +{ + EVAS_IMAGE_LEGACY_API(eo_obj); + + 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); + + _evas_image_cleanup(eo_obj, obj, o); + + if (caps == o->pixels->video_caps) + return; + + EINA_COW_PIXEL_WRITE_BEGIN(o, pixi_write) + pixi_write->video_caps = caps; + EINA_COW_PIXEL_WRITE_END(o, pixi_write) +} + +EAPI unsigned int +evas_object_image_video_surface_caps_get(const Evas_Object *eo_obj) +{ + EVAS_IMAGE_LEGACY_API(eo_obj, 0); + + Evas_Image_Data *o = eo_data_scope_get(eo_obj, EVAS_IMAGE_CLASS); + return (!o->video_surface ? 0 : o->pixels->video_caps); +} + +/* deprecated */ +EAPI void +evas_object_image_fill_spread_set(Evas_Image *obj EINA_UNUSED, Evas_Fill_Spread spread) +{ + /* not implemented! */ + if (spread != EFL_GFX_FILL_REPEAT) + WRN("Fill spread support is not implemented!"); +} + +/* deprecated */ +EAPI Evas_Fill_Spread +evas_object_image_fill_spread_get(const Evas_Image *obj EINA_UNUSED) +{ + return EFL_GFX_FILL_REPEAT; +} + +/* deprecated */ +EAPI void +evas_object_image_source_visible_set(Evas_Object *eo, Eina_Bool visible) +{ + /* FIXME: I'd love to remove this feature and replace by no_render. + * But they are not 100% equivalent: if all proxies are removed, then the + * source becomes visible again. This has some advantages for some apps but + * it's complete hell to handle in evas render side. + * -- jpeg, 2016/03/07 + */ + + Evas_Object_Protected_Data *obj = eo_data_scope_get(eo, EVAS_OBJECT_CLASS); + Evas_Object_Protected_Data *src_obj; + Evas_Image_Data *o; + + EVAS_IMAGE_LEGACY_API(eo); + + o = eo_data_scope_get(eo, EVAS_IMAGE_CLASS); + if (!o->cur->source) return; + + visible = !!visible; + src_obj = eo_data_scope_get(o->cur->source, EVAS_OBJECT_CLASS); + if (src_obj->proxy->src_invisible == !visible) return; + + evas_object_async_block(obj); + EINA_COW_WRITE_BEGIN(evas_object_proxy_cow, src_obj->proxy, Evas_Object_Proxy_Data, proxy_write) + proxy_write->src_invisible = !visible; + EINA_COW_WRITE_END(evas_object_proxy_cow, src_obj->proxy, proxy_write); + + src_obj->changed_src_visible = EINA_TRUE; + evas_object_smart_member_cache_invalidate(o->cur->source, EINA_FALSE, + EINA_FALSE, EINA_TRUE); + evas_object_change(o->cur->source, src_obj); + if ((!visible) || (!src_obj->proxy->src_events)) return; + //FIXME: Feed mouse events here. +} + +/* deprecated */ +EAPI Eina_Bool +evas_object_image_source_visible_get(const Evas_Object *eo) +{ + /* FIXME: see evas_object_image_source_visible_set */ + + Evas_Object_Protected_Data *src_obj; + Evas_Image_Data *o; + Eina_Bool visible; + + EVAS_IMAGE_LEGACY_API(eo, EINA_FALSE); + + o = eo_data_scope_get(eo, EVAS_IMAGE_CLASS); + if (!o->cur->source) visible = EINA_FALSE; + src_obj = eo_data_scope_get(o->cur->source, EVAS_OBJECT_CLASS); + if (src_obj) visible = !src_obj->proxy->src_invisible; + else visible = EINA_FALSE; + + return visible; +} + +/* deprecated */ +EAPI void* +evas_object_image_data_convert(Evas_Object *eo_obj, Evas_Colorspace to_cspace) +{ + Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS); + Evas_Image_Data *o; + DATA32 *data; + void* result = NULL; + + EVAS_IMAGE_LEGACY_API(eo_obj, NULL); + EINA_SAFETY_ON_FALSE_RETURN_VAL(eo_isa(eo_obj, EVAS_IMAGE_CLASS), NULL); + + evas_object_async_block(obj); + o = eo_data_scope_get(eo_obj, EVAS_IMAGE_CLASS); + if ((o->preloading) && (o->engine_data)) + { + o->preloading = EINA_FALSE; + ENFN->image_data_preload_cancel(ENDT, o->engine_data, eo_obj); + } + if (!o->engine_data) return NULL; + if (o->video_surface) + o->pixels->video.update_pixels(o->pixels->video.data, eo_obj, &o->pixels->video); + if (o->cur->cspace == to_cspace) return NULL; + data = NULL; + o->engine_data = ENFN->image_data_get(ENDT, o->engine_data, 0, &data, &o->load_error, NULL); + result = _evas_image_data_convert_internal(o, data, to_cspace); + if (o->engine_data) + { + o->engine_data = ENFN->image_data_put(ENDT, o->engine_data, data); + } + + return result; +} + +/* deprecated */ +EAPI void +evas_object_image_reload(Eo *eo_obj) +{ + Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS); + Evas_Image_Data *o; + + EVAS_IMAGE_LEGACY_API(eo_obj); + EINA_SAFETY_ON_FALSE_RETURN(eo_isa(eo_obj, EVAS_IMAGE_CLASS)); + + evas_object_async_block(obj); + o = eo_data_scope_get(eo_obj, EVAS_IMAGE_CLASS); + if ((o->preloading) && (o->engine_data)) + { + o->preloading = EINA_FALSE; + ENFN->image_data_preload_cancel(ENDT, o->engine_data, eo_obj); + } + if ((!o->cur->u.file) || + (o->pixels_checked_out > 0)) return; + if (o->engine_data) + o->engine_data = ENFN->image_dirty_region(ENDT, o->engine_data, 0, 0, o->cur->image.w, o->cur->image.h); + o->written = EINA_FALSE; + _evas_image_unload(eo_obj, obj, 1); + evas_object_inform_call_image_unloaded(eo_obj); + _evas_image_load(eo_obj, obj, o); + + EINA_COW_WRITE_BEGIN(evas_object_image_state_cow, o->prev, Evas_Object_Image_State, prev_write) + { + prev_write->u.file = NULL; + prev_write->key = NULL; + } + EINA_COW_WRITE_END(evas_object_image_state_cow, o->prev, prev_write); + + o->changed = EINA_TRUE; + evas_object_change(eo_obj, obj); +} + +/* deprecated */ +EAPI Eina_Bool +evas_object_image_pixels_import(Evas_Object *eo_obj, Evas_Pixel_Import_Source *pixels) +{ + Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS); + Evas_Image_Data *o; + + EVAS_IMAGE_LEGACY_API(eo_obj, EINA_FALSE); + EINA_SAFETY_ON_FALSE_RETURN_VAL(eo_isa(eo_obj, EVAS_IMAGE_CLASS), EINA_FALSE); + + evas_object_async_block(obj); + o = eo_data_scope_get(eo_obj, EVAS_IMAGE_CLASS); + _evas_image_cleanup(eo_obj, obj, o); + if ((pixels->w != o->cur->image.w) || (pixels->h != o->cur->image.h)) return EINA_FALSE; + + switch (pixels->format) + { +#if 0 + case EVAS_PIXEL_FORMAT_ARGB32: + { + if (o->engine_data) + { + DATA32 *image_pixels = NULL; + + o->engine_data = + ENFN->image_data_get(ENDT, + o->engine_data, + 1, + &image_pixels, + &o->load_error); +/* FIXME: need to actualyl support this */ +/* memcpy(image_pixels, pixels->rows, o->cur->image.w * o->cur->image.h * 4);*/ + if (o->engine_data) + o->engine_data = + ENFN->image_data_put(ENDT, o->engine_data, image_pixels); + if (o->engine_data) + o->engine_data = + ENFN->image_alpha_set(ENDT, o->engine_data, o->cur->has_alpha); + o->changed = EINA_TRUE; + evas_object_change(eo_obj, obj); + } + } + break; +#endif + case EVAS_PIXEL_FORMAT_YUV420P_601: + { + if (o->engine_data) + { + DATA32 *image_pixels = NULL; + + o->engine_data = ENFN->image_data_get(ENDT, o->engine_data, 1, &image_pixels,&o->load_error, NULL); + if (image_pixels) + evas_common_convert_yuv_422p_601_rgba((DATA8 **) pixels->rows, (DATA8 *) image_pixels, o->cur->image.w, o->cur->image.h); + if (o->engine_data) + o->engine_data = ENFN->image_data_put(ENDT, o->engine_data, image_pixels); + if (o->engine_data) + o->engine_data = ENFN->image_alpha_set(ENDT, o->engine_data, o->cur->has_alpha); + o->changed = EINA_TRUE; + evas_object_change(eo_obj, obj); + } + } + break; + default: + return EINA_FALSE; + break; + } + return EINA_TRUE; +} + +/* deprecated */ +EAPI void +evas_object_image_alpha_mask_set(Evas_Object *eo_obj EINA_UNUSED, Eina_Bool ismask EINA_UNUSED) +{ + DBG("This function is not implemented, has never been and never will be."); +} diff --git a/src/lib/evas/canvas/evas_image_private.h b/src/lib/evas/canvas/evas_image_private.h index 9ccff4a736..3a33961a93 100644 --- a/src/lib/evas/canvas/evas_image_private.h +++ b/src/lib/evas/canvas/evas_image_private.h @@ -155,6 +155,11 @@ Eina_Bool _evas_image_proxy_source_events_get(const Eo *eo_obj); Eina_Bool _evas_image_native_surface_set(Eo *eo_obj, Evas_Native_Surface *surf); Evas_Native_Surface *_evas_image_native_surface_get(const Evas_Object *eo_obj); +/* deprecated but in use */ +void *_evas_image_data_convert_internal(Evas_Image_Data *o, void *data, Evas_Colorspace to_cspace); +void _evas_image_unload(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Eina_Bool dirty); +void _evas_image_load(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Evas_Image_Data *o); + /* save typing */ #define ENFN obj->layer->evas->engine.func #define ENDT obj->layer->evas->engine.data.output @@ -165,6 +170,12 @@ Evas_Native_Surface *_evas_image_native_surface_get(const Evas_Object *eo_obj); # define EINA_COW_IMAGE_STATE_WRITE_END(Obj, Write) \ EINA_COW_WRITE_END(evas_object_image_state_cow, Obj->cur, Write) +# define EINA_COW_PIXEL_WRITE_BEGIN(Obj, Write) \ + EINA_COW_WRITE_BEGIN(evas_object_image_pixels_cow, Obj->pixels, Evas_Object_Image_Pixels, Write) + +# define EINA_COW_PIXEL_WRITE_END(Obj, Write) \ + EINA_COW_WRITE_END(evas_object_image_pixels_cow, Obj->pixels, Write) + #define FRAME_MAX 1024 #endif // EVAS_IMAGE_PRIVATE_H diff --git a/src/lib/evas/canvas/evas_object_image.c b/src/lib/evas/canvas/evas_object_image.c index 8b78241cdb..9abf1c9d6d 100644 --- a/src/lib/evas/canvas/evas_object_image.c +++ b/src/lib/evas/canvas/evas_object_image.c @@ -9,8 +9,6 @@ static const char o_type[] = "image"; const char *o_image_type = o_type; /* private methods for image objects */ -static void evas_object_image_unload(Evas_Object *eo_obj, Eina_Bool dirty); -static void evas_object_image_load(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Evas_Image_Data *o); static Evas_Coord evas_object_image_figure_x_fill(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Evas_Coord start, Evas_Coord size, Evas_Coord *size_ret); static Evas_Coord evas_object_image_figure_y_fill(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Evas_Coord start, Evas_Coord size, Evas_Coord *size_ret); @@ -54,7 +52,6 @@ static int evas_object_image_get_opaque_rect(Evas_Object *eo_obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h); static int evas_object_image_can_map(Evas_Object *eo_obj); -static void *evas_object_image_data_convert_internal(Evas_Image_Data *o, void *data, Evas_Colorspace to_cspace); static void evas_object_image_filled_resize_listener(void *data, Evas *eo_e, Evas_Object *eo_obj, void *einfo); static const Evas_Object_Func object_func = @@ -114,12 +111,6 @@ Eina_Cow *evas_object_image_load_opts_cow = NULL; Eina_Cow *evas_object_image_pixels_cow = NULL; Eina_Cow *evas_object_image_state_cow = NULL; -# define EINA_COW_PIXEL_WRITE_BEGIN(Obj, Write) \ - EINA_COW_WRITE_BEGIN(evas_object_image_pixels_cow, Obj->pixels, Evas_Object_Image_Pixels, Write) - -# define EINA_COW_PIXEL_WRITE_END(Obj, Write) \ - EINA_COW_WRITE_END(evas_object_image_pixels_cow, Obj->pixels, Write) - # define EINA_COW_LOAD_OPTS_WRITE_BEGIN(Obj, Write) \ EINA_COW_WRITE_BEGIN(evas_object_image_load_opts_cow, Obj->load_opts, Evas_Object_Image_Load_Opts, Write) @@ -233,21 +224,6 @@ _evas_image_eo_base_finalize(Eo *eo_obj, Evas_Image_Data *o) return eo_finalize(eo_super(eo_obj, MY_CLASS)); } -EAPI void -evas_object_image_memfile_set(Evas_Object *eo_obj, void *data, int size, char *format EINA_UNUSED, char *key) -{ - Eina_File *f; - - MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ); - return; - MAGIC_CHECK_END(); - - f = eina_file_virtualize(NULL, data, size, EINA_TRUE); - if (!f) return ; - efl_file_mmap_set(eo_obj, f, key); - eina_file_close(f); -} - void _evas_image_init_set(const Eina_File *f, const char *file, const char *key, Eo *eo_obj, Evas_Object_Protected_Data *obj, Evas_Image_Data *o, @@ -526,7 +502,7 @@ _evas_image_eo_base_dbg_info_get(Eo *eo_obj, Evas_Image_Data *o, Eo_Dbg_Info *ro EO_DBG_INFO_APPEND(group, "Source", EINA_VALUE_TYPE_UINT64, (uint64_t) (uintptr_t) evas_object_image_source_get(eo_obj)); - if (evas_object_image_load_error_get(eo_obj) != EVAS_LOAD_ERROR_NONE) + if (efl_image_load_error_get(eo_obj) != EVAS_LOAD_ERROR_NONE) { Evas_Load_Error error = EVAS_LOAD_ERROR_GENERIC; error = (Evas_Load_Error) efl_image_load_error_get(eo_obj); @@ -687,72 +663,6 @@ _evas_image_efl_gfx_fill_fill_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o, if (h) *h = o->cur->fill.h; } -/* eo equivalent: pixels_set(null, w, h) to (re)allocate an image */ -EAPI void -evas_object_image_size_set(Eo *eo_obj, int w, int h) -{ - Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS); - Evas_Image_Data *o = eo_data_scope_get(eo_obj, MY_CLASS); - - int stride = 0; - - if (o->cur->scene) return; - - evas_object_async_block(obj); - _evas_image_cleanup(eo_obj, obj, o); - if (w < 1) w = 1; - if (h < 1) h = 1; - if (w >= 32768) return; - if (h >= 32768) return; - if ((w == o->cur->image.w) && - (h == o->cur->image.h)) return; - - EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write) - { - state_write->image.w = w; - state_write->image.h = h; - } - EINA_COW_IMAGE_STATE_WRITE_END(o, state_write); - - if (o->engine_data) - o->engine_data = ENFN->image_size_set(ENDT, o->engine_data, w, h); - else - o->engine_data = ENFN->image_new_from_copied_data - (ENDT, w, h, NULL, o->cur->has_alpha, o->cur->cspace); - - if (o->engine_data) - { - if (ENFN->image_scale_hint_set) - ENFN->image_scale_hint_set(ENDT, o->engine_data, o->scale_hint); - if (ENFN->image_content_hint_set) - ENFN->image_content_hint_set(ENDT, o->engine_data, o->content_hint); - if (ENFN->image_stride_get) - ENFN->image_stride_get(ENDT, o->engine_data, &stride); - else - stride = w * 4; - } - else - stride = w * 4; - EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, cur_write) - { - cur_write->image.stride = stride; - -/* FIXME - in engine call above - if (o->engine_data) - o->engine_data = ENFN->image_alpha_set(ENDT, o->engine_data, o->cur->has_alpha); -*/ - EINA_COW_WRITE_BEGIN(evas_object_image_state_cow, o->prev, Evas_Object_Image_State, prev_write) - EVAS_OBJECT_IMAGE_FREE_FILE_AND_KEY(cur_write, prev_write); - EINA_COW_WRITE_END(evas_object_image_state_cow, o->prev, prev_write); - } - EINA_COW_IMAGE_STATE_WRITE_END(o, cur_write); - - o->written = EINA_TRUE; - o->changed = EINA_TRUE; - evas_object_inform_call_image_resize(eo_obj); - evas_object_change(eo_obj, obj); -} - EOLIAN static void _evas_image_efl_gfx_view_view_size_get(Eo *eo_obj, Evas_Image_Data *o, int *w, int *h) { @@ -807,43 +717,6 @@ _evas_image_efl_image_load_load_error_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Dat return (Efl_Image_Load_Error) o->load_error; } -/* deprecated */ -EAPI void* -evas_object_image_data_convert(Evas_Object *eo_obj, Evas_Colorspace to_cspace) -{ - Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS); - Evas_Image_Data *o; - DATA32 *data; - void* result = NULL; - - if (!eo_isa(eo_obj, MY_CLASS)) - { - CRI("Object is not an %s!", eo_class_name_get(MY_CLASS)); - return NULL; - } - - evas_object_async_block(obj); - o = eo_data_scope_get(eo_obj, MY_CLASS); - if ((o->preloading) && (o->engine_data)) - { - o->preloading = EINA_FALSE; - ENFN->image_data_preload_cancel(ENDT, o->engine_data, eo_obj); - } - if (!o->engine_data) return NULL; - if (o->video_surface) - o->pixels->video.update_pixels(o->pixels->video.data, eo_obj, &o->pixels->video); - if (o->cur->cspace == to_cspace) return NULL; - data = NULL; - o->engine_data = ENFN->image_data_get(ENDT, o->engine_data, 0, &data, &o->load_error, NULL); - result = evas_object_image_data_convert_internal(o, data, to_cspace); - if (o->engine_data) - { - o->engine_data = ENFN->image_data_put(ENDT, o->engine_data, data); - } - - return result; -} - static void _image_preload_internal(Eo *eo_obj, void *_pd, Eina_Bool cancel) { @@ -1017,46 +890,6 @@ _evas_image_efl_image_ratio_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o) return (double) o->cur->image.w / (double) o->cur->image.h; } -/* deprecated */ -EAPI void -evas_object_image_reload(Eo *eo_obj) -{ - Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS); - Evas_Image_Data *o; - - if (!eo_isa(eo_obj, MY_CLASS)) - { - CRI("Object is not an %s!", eo_class_name_get(MY_CLASS)); - return; - } - - evas_object_async_block(obj); - o = eo_data_scope_get(eo_obj, MY_CLASS); - if ((o->preloading) && (o->engine_data)) - { - o->preloading = EINA_FALSE; - ENFN->image_data_preload_cancel(ENDT, o->engine_data, eo_obj); - } - if ((!o->cur->u.file) || - (o->pixels_checked_out > 0)) return; - if (o->engine_data) - o->engine_data = ENFN->image_dirty_region(ENDT, o->engine_data, 0, 0, o->cur->image.w, o->cur->image.h); - o->written = EINA_FALSE; - evas_object_image_unload(eo_obj, 1); - evas_object_inform_call_image_unloaded(eo_obj); - evas_object_image_load(eo_obj, obj, o); - - EINA_COW_WRITE_BEGIN(evas_object_image_state_cow, o->prev, Evas_Object_Image_State, prev_write) - { - prev_write->u.file = NULL; - prev_write->key = NULL; - } - EINA_COW_WRITE_END(evas_object_image_state_cow, o->prev, prev_write); - - o->changed = EINA_TRUE; - evas_object_change(eo_obj, obj); -} - EOLIAN static Eina_Bool _evas_image_efl_file_save(const Eo *eo_obj, Evas_Image_Data *o, const char *file, const char *key, const char *flags) { @@ -1217,7 +1050,7 @@ _evas_image_efl_file_save(const Eo *eo_obj, Evas_Image_Data *o, const char *file else { old_data = im->image.data; - im->image.data = evas_object_image_data_convert_internal(o, data, EVAS_COLORSPACE_ARGB8888); + im->image.data = _evas_image_data_convert_internal(o, data, EVAS_COLORSPACE_ARGB8888); } if (im->image.data) { @@ -1241,78 +1074,6 @@ _evas_image_efl_file_save(const Eo *eo_obj, Evas_Image_Data *o, const char *file return ok; } -/* deprecated */ -EAPI Eina_Bool -evas_object_image_pixels_import(Evas_Object *eo_obj, Evas_Pixel_Import_Source *pixels) -{ - Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS); - Evas_Image_Data *o; - - if (!eo_isa(eo_obj, MY_CLASS)) - { - CRI("Object is not an %s!", eo_class_name_get(MY_CLASS)); - return EINA_FALSE; - } - - evas_object_async_block(obj); - o = eo_data_scope_get(eo_obj, MY_CLASS); - _evas_image_cleanup(eo_obj, obj, o); - if ((pixels->w != o->cur->image.w) || (pixels->h != o->cur->image.h)) return EINA_FALSE; - - switch (pixels->format) - { -#if 0 - case EVAS_PIXEL_FORMAT_ARGB32: - { - if (o->engine_data) - { - DATA32 *image_pixels = NULL; - - o->engine_data = - ENFN->image_data_get(ENDT, - o->engine_data, - 1, - &image_pixels, - &o->load_error); -/* FIXME: need to actualyl support this */ -/* memcpy(image_pixels, pixels->rows, o->cur->image.w * o->cur->image.h * 4);*/ - if (o->engine_data) - o->engine_data = - ENFN->image_data_put(ENDT, o->engine_data, image_pixels); - if (o->engine_data) - o->engine_data = - ENFN->image_alpha_set(ENDT, o->engine_data, o->cur->has_alpha); - o->changed = EINA_TRUE; - evas_object_change(eo_obj, obj); - } - } - break; -#endif - case EVAS_PIXEL_FORMAT_YUV420P_601: - { - if (o->engine_data) - { - DATA32 *image_pixels = NULL; - - o->engine_data = ENFN->image_data_get(ENDT, o->engine_data, 1, &image_pixels,&o->load_error, NULL); - if (image_pixels) - evas_common_convert_yuv_422p_601_rgba((DATA8 **) pixels->rows, (DATA8 *) image_pixels, o->cur->image.w, o->cur->image.h); - if (o->engine_data) - o->engine_data = ENFN->image_data_put(ENDT, o->engine_data, image_pixels); - if (o->engine_data) - o->engine_data = ENFN->image_alpha_set(ENDT, o->engine_data, o->cur->has_alpha); - o->changed = EINA_TRUE; - evas_object_change(eo_obj, obj); - } - } - break; - default: - return EINA_FALSE; - break; - } - return EINA_TRUE; -} - 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) { @@ -1355,9 +1116,9 @@ _evas_image_efl_image_load_load_dpi_set(Eo *eo_obj, Evas_Image_Data *o, double d if (o->cur->u.file) { - evas_object_image_unload(eo_obj, 0); + _evas_image_unload(eo_obj, obj, 0); evas_object_inform_call_image_unloaded(eo_obj); - evas_object_image_load(eo_obj, obj, o); + _evas_image_load(eo_obj, obj, o); o->changed = EINA_TRUE; evas_object_change(eo_obj, obj); } @@ -1384,9 +1145,9 @@ _evas_image_efl_image_load_load_size_set(Eo *eo_obj, Evas_Image_Data *o, int w, if (o->cur->u.file) { - evas_object_image_unload(eo_obj, 0); + _evas_image_unload(eo_obj, obj, 0); evas_object_inform_call_image_unloaded(eo_obj); - evas_object_image_load(eo_obj, obj, o); + _evas_image_load(eo_obj, obj, o); o->changed = EINA_TRUE; evas_object_change(eo_obj, obj); } @@ -1412,9 +1173,9 @@ _evas_image_efl_image_load_load_scale_down_set(Eo *eo_obj, Evas_Image_Data *o, i if (o->cur->u.file) { - evas_object_image_unload(eo_obj, 0); + _evas_image_unload(eo_obj, obj, 0); evas_object_inform_call_image_unloaded(eo_obj); - evas_object_image_load(eo_obj, obj, o); + _evas_image_load(eo_obj, obj, o); o->changed = EINA_TRUE; evas_object_change(eo_obj, obj); } @@ -1444,9 +1205,9 @@ _evas_image_efl_image_load_load_region_set(Eo *eo_obj, Evas_Image_Data *o, int x if (o->cur->u.file) { - evas_object_image_unload(eo_obj, 0); + _evas_image_unload(eo_obj, obj, 0); evas_object_inform_call_image_unloaded(eo_obj); - evas_object_image_load(eo_obj, obj, o); + _evas_image_load(eo_obj, obj, o); o->changed = EINA_TRUE; evas_object_change(eo_obj, obj); } @@ -1479,128 +1240,12 @@ _evas_image_efl_image_load_load_orientation_get(Eo *eo_obj EINA_UNUSED, Evas_Ima return o->load_opts->orientation;; } -/* FIXME: This should be deprecated and a legacy binding for pixel_set should be added */ -EAPI void -evas_object_image_colorspace_set(Evas_Object *eo_obj, Evas_Colorspace cspace) -{ - Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS); - Evas_Image_Data *o = eo_data_scope_get(eo_obj, MY_CLASS); - evas_object_async_block(obj); - - _evas_image_cleanup(eo_obj, obj, o); - - EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write) - state_write->cspace = cspace; - EINA_COW_IMAGE_STATE_WRITE_END(o, state_write); - - if (o->engine_data) - ENFN->image_colorspace_set(ENDT, o->engine_data, cspace); -} - EOLIAN static Efl_Gfx_Colorspace _evas_image_efl_gfx_buffer_colorspace_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o) { return (Efl_Gfx_Colorspace) o->cur->cspace; } -EAPI void -evas_object_image_video_surface_set(Evas_Object *eo_obj, Evas_Video_Surface *surf) -{ - EVAS_OBJECT_LEGACY_API(eo_obj); - - 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); - - _evas_image_cleanup(eo_obj, obj, o); - if (o->video_surface) - { - o->video_surface = EINA_FALSE; - obj->layer->evas->video_objects = eina_list_remove(obj->layer->evas->video_objects, eo_obj); - } - - if (surf) - { - if (surf->version != EVAS_VIDEO_SURFACE_VERSION) return; - - if (!surf->update_pixels || - !surf->move || - !surf->resize || - !surf->hide || - !surf->show) - return; - - o->created = EINA_TRUE; - o->video_surface = EINA_TRUE; - - EINA_COW_PIXEL_WRITE_BEGIN(o, pixi_write) - pixi_write->video = *surf; - EINA_COW_PIXEL_WRITE_END(o, pixi_write) - - obj->layer->evas->video_objects = eina_list_append(obj->layer->evas->video_objects, eo_obj); - } - else - { - if (!o->video_surface && - !o->pixels->video.update_pixels && - !o->pixels->video.move && - !o->pixels->video.resize && - !o->pixels->video.hide && - !o->pixels->video.show && - !o->pixels->video.data) - return; - - o->video_surface = EINA_FALSE; - EINA_COW_PIXEL_WRITE_BEGIN(o, pixi_write) - { - pixi_write->video.update_pixels = NULL; - pixi_write->video.move = NULL; - pixi_write->video.resize = NULL; - pixi_write->video.hide = NULL; - pixi_write->video.show = NULL; - pixi_write->video.data = NULL; - } - EINA_COW_PIXEL_WRITE_END(o, pixi_write) - } -} - -EAPI const Evas_Video_Surface* -evas_object_image_video_surface_get(const Evas_Object *eo_obj) -{ - EVAS_OBJECT_LEGACY_API(eo_obj, NULL); - - Evas_Image_Data *o = eo_data_scope_get(eo_obj, EVAS_IMAGE_CLASS); - return (!o->video_surface ? NULL : &o->pixels->video); -} - -EAPI void -evas_object_image_video_surface_caps_set(Evas_Object *eo_obj, unsigned int caps) -{ - EVAS_OBJECT_LEGACY_API(eo_obj); - - 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); - - _evas_image_cleanup(eo_obj, obj, o); - - if (caps == o->pixels->video_caps) - return; - - EINA_COW_PIXEL_WRITE_BEGIN(o, pixi_write) - pixi_write->video_caps = caps; - EINA_COW_PIXEL_WRITE_END(o, pixi_write) -} - -EAPI unsigned int -evas_object_image_video_surface_caps_get(const Evas_Object *eo_obj) -{ - EVAS_OBJECT_LEGACY_API(eo_obj, 0); - - Evas_Image_Data *o = eo_data_scope_get(eo_obj, EVAS_IMAGE_CLASS); - return (!o->video_surface ? 0 : o->pixels->video_caps); -} - static void _on_image_native_surface_del(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void *einfo EINA_UNUSED) { @@ -1629,13 +1274,6 @@ _evas_image_native_surface_set(Eo *eo_obj, Evas_Native_Surface *surf) return (o->engine_data != NULL); } -EAPI void -evas_object_image_native_surface_set(Evas_Object *eo_obj, Evas_Native_Surface *surf) -{ - EVAS_OBJECT_LEGACY_API(eo_obj); - _evas_image_native_surface_set(eo_obj, surf); -} - Evas_Native_Surface * _evas_image_native_surface_get(const Evas_Object *eo_obj) { @@ -1649,13 +1287,6 @@ _evas_image_native_surface_get(const Evas_Object *eo_obj) return surf; } -EAPI Evas_Native_Surface * -evas_object_image_native_surface_get(const Evas_Object *eo_obj) -{ - EVAS_OBJECT_LEGACY_API(eo_obj, NULL); - return _evas_image_native_surface_get(eo_obj); -} - EOLIAN static void _evas_image_efl_image_scale_hint_set(Eo *eo_obj, Evas_Image_Data *o, Efl_Image_Scale_Hint hint) { @@ -1875,7 +1506,7 @@ _evas_canvas_image_cache_reload(Eo *eo_e, Evas_Public_Data *e) { if (eo_isa(obj->object, MY_CLASS)) { - evas_object_image_unload(obj->object, 1); + _evas_image_unload(obj->object, obj, 1); evas_object_inform_call_image_unloaded(obj->object); } } @@ -1890,7 +1521,7 @@ _evas_canvas_image_cache_reload(Eo *eo_e, Evas_Public_Data *e) if (eo_isa(obj->object, MY_CLASS)) { Evas_Image_Data *o = eo_data_scope_get(obj->object, MY_CLASS); - evas_object_image_load(obj->object, obj, o); + _evas_image_load(obj->object, obj, o); o->changed = EINA_TRUE; evas_object_change(obj->object, obj); } @@ -1928,8 +1559,8 @@ _evas_canvas_image_max_size_get(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e, int * return EINA_TRUE; } -static void -evas_object_image_unload(Evas_Object *eo_obj, Eina_Bool dirty) +void +_evas_image_unload(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Eina_Bool dirty) { Evas_Image_Data *o; Eina_Bool resize_call = EINA_FALSE; @@ -1938,7 +1569,6 @@ evas_object_image_unload(Evas_Object *eo_obj, Eina_Bool dirty) if ((!o->cur->u.file) || (o->pixels_checked_out > 0)) return; - Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS); evas_object_async_block(obj); if (dirty) { @@ -1972,8 +1602,8 @@ evas_object_image_unload(Evas_Object *eo_obj, Eina_Bool dirty) if (resize_call) evas_object_inform_call_image_resize(eo_obj); } -static void -evas_object_image_load(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Evas_Image_Data *o) +void +_evas_image_load(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Evas_Image_Data *o) { Evas_Image_Load_Opts lo; @@ -1998,19 +1628,9 @@ evas_object_image_load(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Eva lo.orientation = o->load_opts->orientation; lo.degree = 0; if (o->cur->mmaped_source) - o->engine_data = ENFN->image_mmap - (ENDT, - o->cur->u.f, - o->cur->key, - &o->load_error, - &lo); + o->engine_data = ENFN->image_mmap(ENDT, o->cur->u.f, o->cur->key, &o->load_error, &lo); else - o->engine_data = ENFN->image_load - (ENDT, - o->cur->u.file, - o->cur->key, - &o->load_error, - &lo); + o->engine_data = ENFN->image_load(ENDT, o->cur->u.file, o->cur->key, &o->load_error, &lo); if (o->engine_data) { @@ -2112,7 +1732,7 @@ _evas_object_image_free(Evas_Object *obj) { Evas_Image_Data *o; - if (!eo_isa(obj, MY_CLASS)) return; + EINA_SAFETY_ON_FALSE_RETURN(eo_isa(obj, EVAS_IMAGE_CLASS)); o = eo_data_scope_get(obj, MY_CLASS); @@ -3806,8 +3426,8 @@ evas_object_image_can_map(Evas_Object *obj EINA_UNUSED) return 1; } -static void * -evas_object_image_data_convert_internal(Evas_Image_Data *o, void *data, Evas_Colorspace to_cspace) +void * +_evas_image_data_convert_internal(Evas_Image_Data *o, void *data, Evas_Colorspace to_cspace) { void *out = NULL; @@ -4115,8 +3735,6 @@ _evas_image_efl_gfx_buffer_buffer_copy_set(Eo *obj, Evas_Image_Data *o, const vo return _evas_image_buffer_set_common(obj, o, (void *) pixels, width, height, stride, cspace, EINA_TRUE); } -/* Legacy deprecated functions */ - EAPI void evas_object_image_data_set(Eo *eo_obj, void *data) { @@ -4295,465 +3913,6 @@ evas_object_image_data_copy_set(Eo *eo_obj, void *data) EVAS_OBJECT_WRITE_IMAGE_FREE_FILE_AND_KEY(o); } -/* Legacy wrappers */ - -EAPI Evas_Object * -evas_object_image_add(Evas *eo_e) -{ - EINA_SAFETY_ON_FALSE_RETURN_VAL(eo_isa(eo_e, EVAS_CANVAS_CLASS), NULL); - return eo_add(EVAS_IMAGE_CLASS, eo_e, efl_gfx_fill_filled_set(eo_self, EINA_FALSE), evas_obj_legacy_ctor(eo_self)); -} - -EAPI Evas_Object * -evas_object_image_filled_add(Evas *eo_e) -{ - EINA_SAFETY_ON_FALSE_RETURN_VAL(eo_isa(eo_e, EVAS_CANVAS_CLASS), NULL); - return eo_add(EVAS_IMAGE_CLASS, eo_e, evas_obj_legacy_ctor(eo_self)); -} - -EAPI void -evas_object_image_fill_set(Evas_Image *obj, - Evas_Coord x, Evas_Coord y, - Evas_Coord w, Evas_Coord h) -{ - efl_gfx_fill_set((Evas_Image *)obj, x, y, w, h); -} - -EAPI void -evas_object_image_preload(Evas_Object *eo_obj, Eina_Bool cancel) -{ - if (cancel) - efl_image_load_async_cancel(eo_obj); - else - efl_image_load_async_start(eo_obj); -} - -EAPI Eina_Bool -evas_object_image_filled_get(const Evas_Object *eo_obj) -{ - return efl_gfx_fill_filled_get(eo_obj); -} - -EAPI void -evas_object_image_filled_set(Evas_Object *eo_obj, Eina_Bool value) -{ - efl_gfx_fill_filled_set(eo_obj, value); -} - -EAPI void -evas_object_image_fill_get(const Evas_Image *obj, - Evas_Coord *x, Evas_Coord *y, - Evas_Coord *w, Evas_Coord *h) -{ - efl_gfx_fill_get(obj, x, y, w, h); -} - -EAPI void -evas_object_image_fill_spread_set(Evas_Image *obj EINA_UNUSED, Evas_Fill_Spread spread) -{ - /* not implemented! */ - if (spread != EFL_GFX_FILL_REPEAT) - WRN("Fill spread support is not implemented!"); -} - -EAPI Evas_Fill_Spread -evas_object_image_fill_spread_get(const Evas_Image *obj EINA_UNUSED) -{ - return EFL_GFX_FILL_REPEAT; -} - -EAPI void -evas_object_image_alpha_set(Evas_Object *obj, Eina_Bool alpha) -{ - EVAS_OBJECT_LEGACY_API(obj); - efl_gfx_buffer_alpha_set(obj, alpha); -} - -EAPI Eina_Bool -evas_object_image_alpha_get(const Evas_Object *obj) -{ - EVAS_OBJECT_LEGACY_API(obj, EINA_FALSE); - return efl_gfx_buffer_alpha_get(obj); -} - -EAPI void -evas_object_image_border_set(Evas_Object *obj, int l, int r, int t, int b) -{ - efl_image_border_set(obj, l, r, t, b); -} - -EAPI void -evas_object_image_border_get(const Evas_Object *obj, int *l, int *r, int *t, int *b) -{ - efl_image_border_get(obj, l, r, t, b); -} - -EAPI void -evas_object_image_border_scale_set(Evas_Object *obj, double scale) -{ - efl_image_border_scale_set(obj, scale); -} - -EAPI double -evas_object_image_border_scale_get(const Evas_Object *obj) -{ - return efl_image_border_scale_get(obj); -} - -EAPI void -evas_object_image_border_center_fill_set(Evas_Object *obj, Evas_Border_Fill_Mode fill) -{ - efl_image_border_center_fill_set(obj, (Efl_Gfx_Border_Fill_Mode) fill); -} - -EAPI Evas_Border_Fill_Mode -evas_object_image_border_center_fill_get(const Evas_Object *obj) -{ - return (Evas_Border_Fill_Mode) efl_image_border_center_fill_get(obj); -} - -EAPI void -evas_object_image_size_get(const Evas_Image *obj, int *w, int *h) -{ - efl_gfx_view_size_get(obj, w, h); -} - -EAPI Evas_Colorspace -evas_object_image_colorspace_get(const Evas_Object *obj) -{ - return (Evas_Colorspace) efl_gfx_buffer_colorspace_get(obj); -} - -EAPI int -evas_object_image_stride_get(const Evas_Object *obj) -{ - return efl_gfx_buffer_stride_get(obj); -} - -EAPI void -evas_object_image_data_update_add(Evas_Object *obj, int x, int y, int w, int h) -{ - efl_gfx_buffer_update_add(obj, x, y, w, h); -} - -EAPI void -evas_object_image_file_set(Eo *obj, const char *file, const char *key) -{ - efl_file_set(obj, file, key); -} - -EAPI void -evas_object_image_file_get(const Eo *obj, const char **file, const char **key) -{ - efl_file_get(obj, file, key); -} - -EAPI void -evas_object_image_mmap_set(Evas_Image *obj, const Eina_File *f, const char *key) -{ - efl_file_mmap_set(obj, f, key); -} - -EAPI void -evas_object_image_mmap_get(const Evas_Image *obj, const Eina_File **f, const char **key) -{ - efl_file_mmap_get(obj, f, key); -} - -EAPI Eina_Bool -evas_object_image_save(const Eo *obj, const char *file, const char *key, const char *flags) -{ - return efl_file_save(obj, file, key, flags); -} - -EAPI Eina_Bool -evas_object_image_animated_get(const Eo *obj) -{ - return efl_image_animated_get(obj); -} - -EAPI void -evas_object_image_animated_frame_set(Evas_Object *obj, int frame_index) -{ - efl_image_animated_frame_set(obj, frame_index); -} - -EAPI int -evas_object_image_animated_frame_count_get(const Evas_Object *obj) -{ - return efl_image_animated_frame_count_get(obj); -} - -EAPI Evas_Image_Animated_Loop_Hint -evas_object_image_animated_loop_type_get(const Evas_Object *obj) -{ - return (Evas_Image_Animated_Loop_Hint) efl_image_animated_loop_type_get(obj); -} - -EAPI int -evas_object_image_animated_loop_count_get(const Evas_Object *obj) -{ - return efl_image_animated_loop_count_get(obj); -} - -EAPI double -evas_object_image_animated_frame_duration_get(const Evas_Object *obj, int start_frame, int frame_num) -{ - return efl_image_animated_frame_duration_get(obj, start_frame, frame_num); -} - -EAPI void -evas_object_image_load_size_set(Eo *obj, int w, int h) -{ - efl_image_load_size_set(obj, w, h); -} - -EAPI void -evas_object_image_load_size_get(const Eo *obj, int *w, int *h) -{ - efl_image_load_size_get(obj, w, h); -} - -EAPI void -evas_object_image_load_dpi_set(Evas_Object *obj, double dpi) -{ - efl_image_load_dpi_set(obj, dpi); -} - -EAPI double -evas_object_image_load_dpi_get(const Evas_Object *obj) -{ - return efl_image_load_dpi_get(obj); -} - -EAPI void -evas_object_image_load_region_set(Evas_Object *obj, int x, int y, int w, int h) -{ - efl_image_load_region_set(obj, x, y, w, h); -} - -EAPI void -evas_object_image_load_region_get(const Evas_Object *obj, int *x, int *y, int *w, int *h) -{ - efl_image_load_region_get(obj, x, y, w, h); -} - -EAPI Eina_Bool -evas_object_image_region_support_get(const Evas_Image *obj) -{ - return efl_image_load_region_support_get(obj); -} - -EAPI void -evas_object_image_load_orientation_set(Evas_Object *obj, Eina_Bool enable) -{ - efl_image_load_orientation_set(obj, enable); -} - -EAPI Eina_Bool -evas_object_image_load_orientation_get(const Evas_Object *obj) -{ - return efl_image_load_orientation_get(obj); -} - -EAPI void -evas_object_image_load_scale_down_set(Evas_Object *obj, int scale_down) -{ - efl_image_load_scale_down_set(obj, scale_down); -} - -EAPI int -evas_object_image_load_scale_down_get(const Evas_Object *obj) -{ - return efl_image_load_scale_down_get(obj); -} - -EAPI Evas_Load_Error -evas_object_image_load_error_get(const Evas_Object *obj) -{ - return (Evas_Load_Error) efl_image_load_error_get(obj); -} - -EAPI void -evas_object_image_smooth_scale_set(Eo *obj, Eina_Bool smooth_scale) -{ - efl_image_smooth_scale_set(obj, smooth_scale); -} - -EAPI Eina_Bool -evas_object_image_smooth_scale_get(const Eo *obj) -{ - return efl_image_smooth_scale_get(obj); -} - -EAPI void -evas_object_image_orient_set(Evas_Image *obj, Evas_Image_Orient orient) -{ - efl_image_orientation_set(obj, (Efl_Gfx_Orientation) orient); -} - -EAPI Evas_Image_Orient -evas_object_image_orient_get(const Evas_Image *obj) -{ - return (Evas_Image_Orient) efl_image_orientation_get(obj); -} - -EAPI void -evas_object_image_snapshot_set(Evas_Object *eo, Eina_Bool s) -{ - Evas_Object_Protected_Data *obj = eo_data_scope_get(eo, EVAS_OBJECT_CLASS); - - EVAS_OBJECT_LEGACY_API(eo); - if (obj->cur->snapshot == s) return; - - EINA_COW_STATE_WRITE_BEGIN(obj, state_write, cur) - state_write->snapshot = !!s; - EINA_COW_STATE_WRITE_END(obj, state_write, cur); -} - -EAPI Eina_Bool -evas_object_image_snapshot_get(const Evas_Object *eo) -{ - Evas_Object_Protected_Data *obj = eo_data_scope_get(eo, EVAS_OBJECT_CLASS); - EVAS_OBJECT_LEGACY_API(eo, EINA_FALSE); - return obj->cur->snapshot; -} - -EAPI Eina_Bool -evas_object_image_source_set(Evas_Object *eo, Evas_Object *src) -{ - EVAS_OBJECT_LEGACY_API(eo, EINA_FALSE); - return _evas_image_proxy_source_set(eo, src); -} - -EAPI Evas_Object * -evas_object_image_source_get(const Evas_Object *eo) -{ - EVAS_OBJECT_LEGACY_API(eo, NULL); - return _evas_image_proxy_source_get(eo); -} - -EAPI Eina_Bool -evas_object_image_source_unset(Evas_Object *eo_obj) -{ - EVAS_OBJECT_LEGACY_API(eo_obj, EINA_FALSE); - return _evas_image_proxy_source_set(eo_obj, NULL); -} - -EAPI void -evas_object_image_source_clip_set(Evas_Object *eo, Eina_Bool source_clip) -{ - EVAS_OBJECT_LEGACY_API(eo); - _evas_image_proxy_source_clip_set(eo, source_clip); -} - -EAPI Eina_Bool -evas_object_image_source_clip_get(const Evas_Object *eo) -{ - EVAS_OBJECT_LEGACY_API(eo, EINA_FALSE); - return _evas_image_proxy_source_clip_get(eo); -} - -EAPI void -evas_object_image_source_events_set(Evas_Object *eo, Eina_Bool repeat) -{ - EVAS_OBJECT_LEGACY_API(eo); - _evas_image_proxy_source_events_set(eo, repeat); -} - -EAPI Eina_Bool -evas_object_image_source_events_get(const Evas_Object *eo) -{ - EVAS_OBJECT_LEGACY_API(eo, EINA_FALSE); - return _evas_image_proxy_source_events_get(eo); -} - -EAPI void -evas_object_image_content_hint_set(Evas_Object *obj, Evas_Image_Content_Hint hint) -{ - return efl_image_content_hint_set(obj, hint); -} - -EAPI Evas_Image_Content_Hint -evas_object_image_content_hint_get(const Evas_Object *obj) -{ - return efl_image_content_hint_get(obj); -} - -EAPI void -evas_object_image_scale_hint_set(Evas_Object *obj, Evas_Image_Scale_Hint hint) -{ - return efl_image_scale_hint_set(obj, (Efl_Image_Scale_Hint) hint); -} - -EAPI Evas_Image_Scale_Hint -evas_object_image_scale_hint_get(const Evas_Object *obj) -{ - return (Evas_Image_Scale_Hint) efl_image_scale_hint_get(obj); -} - -EAPI void -evas_object_image_source_visible_set(Evas_Object *eo, Eina_Bool visible) -{ - /* FIXME: I'd love to remove this feature and replace by no_render. - * But they are not 100% equivalent: if all proxies are removed, then the - * source becomes visible again. This has some advantages for some apps but - * it's complete hell to handle in evas render side. - * -- jpeg, 2016/03/07 - */ - - Evas_Object_Protected_Data *obj = eo_data_scope_get(eo, EVAS_OBJECT_CLASS); - Evas_Object_Protected_Data *src_obj; - Evas_Image_Data *o; - - EVAS_OBJECT_LEGACY_API(eo); - - o = eo_data_scope_get(eo, MY_CLASS); - if (!o->cur->source) return; - - visible = !!visible; - src_obj = eo_data_scope_get(o->cur->source, EVAS_OBJECT_CLASS); - if (src_obj->proxy->src_invisible == !visible) return; - - evas_object_async_block(obj); - EINA_COW_WRITE_BEGIN(evas_object_proxy_cow, src_obj->proxy, Evas_Object_Proxy_Data, proxy_write) - proxy_write->src_invisible = !visible; - EINA_COW_WRITE_END(evas_object_proxy_cow, src_obj->proxy, proxy_write); - - src_obj->changed_src_visible = EINA_TRUE; - evas_object_smart_member_cache_invalidate(o->cur->source, EINA_FALSE, - EINA_FALSE, EINA_TRUE); - evas_object_change(o->cur->source, src_obj); - if ((!visible) || (!src_obj->proxy->src_events)) return; - //FIXME: Feed mouse events here. -} - -EAPI Eina_Bool -evas_object_image_source_visible_get(const Evas_Object *eo) -{ - /* FIXME: see evas_object_image_source_visible_set */ - - Evas_Object_Protected_Data *src_obj; - Evas_Image_Data *o; - Eina_Bool visible; - - EVAS_OBJECT_LEGACY_API(eo, EINA_FALSE); - - o = eo_data_scope_get(eo, MY_CLASS); - if (!o->cur->source) visible = EINA_FALSE; - src_obj = eo_data_scope_get(o->cur->source, EVAS_OBJECT_CLASS); - if (src_obj) visible = !src_obj->proxy->src_invisible; - else visible = EINA_FALSE; - - return visible; -} - -EAPI void -evas_object_image_alpha_mask_set(Evas_Object *eo_obj EINA_UNUSED, Eina_Bool ismask EINA_UNUSED) -{ - DBG("This function is not implemented, has never been and never will be."); -} - #include "canvas/evas_image.eo.c" /* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/ |