diff options
author | Jean-Philippe Andre <jp.andre@samsung.com> | 2016-03-16 19:37:04 +0900 |
---|---|---|
committer | Jean-Philippe Andre <jp.andre@samsung.com> | 2016-03-17 13:10:35 +0900 |
commit | 8367f497b8f1e9a7b365c815f12deeab9c92e1a5 (patch) | |
tree | 97adbbe04befc36d413cb68dd5f5524ab3f6a813 | |
parent | edafd4ec34629d8200b04e4fda074ac0f5dadf92 (diff) | |
download | efl-8367f497b8f1e9a7b365c815f12deeab9c92e1a5.tar.gz |
Evas.Image: Create Efl.Canvas.Image for file & data images
This replaces standard Evas_Object_Image when it is used "normally",
ie. it's an image from a file or from a pixel buffer. All other APIs
(proxy, snapshot, 3d, gl, ...) are disabled on this object.
Also, reduce number of failing calls when the object is not a legacy
object, but a legacy function is called. This is because a lot of
image APIs are called internally using the legacy APIs, often in
order to reset the state of the image object (eg. set file to NULL,
etc...)
-rw-r--r-- | src/Makefile_Evas.am | 2 | ||||
-rw-r--r-- | src/examples/evas/evas-3d-proxy.c | 2 | ||||
-rw-r--r-- | src/lib/evas/Evas_Eo.h | 2 | ||||
-rw-r--r-- | src/lib/evas/canvas/efl_canvas_proxy.c | 2 | ||||
-rw-r--r-- | src/lib/evas/canvas/evas_image.eo | 38 | ||||
-rw-r--r-- | src/lib/evas/canvas/evas_image_legacy.c | 217 | ||||
-rw-r--r-- | src/lib/evas/canvas/evas_image_private.h | 50 | ||||
-rw-r--r-- | src/lib/evas/canvas/evas_object_image.c | 462 | ||||
-rw-r--r-- | src/lib/evas/canvas/evas_object_main.c | 4 | ||||
-rw-r--r-- | src/modules/evas/engines/gl_common/evas_gl_preload.c | 2 |
10 files changed, 251 insertions, 530 deletions
diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am index 57fe9c4546..4f5656470b 100644 --- a/src/Makefile_Evas.am +++ b/src/Makefile_Evas.am @@ -41,6 +41,7 @@ evas_eolian_pub_files = \ lib/evas/canvas/efl_vg_gradient.eo \ lib/evas/canvas/efl_vg_gradient_radial.eo \ lib/evas/canvas/efl_vg_gradient_linear.eo \ + lib/evas/canvas/efl_canvas_image.eo \ lib/evas/canvas/efl_canvas_snapshot.eo \ lib/evas/canvas/efl_canvas_proxy.eo \ lib/evas/canvas/efl_canvas_scene3d.eo \ @@ -183,6 +184,7 @@ lib/evas/canvas/evas_touch_point.c \ lib/evas/canvas/evas_map.c \ lib/evas/canvas/evas_gl.c \ lib/evas/canvas/evas_out.c \ +lib/evas/canvas/efl_canvas_image.c \ lib/evas/canvas/efl_canvas_proxy.c \ lib/evas/canvas/efl_canvas_snapshot.c \ lib/evas/canvas/efl_canvas_scene3d.c \ diff --git a/src/examples/evas/evas-3d-proxy.c b/src/examples/evas/evas-3d-proxy.c index 0ae5693a58..06ff5bb2cd 100644 --- a/src/examples/evas/evas-3d-proxy.c +++ b/src/examples/evas/evas-3d-proxy.c @@ -90,7 +90,7 @@ _animate_scene(void *data) } //efl_gfx_buffer_set(source, pixels, 0, 0, stride, 0, 0, 0, 0, 0, 0); - //evas_obj_image_data_update_add(source, 0, 0, IMG_WIDTH, IMG_HEIGHT); + //evas_object_image_data_update_add(source, 0, 0, IMG_WIDTH, IMG_HEIGHT); evas_object_image_data_set(source, pixels); evas_object_image_data_update_add(source, 0, 0, IMG_WIDTH, IMG_HEIGHT); diff --git a/src/lib/evas/Evas_Eo.h b/src/lib/evas/Evas_Eo.h index 718c984c85..02d01b7710 100644 --- a/src/lib/evas/Evas_Eo.h +++ b/src/lib/evas/Evas_Eo.h @@ -341,7 +341,7 @@ typedef void (Evas_Canvas3D_Surface_Func)(Evas_Real *out_x, #include "canvas/evas_canvas3d_scene.eo.h" #include "canvas/evas_image.eo.h" - +#include "canvas/efl_canvas_image.eo.h" #include "canvas/efl_canvas_snapshot.eo.h" #include "canvas/efl_canvas_proxy.eo.h" #include "canvas/efl_canvas_scene3d.eo.h" diff --git a/src/lib/evas/canvas/efl_canvas_proxy.c b/src/lib/evas/canvas/efl_canvas_proxy.c index af94ec0806..9648027424 100644 --- a/src/lib/evas/canvas/efl_canvas_proxy.c +++ b/src/lib/evas/canvas/efl_canvas_proxy.c @@ -219,7 +219,7 @@ _evas_image_proxy_set(Evas_Object *eo_proxy, Evas_Object *eo_src) Evas_Object_Protected_Data *proxy = eo_data_scope_get(eo_proxy, EVAS_OBJECT_CLASS); Evas_Image_Data *o = eo_data_scope_get(eo_proxy, EVAS_IMAGE_CLASS); - evas_object_image_file_set(eo_proxy, NULL, NULL); + _evas_image_file_set(eo_proxy, NULL, NULL); EINA_COW_WRITE_BEGIN(evas_object_proxy_cow, proxy->proxy, Evas_Object_Proxy_Data, proxy_write) proxy_write->is_proxy = EINA_TRUE; diff --git a/src/lib/evas/canvas/evas_image.eo b/src/lib/evas/canvas/evas_image.eo index bf48249a75..576138459d 100644 --- a/src/lib/evas/canvas/evas_image.eo +++ b/src/lib/evas/canvas/evas_image.eo @@ -1,9 +1,12 @@ type @extern Evas_Object_Image_Pixels_Get_Cb: __undefined_type; /* FIXME: func pointers are not supported. */ -class Evas.Image (Evas.Object, Efl.File, Efl.Image, Efl.Image_Load, Efl.Image_Animated, Efl.Gfx.Buffer, Efl.Gfx.Fill, Efl.Gfx.View, Evas.Filter) +class Evas.Image (Evas.Object, Efl.File, Efl.Image, Efl.Image_Load, + Efl.Image_Animated, Efl.Gfx.Buffer, Efl.Gfx.Fill, + Efl.Gfx.View, Evas.Filter) { + /* Legacy is implement inside Efl.Canvas.Image */ legacy_prefix: evas_object_image; - eo_prefix: evas_obj_image; + eo_prefix: null; methods { /* GL View */ @property pixels_dirty { @@ -46,10 +49,6 @@ class Evas.Image (Evas.Object, Efl.File, Efl.Image, Efl.Image_Load, Efl.Image_An Eo.Base.destructor; Eo.Base.dbg_info_get; Eo.Base.finalize; - Efl.File.file.set; - Efl.File.file.get; - Efl.File.mmap.set; - Efl.File.mmap.get; Efl.File.save; Efl.Image.orientation.get; Efl.Image.orientation.set; @@ -66,27 +65,6 @@ class Evas.Image (Evas.Object, Efl.File, Efl.Image, Efl.Image_Load, Efl.Image_An Efl.Image.scale_hint.set; Efl.Image.content_hint.get; Efl.Image.content_hint.set; - Efl.Image_Animated.animated.get; - Efl.Image_Animated.animated_frame.get; - Efl.Image_Animated.animated_frame.set; - Efl.Image_Animated.animated_frame_count.get; - Efl.Image_Animated.animated_loop_type.get; - Efl.Image_Animated.animated_loop_count.get; - Efl.Image_Animated.animated_frame_duration.get; - Efl.Image_Load.load_error.get; - Efl.Image_Load.load_async_start; - Efl.Image_Load.load_async_cancel; - Efl.Image_Load.load_dpi.get; - Efl.Image_Load.load_dpi.set; - Efl.Image_Load.load_size.set; - Efl.Image_Load.load_size.get; - Efl.Image_Load.load_orientation.get; - Efl.Image_Load.load_orientation.set; - Efl.Image_Load.load_scale_down.get; - Efl.Image_Load.load_scale_down.set; - Efl.Image_Load.load_region.get; - Efl.Image_Load.load_region.set; - Efl.Image_Load.load_region_support.get; Efl.Gfx.Buffer.alpha.get; Efl.Gfx.Buffer.alpha.set; Efl.Gfx.Buffer.buffer_update_add; @@ -104,5 +82,11 @@ class Evas.Image (Evas.Object, Efl.File, Efl.Image, Efl.Image_Load, Efl.Image_An Evas.Filter.filter_input_alpha; Evas.Filter.filter_input_render; Evas.Filter.filter_dirty; + + /* FIXME: Efl.File does not belong here */ + Efl.File.file.set; + Efl.File.file.get; + Efl.File.mmap.set; + Efl.File.mmap.get; } } diff --git a/src/lib/evas/canvas/evas_image_legacy.c b/src/lib/evas/canvas/evas_image_legacy.c index 351ae9112d..9b510ddba0 100644 --- a/src/lib/evas/canvas/evas_image_legacy.c +++ b/src/lib/evas/canvas/evas_image_legacy.c @@ -1,11 +1,15 @@ #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) +#define EVAS_IMAGE_API(_o, ...) do { \ + if (EINA_UNLIKELY(!eo_isa(_o, EVAS_IMAGE_CLASS))) { \ + EINA_SAFETY_ERROR("object is not an image!"); \ + return __VA_ARGS__; \ + } } while (0) + +#define EVAS_IMAGE_LEGACY_API(_o, ...) do { \ + EVAS_OBJECT_LEGACY_API(_o, __VA_ARGS__); \ + EVAS_IMAGE_API(_o, __VA_ARGS__); \ + } while (0) EAPI Evas_Object * evas_object_image_add(Evas *eo_e) @@ -29,7 +33,7 @@ evas_object_image_memfile_set(Evas_Object *eo_obj, void *data, int size, char *f { Eina_File *f; - EVAS_IMAGE_LEGACY_API(eo_obj); + EVAS_IMAGE_API(eo_obj); f = eina_file_virtualize(NULL, data, size, EINA_TRUE); if (!f) return ; @@ -38,284 +42,327 @@ evas_object_image_memfile_set(Evas_Object *eo_obj, void *data, int size, char *f } EAPI void -evas_object_image_fill_set(Evas_Image *obj, +evas_object_image_fill_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h) { - efl_gfx_fill_set((Evas_Image *)obj, x, y, w, h); + EVAS_IMAGE_API(obj); + efl_gfx_fill_set(obj, x, y, w, h); } EAPI void evas_object_image_preload(Evas_Object *eo_obj, Eina_Bool cancel) { + EVAS_IMAGE_API(eo_obj); if (cancel) - efl_image_load_async_cancel(eo_obj); + _evas_image_load_async_cancel(eo_obj); else - efl_image_load_async_start(eo_obj); + _evas_image_load_async_start(eo_obj); } EAPI Eina_Bool evas_object_image_filled_get(const Evas_Object *eo_obj) { + EVAS_IMAGE_API(eo_obj, EINA_FALSE); return efl_gfx_fill_filled_get(eo_obj); } EAPI void evas_object_image_filled_set(Evas_Object *eo_obj, Eina_Bool value) { + EVAS_IMAGE_API(eo_obj); efl_gfx_fill_filled_set(eo_obj, value); } EAPI void -evas_object_image_fill_get(const Evas_Image *obj, +evas_object_image_fill_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h) { + EVAS_IMAGE_API(obj); 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); + EVAS_IMAGE_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); + EVAS_IMAGE_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) { + EVAS_IMAGE_API(obj); 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) { + EVAS_IMAGE_API(obj); efl_image_border_get(obj, l, r, t, b); } EAPI void evas_object_image_border_scale_set(Evas_Object *obj, double scale) { + EVAS_IMAGE_API(obj); efl_image_border_scale_set(obj, scale); } EAPI double evas_object_image_border_scale_get(const Evas_Object *obj) { + EVAS_IMAGE_API(obj, 1.0); return efl_image_border_scale_get(obj); } EAPI void evas_object_image_border_center_fill_set(Evas_Object *obj, Evas_Border_Fill_Mode fill) { + EVAS_IMAGE_API(obj); 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) { + EVAS_IMAGE_API(obj, EVAS_BORDER_FILL_DEFAULT); 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) +evas_object_image_size_get(const Evas_Object *obj, int *w, int *h) { + EVAS_IMAGE_API(obj); efl_gfx_view_size_get(obj, w, h); } EAPI Evas_Colorspace evas_object_image_colorspace_get(const Evas_Object *obj) { + EVAS_IMAGE_API(obj, EVAS_COLORSPACE_ARGB8888); return (Evas_Colorspace) efl_gfx_buffer_colorspace_get(obj); } EAPI int evas_object_image_stride_get(const Evas_Object *obj) { + EVAS_IMAGE_API(obj, 0); 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) { + EVAS_IMAGE_API(obj); 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) +evas_object_image_file_set(Evas_Object *obj, const char *file, const char *key) { - efl_file_set(obj, file, key); + EVAS_IMAGE_API(obj); + _evas_image_file_set(obj, file, key); } EAPI void -evas_object_image_file_get(const Eo *obj, const char **file, const char **key) +evas_object_image_file_get(const Evas_Object *obj, const char **file, const char **key) { - efl_file_get(obj, file, key); + EVAS_IMAGE_API(obj); + _evas_image_file_get(obj, file, key); } EAPI void -evas_object_image_mmap_set(Evas_Image *obj, const Eina_File *f, const char *key) +evas_object_image_mmap_set(Evas_Object *obj, const Eina_File *f, const char *key) { - efl_file_mmap_set(obj, f, key); + EVAS_IMAGE_API(obj); + _evas_image_mmap_set(obj, f, key); } EAPI void -evas_object_image_mmap_get(const Evas_Image *obj, const Eina_File **f, const char **key) +evas_object_image_mmap_get(const Evas_Object *obj, const Eina_File **f, const char **key) { - efl_file_mmap_get(obj, f, key); + EVAS_IMAGE_API(obj); + _evas_image_mmap_get(obj, f, key); } EAPI Eina_Bool -evas_object_image_save(const Eo *obj, const char *file, const char *key, const char *flags) +evas_object_image_save(const Evas_Object *obj, const char *file, const char *key, const char *flags) { + EVAS_IMAGE_API(obj, EINA_FALSE); return efl_file_save(obj, file, key, flags); } EAPI Eina_Bool -evas_object_image_animated_get(const Eo *obj) +evas_object_image_animated_get(const Evas_Object *obj) { - return efl_image_animated_get(obj); + EVAS_IMAGE_API(obj, EINA_FALSE); + return _evas_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); + EVAS_IMAGE_API(obj); + _evas_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); + EVAS_IMAGE_API(obj, 0); + return _evas_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); + EVAS_IMAGE_API(obj, EVAS_IMAGE_ANIMATED_HINT_NONE); + return (Evas_Image_Animated_Loop_Hint) _evas_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); + EVAS_IMAGE_API(obj, 0); + return _evas_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); + EVAS_IMAGE_API(obj, 0.0); + return _evas_image_animated_frame_duration_get(obj, start_frame, frame_num); } EAPI void -evas_object_image_load_size_set(Eo *obj, int w, int h) +evas_object_image_load_size_set(Evas_Object *obj, int w, int h) { - efl_image_load_size_set(obj, w, h); + EVAS_IMAGE_API(obj); + _evas_image_load_size_set(obj, w, h); } EAPI void -evas_object_image_load_size_get(const Eo *obj, int *w, int *h) +evas_object_image_load_size_get(const Evas_Object *obj, int *w, int *h) { - efl_image_load_size_get(obj, w, h); + EVAS_IMAGE_API(obj); + _evas_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); + EVAS_IMAGE_API(obj); + _evas_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); + EVAS_IMAGE_API(obj, 0.0); + return _evas_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); + EVAS_IMAGE_API(obj); + _evas_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); + EVAS_IMAGE_API(obj); + _evas_image_load_region_get(obj, x, y, w, h); } EAPI Eina_Bool -evas_object_image_region_support_get(const Evas_Image *obj) +evas_object_image_region_support_get(const Evas_Object *obj) { - return efl_image_load_region_support_get(obj); + EVAS_IMAGE_API(obj, EINA_FALSE); + return _evas_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); + EVAS_IMAGE_API(obj); + _evas_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); + EVAS_IMAGE_API(obj, EINA_FALSE); + return _evas_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); + EVAS_IMAGE_API(obj); + _evas_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); + EVAS_IMAGE_API(obj, 1); + return _evas_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); + EVAS_IMAGE_API(obj, EVAS_LOAD_ERROR_GENERIC); + return (Evas_Load_Error) _evas_image_load_error_get(obj); } EAPI void -evas_object_image_smooth_scale_set(Eo *obj, Eina_Bool smooth_scale) +evas_object_image_smooth_scale_set(Evas_Object *obj, Eina_Bool smooth_scale) { + EVAS_IMAGE_API(obj); efl_image_smooth_scale_set(obj, smooth_scale); } EAPI Eina_Bool -evas_object_image_smooth_scale_get(const Eo *obj) +evas_object_image_smooth_scale_get(const Evas_Object *obj) { + EVAS_IMAGE_API(obj, EINA_FALSE); return efl_image_smooth_scale_get(obj); } EAPI void -evas_object_image_orient_set(Evas_Image *obj, Evas_Image_Orient orient) +evas_object_image_orient_set(Evas_Object *obj, Evas_Image_Orient orient) { + EVAS_IMAGE_API(obj); efl_image_orientation_set(obj, (Efl_Gfx_Orientation) orient); } EAPI Evas_Image_Orient -evas_object_image_orient_get(const Evas_Image *obj) +evas_object_image_orient_get(const Evas_Object *obj) { + EVAS_IMAGE_API(obj, EVAS_IMAGE_ORIENT_NONE); return (Evas_Image_Orient) efl_image_orientation_get(obj); } EAPI void evas_object_image_snapshot_set(Evas_Object *eo, Eina_Bool s) { + EVAS_IMAGE_API(eo); + 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) @@ -326,105 +373,111 @@ evas_object_image_snapshot_set(Evas_Object *eo, Eina_Bool s) EAPI Eina_Bool evas_object_image_snapshot_get(const Evas_Object *eo) { + EVAS_IMAGE_API(eo, EINA_FALSE); + 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); + EVAS_IMAGE_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); + EVAS_IMAGE_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); + EVAS_IMAGE_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_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); + EVAS_IMAGE_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_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); + EVAS_IMAGE_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) { + EVAS_IMAGE_API(obj); return efl_image_content_hint_set(obj, hint); } EAPI Evas_Image_Content_Hint evas_object_image_content_hint_get(const Evas_Object *obj) { + EVAS_IMAGE_API(obj, EVAS_IMAGE_CONTENT_HINT_NONE); return efl_image_content_hint_get(obj); } EAPI void evas_object_image_scale_hint_set(Evas_Object *obj, Evas_Image_Scale_Hint hint) { + EVAS_IMAGE_API(obj); 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) { + EVAS_IMAGE_API(obj, EVAS_IMAGE_SCALE_HINT_NONE); 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_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); + EVAS_IMAGE_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 */ +/* Evas_Object 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_image_size_set(Evas_Object *eo_obj, int w, int h) { + EVAS_IMAGE_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); - int stride = 0; if (o->cur->scene) return; @@ -484,14 +537,16 @@ evas_object_image_size_set(Eo *eo_obj, int w, int h) evas_object_change(eo_obj, obj); } -/* eo equivalent: pixels_set(null, w, h, cspace) to (re)allocate an image */ +/* Evas_Object 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_IMAGE_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_object_async_block(obj); _evas_image_cleanup(eo_obj, obj, o); EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write) @@ -604,7 +659,7 @@ evas_object_image_video_surface_caps_get(const Evas_Object *eo_obj) /* deprecated */ EAPI void -evas_object_image_fill_spread_set(Evas_Image *obj EINA_UNUSED, Evas_Fill_Spread spread) +evas_object_image_fill_spread_set(Evas_Object *obj EINA_UNUSED, Evas_Fill_Spread spread) { /* not implemented! */ if (spread != EFL_GFX_FILL_REPEAT) @@ -613,7 +668,7 @@ evas_object_image_fill_spread_set(Evas_Image *obj EINA_UNUSED, Evas_Fill_Spread /* deprecated */ EAPI Evas_Fill_Spread -evas_object_image_fill_spread_get(const Evas_Image *obj EINA_UNUSED) +evas_object_image_fill_spread_get(const Evas_Object *obj EINA_UNUSED) { return EFL_GFX_FILL_REPEAT; } @@ -629,12 +684,12 @@ evas_object_image_source_visible_set(Evas_Object *eo, Eina_Bool visible) * -- jpeg, 2016/03/07 */ + EVAS_IMAGE_LEGACY_API(eo); + 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; @@ -661,12 +716,12 @@ evas_object_image_source_visible_get(const Evas_Object *eo) { /* FIXME: see evas_object_image_source_visible_set */ + EVAS_IMAGE_LEGACY_API(eo, EINA_FALSE); + 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); @@ -680,14 +735,13 @@ evas_object_image_source_visible_get(const Evas_Object *eo) EAPI void* evas_object_image_data_convert(Evas_Object *eo_obj, Evas_Colorspace to_cspace) { + EVAS_IMAGE_LEGACY_API(eo_obj, NULL); + 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)) @@ -712,14 +766,13 @@ evas_object_image_data_convert(Evas_Object *eo_obj, Evas_Colorspace to_cspace) /* deprecated */ EAPI void -evas_object_image_reload(Eo *eo_obj) +evas_object_image_reload(Evas_Object *eo_obj) { + EVAS_IMAGE_LEGACY_API(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)) @@ -751,12 +804,11 @@ evas_object_image_reload(Eo *eo_obj) EAPI Eina_Bool evas_object_image_pixels_import(Evas_Object *eo_obj, Evas_Pixel_Import_Source *pixels) { + EVAS_IMAGE_LEGACY_API(eo_obj, EINA_FALSE); + 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); @@ -821,4 +873,5 @@ 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."); + EVAS_IMAGE_LEGACY_API(eo_obj); } diff --git a/src/lib/evas/canvas/evas_image_private.h b/src/lib/evas/canvas/evas_image_private.h index 3a33961a93..ff7ffcded4 100644 --- a/src/lib/evas/canvas/evas_image_private.h +++ b/src/lib/evas/canvas/evas_image_private.h @@ -25,6 +25,7 @@ #include "../common/evas_convert_colorspace.h" #include "../common/evas_convert_yuv.h" +#include "canvas/evas_image.eo.h" #include "evas_filter.eo.h" #include "evas_filter.h" @@ -140,18 +141,55 @@ struct _Evas_Image_Data 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, Evas_Image_Load_Opts *lo); void _evas_image_done_set(Eo *eo_obj, Evas_Object_Protected_Data *obj, Evas_Image_Data *o); void _evas_image_cleanup(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Evas_Image_Data *o); + +/* Efl.File */ +Eina_Bool _evas_image_mmap_set(Eo *eo_obj, const Eina_File *f, const char *key); +void _evas_image_mmap_get(const Eo *eo_obj, const Eina_File **f, const char **key); +Eina_Bool _evas_image_file_set(Eo *eo_obj, const char *file, const char *key); +void _evas_image_file_get(const Eo *eo_obj, const char **file, const char **key); + +/* Efl.Image.Load */ +Efl_Image_Load_Error _evas_image_load_error_get(const Eo *eo_obj); +void _evas_image_load_async_start(Eo *eo_obj); +void _evas_image_load_async_cancel(Eo *eo_obj); +void _evas_image_load_dpi_set(Eo *eo_obj, double dpi); +double _evas_image_load_dpi_get(const Eo *eo_obj); +void _evas_image_load_size_set(Eo *eo_obj, int w, int h); +void _evas_image_load_size_get(const Eo *eo_obj, int *w, int *h); +void _evas_image_load_scale_down_set(Eo *eo_obj, int scale_down); +int _evas_image_load_scale_down_get(const Eo *eo_obj); +void _evas_image_load_region_set(Eo *eo_obj, int x, int y, int w, int h); +void _evas_image_load_region_get(const Eo *eo_obj, int *x, int *y, int *w, int *h); +void _evas_image_load_orientation_set(Eo *eo_obj, Eina_Bool enable); +Eina_Bool _evas_image_load_orientation_get(const Eo *eo_obj); +Eina_Bool _evas_image_load_region_support_get(const Eo *eo_obj); + +/* Efl.Image.Animated */ +Eina_Bool _evas_image_animated_get(const Eo *eo_obj); +int _evas_image_animated_frame_count_get(const Eo *eo_obj); +Efl_Image_Animated_Loop_Hint _evas_image_animated_loop_type_get(const Eo *eo_obj); +int _evas_image_animated_loop_count_get(const Eo *eo_obj); +double _evas_image_animated_frame_duration_get(const Eo *eo_obj, int start_frame, int frame_num); +Eina_Bool _evas_image_animated_frame_set(Eo *eo_obj, int frame_index); +int _evas_image_animated_frame_get(const Eo *eo_obj); + +/* Efl.Canvas.Proxy */ void _evas_image_proxy_unset(Evas_Object *proxy, Evas_Object_Protected_Data *obj, Evas_Image_Data *o); void _evas_image_proxy_set(Evas_Object *proxy, Evas_Object *src); void _evas_image_proxy_error(Evas_Object *proxy, void *context, void *output, void *surface, int x, int y, Eina_Bool do_async); -void _evas_image_3d_render(Evas *eo_e, Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Evas_Image_Data *o, Evas_Canvas3D_Scene *scene); -void _evas_image_3d_set(Evas_Object *eo_obj, Evas_Canvas3D_Scene *scene); -void _evas_image_3d_unset(Evas_Object *eo_obj, Evas_Object_Protected_Data *image, Evas_Image_Data *o); Eina_Bool _evas_image_proxy_source_set(Eo *eo_obj, Evas_Object *eo_src); Evas_Object *_evas_image_proxy_source_get(const Eo *eo_obj); void _evas_image_proxy_source_clip_set(Eo *eo_obj, Eina_Bool source_clip); Eina_Bool _evas_image_proxy_source_clip_get(const Eo *eo_obj); void _evas_image_proxy_source_events_set(Eo *eo_obj, Eina_Bool source_events); Eina_Bool _evas_image_proxy_source_events_get(const Eo *eo_obj); + +/* Efl.Canvas.Scene3d */ +void _evas_image_3d_render(Evas *eo_e, Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Evas_Image_Data *o, Evas_Canvas3D_Scene *scene); +void _evas_image_3d_set(Evas_Object *eo_obj, Evas_Canvas3D_Scene *scene); +void _evas_image_3d_unset(Evas_Object *eo_obj, Evas_Object_Protected_Data *image, Evas_Image_Data *o); + +/* Efl.Canvas.Surface */ 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); @@ -176,6 +214,12 @@ void _evas_image_load(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Evas # 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) + +# define EINA_COW_LOAD_OPTS_WRITE_END(Obj, Write) \ + EINA_COW_WRITE_END(evas_object_image_load_opts_cow, Obj->load_opts, 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 9abf1c9d6d..2320f6fb54 100644 --- a/src/lib/evas/canvas/evas_object_image.c +++ b/src/lib/evas/canvas/evas_object_image.c @@ -23,7 +23,7 @@ static void _evas_image_render(Eo *eo_obj, Evas_Object_Protected_Data *obj, static void evas_object_image_free(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj); static void evas_object_image_render_pre(Evas_Object *eo_obj, - Evas_Object_Protected_Data *obj, + Evas_Object_Protected_Data *obj, void *type_private_data); static void evas_object_image_render_post(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, @@ -111,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_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) - -# define EINA_COW_LOAD_OPTS_WRITE_END(Obj, Write) \ - EINA_COW_WRITE_END(evas_object_image_load_opts_cow, Obj->load_opts, Write) - # define EVAS_OBJECT_WRITE_IMAGE_FREE_FILE_AND_KEY(Obj) \ if ((!Obj->cur->mmaped_source && Obj->cur->u.file) || Obj->cur->key) \ { \ @@ -354,79 +348,6 @@ _evas_image_done_set(Eo *eo_obj, Evas_Object_Protected_Data *obj, Evas_Image_Dat evas_object_change(eo_obj, obj); } -EOLIAN static Eina_Bool -_evas_image_efl_file_mmap_set(Eo *eo_obj, - Evas_Image_Data *o, - const Eina_File *f, const char *key) -{ - Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS); - Evas_Image_Load_Opts lo; - - if (o->cur->u.f == f) - { - if ((!o->cur->key) && (!key)) - return EINA_FALSE; - if ((o->cur->key) && (key) && (!strcmp(o->cur->key, key))) - return EINA_FALSE; - } - evas_object_async_block(obj); - _evas_image_init_set(f, NULL, key, eo_obj, obj, o, &lo); - o->engine_data = ENFN->image_mmap(ENDT, o->cur->u.f, o->cur->key, &o->load_error, &lo); - _evas_image_done_set(eo_obj, obj, o); - - return EINA_TRUE; -} - -EOLIAN static void -_evas_image_efl_file_mmap_get(Eo *eo_obj EINA_UNUSED, - Evas_Image_Data *o, - const Eina_File **f, const char **key) -{ - if (f) - *f = o->cur->mmaped_source ? o->cur->u.f : NULL; - if (key) - *key = o->cur->key; -} - -EOLIAN static Eina_Bool -_evas_image_efl_file_file_set(Eo *eo_obj, Evas_Image_Data *o, const char *file, const char *key) -{ - Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS); - Evas_Image_Load_Opts lo; - - if ((o->cur->u.file) && (file) && (!strcmp(o->cur->u.file, file))) - { - if ((!o->cur->key) && (!key)) - return EINA_FALSE; - if ((o->cur->key) && (key) && (!strcmp(o->cur->key, key))) - return EINA_FALSE; - } - /* - * WTF? why cancel a null image preload? this is just silly (tm) - if (!o->engine_data) - ENFN->image_data_preload_cancel(ENDT, o->engine_data, eo_obj); - */ - evas_object_async_block(obj); - _evas_image_init_set(NULL, file, key, eo_obj, obj, o, &lo); - o->engine_data = ENFN->image_load(ENDT, o->cur->u.file, o->cur->key, &o->load_error, &lo); - _evas_image_done_set(eo_obj, obj, o); - - return EINA_TRUE; -} - -EOLIAN static void -_evas_image_efl_file_file_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o, const char **file, const char **key) -{ - if (file) - { - if (o->cur->mmaped_source) - *file = eina_file_filename_get(o->cur->u.f); - else - *file = o->cur->u.file; - } - if (key) *key = o->cur->key; -} - EOLIAN static void _evas_image_efl_image_orientation_set(Eo *eo_obj, Evas_Image_Data *o, Efl_Gfx_Orientation _orient) { @@ -483,7 +404,6 @@ _evas_image_efl_image_orientation_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o return (Efl_Gfx_Orientation) o->cur->orient; } - EOLIAN static void _evas_image_eo_base_dbg_info_get(Eo *eo_obj, Evas_Image_Data *o, Eo_Dbg_Info *root) { @@ -505,9 +425,9 @@ _evas_image_eo_base_dbg_info_get(Eo *eo_obj, Evas_Image_Data *o, Eo_Dbg_Info *ro 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); + error = (Evas_Load_Error) _evas_image_load_error_get(eo_obj); EO_DBG_INFO_APPEND(group, "Load Error", EINA_VALUE_TYPE_STRING, - evas_load_error_str(error)); + evas_load_error_str(error)); } } @@ -711,60 +631,6 @@ _evas_image_efl_gfx_buffer_stride_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o return o->cur->image.stride; } -EOLIAN static Efl_Image_Load_Error -_evas_image_efl_image_load_load_error_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o) -{ - return (Efl_Image_Load_Error) o->load_error; -} - -static void -_image_preload_internal(Eo *eo_obj, void *_pd, Eina_Bool cancel) -{ - Evas_Image_Data *o = _pd; - - if (!o->engine_data) - { - o->preloading = EINA_TRUE; - evas_object_inform_call_image_preloaded(eo_obj); - return; - } - // FIXME: if already busy preloading, then dont request again until - // preload done - Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS); - if (cancel) - { - if (o->preloading) - { - o->preloading = EINA_FALSE; - ENFN->image_data_preload_cancel(ENDT, o->engine_data, eo_obj); - } - } - else - { - if (!o->preloading) - { - o->preloading = EINA_TRUE; - ENFN->image_data_preload_request(ENDT, o->engine_data, eo_obj); - } - } -} - -EOLIAN static void -_evas_image_efl_image_load_load_async_start(Eo *eo_obj, Evas_Image_Data *_pd EINA_UNUSED) -{ - Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS); - evas_object_async_block(obj); - _image_preload_internal(eo_obj, _pd, EINA_FALSE); -} - -EOLIAN static void -_evas_image_efl_image_load_load_async_cancel(Eo *eo_obj, Evas_Image_Data *_pd EINA_UNUSED) -{ - Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS); - evas_object_async_block(obj); - _image_preload_internal(eo_obj, _pd, EINA_TRUE); -} - EOLIAN static void _evas_image_efl_gfx_buffer_buffer_update_add(Eo *eo_obj, Evas_Image_Data *o, int x, int y, int w, int h) { @@ -1104,142 +970,6 @@ _evas_image_pixels_dirty_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o) return (o->dirty_pixels ? 1 : 0); } -EOLIAN static void -_evas_image_efl_image_load_load_dpi_set(Eo *eo_obj, Evas_Image_Data *o, double dpi) -{ - Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS); - if (dpi == o->load_opts->dpi) return; - evas_object_async_block(obj); - EINA_COW_LOAD_OPTS_WRITE_BEGIN(o, low) - low->dpi = dpi; - EINA_COW_LOAD_OPTS_WRITE_END(o, low); - - if (o->cur->u.file) - { - _evas_image_unload(eo_obj, obj, 0); - evas_object_inform_call_image_unloaded(eo_obj); - _evas_image_load(eo_obj, obj, o); - o->changed = EINA_TRUE; - evas_object_change(eo_obj, obj); - } -} - -EOLIAN static double -_evas_image_efl_image_load_load_dpi_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o) -{ - return o->load_opts->dpi; -} - -EOLIAN static void -_evas_image_efl_image_load_load_size_set(Eo *eo_obj, Evas_Image_Data *o, int w, int h) -{ - Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS); - if ((o->load_opts->w == w) && (o->load_opts->h == h)) return; - evas_object_async_block(obj); - EINA_COW_LOAD_OPTS_WRITE_BEGIN(o, low) - { - low->w = w; - low->h = h; - } - EINA_COW_LOAD_OPTS_WRITE_END(o, low); - - if (o->cur->u.file) - { - _evas_image_unload(eo_obj, obj, 0); - evas_object_inform_call_image_unloaded(eo_obj); - _evas_image_load(eo_obj, obj, o); - o->changed = EINA_TRUE; - evas_object_change(eo_obj, obj); - } - o->proxyerror = 0; -} - -EOLIAN static void -_evas_image_efl_image_load_load_size_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o, int *w, int *h) -{ - if (w) *w = o->load_opts->w; - if (h) *h = o->load_opts->h; -} - -EOLIAN static void -_evas_image_efl_image_load_load_scale_down_set(Eo *eo_obj, Evas_Image_Data *o, int scale_down) -{ - Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS); - if (o->load_opts->scale_down_by == scale_down) return; - evas_object_async_block(obj); - EINA_COW_LOAD_OPTS_WRITE_BEGIN(o, low) - low->scale_down_by = scale_down; - EINA_COW_LOAD_OPTS_WRITE_END(o, low); - - if (o->cur->u.file) - { - _evas_image_unload(eo_obj, obj, 0); - evas_object_inform_call_image_unloaded(eo_obj); - _evas_image_load(eo_obj, obj, o); - o->changed = EINA_TRUE; - evas_object_change(eo_obj, obj); - } -} - -EOLIAN static int -_evas_image_efl_image_load_load_scale_down_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o) -{ - return o->load_opts->scale_down_by; -} - -EOLIAN static void -_evas_image_efl_image_load_load_region_set(Eo *eo_obj, Evas_Image_Data *o, int x, int y, int w, int h) -{ - Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS); - if ((o->load_opts->region.x == x) && (o->load_opts->region.y == y) && - (o->load_opts->region.w == w) && (o->load_opts->region.h == h)) return; - evas_object_async_block(obj); - EINA_COW_LOAD_OPTS_WRITE_BEGIN(o, low) - { - low->region.x = x; - low->region.y = y; - low->region.w = w; - low->region.h = h; - } - EINA_COW_LOAD_OPTS_WRITE_END(o, low); - - if (o->cur->u.file) - { - _evas_image_unload(eo_obj, obj, 0); - evas_object_inform_call_image_unloaded(eo_obj); - _evas_image_load(eo_obj, obj, o); - o->changed = EINA_TRUE; - evas_object_change(eo_obj, obj); - } -} - -EOLIAN static void -_evas_image_efl_image_load_load_region_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o, int *x, int *y, int *w, int *h) -{ - if (x) *x = o->load_opts->region.x; - if (y) *y = o->load_opts->region.y; - if (w) *w = o->load_opts->region.w; - if (h) *h = o->load_opts->region.h; -} - -EOLIAN static void -_evas_image_efl_image_load_load_orientation_set(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o, Eina_Bool enable) -{ - Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS); - if (o->load_opts->orientation == !!enable) return; - evas_object_async_block(obj); - - EINA_COW_LOAD_OPTS_WRITE_BEGIN(o, low) - low->orientation = !!enable; - EINA_COW_LOAD_OPTS_WRITE_END(o, low); -} - -EOLIAN static Eina_Bool -_evas_image_efl_image_load_load_orientation_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o) -{ - return o->load_opts->orientation;; -} - EOLIAN static Efl_Gfx_Colorspace _evas_image_efl_gfx_buffer_colorspace_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o) { @@ -1353,136 +1083,6 @@ _evas_image_efl_image_content_hint_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data * return o->content_hint; } -EOLIAN static Eina_Bool -_evas_image_efl_image_load_load_region_support_get(Eo *eo_obj, Evas_Image_Data *o) -{ - Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS); - - return ENFN->image_can_region_get(ENDT, o->engine_data); -} - -/* animated feature */ -EOLIAN static Eina_Bool -_evas_image_efl_image_animated_animated_get(Eo *eo_obj, Evas_Image_Data *o) -{ - Eina_Bool animated; - Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS); - - animated = - ENFN->image_animated_get ? - ENFN->image_animated_get(ENDT, o->engine_data) : - EINA_FALSE; - - return animated; -} - -EOLIAN static int -_evas_image_efl_image_animated_animated_frame_count_get(Eo *eo_obj, Evas_Image_Data *o) -{ - int frame_count; - frame_count = -1; - - if (!evas_object_image_animated_get(eo_obj)) return frame_count; - Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS); - - if (ENFN->image_animated_frame_count_get) - frame_count = ENFN->image_animated_frame_count_get(ENDT, o->engine_data); - - return frame_count; -} - -EOLIAN static Efl_Image_Animated_Loop_Hint -_evas_image_efl_image_animated_animated_loop_type_get(Eo *eo_obj, Evas_Image_Data *o) -{ - Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS); - Efl_Image_Animated_Loop_Hint hint = EFL_IMAGE_ANIMATED_LOOP_HINT_NONE; - - if (!evas_object_image_animated_get(eo_obj)) return hint; - - if (ENFN->image_animated_loop_type_get) - hint = (Efl_Image_Animated_Loop_Hint) ENFN->image_animated_loop_type_get(ENDT, o->engine_data); - - return hint; -} - -EOLIAN static int -_evas_image_efl_image_animated_animated_loop_count_get(Eo *eo_obj, Evas_Image_Data *o) -{ - Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS); - - int loop_count; - loop_count = -1; - if (!evas_object_image_animated_get(eo_obj)) return loop_count; - - loop_count = - ENFN->image_animated_loop_count_get ? - ENFN->image_animated_loop_count_get(ENDT, o->engine_data) : - -1; - - return loop_count; -} - -EOLIAN static double -_evas_image_efl_image_animated_animated_frame_duration_get(Eo *eo_obj, Evas_Image_Data *o, int start_frame, int frame_num) -{ - Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS); - double frame_duration = -1; - int frame_count = 0; - - if (!ENFN->image_animated_frame_count_get) return frame_duration; - - frame_count = ENFN->image_animated_frame_count_get(ENDT, o->engine_data); - - if ((start_frame + frame_num) > frame_count) return frame_duration; - if (ENFN->image_animated_frame_duration_get) - frame_duration = ENFN->image_animated_frame_duration_get(ENDT, o->engine_data, start_frame, frame_num); - - return frame_duration; -} - -EOLIAN static Eina_Bool -_evas_image_efl_image_animated_animated_frame_set(Eo *eo_obj, Evas_Image_Data *o, int frame_index) -{ - Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS); - int frame_count = 0; - - if (!o->cur->u.file) return EINA_FALSE; - if (o->cur->frame == frame_index) return EINA_TRUE; - - if (!evas_object_image_animated_get(eo_obj)) return EINA_FALSE; - evas_object_async_block(obj); - frame_count = evas_object_image_animated_frame_count_get(eo_obj); - - /* limit the size of frame to FRAME_MAX */ - if ((frame_count > FRAME_MAX) || (frame_count < 0) || (frame_index > frame_count)) - return EINA_FALSE; - - if (!ENFN->image_animated_frame_set) return EINA_FALSE; - ENFN->image_animated_frame_set(ENDT, o->engine_data, frame_index); -// if (!ENFN->image_animated_frame_set(ENDT, o->engine_data, frame_index)) return; - - EINA_COW_WRITE_BEGIN(evas_object_image_state_cow, o->prev, Evas_Object_Image_State, prev_write) - prev_write->frame = o->cur->frame; - EINA_COW_WRITE_END(evas_object_image_state_cow, o->prev, prev_write); - - EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write) - state_write->frame = frame_index; - EINA_COW_IMAGE_STATE_WRITE_END(o, state_write); - - o->changed = EINA_TRUE; - evas_object_change(eo_obj, obj); - - return EINA_TRUE; -} - -EOLIAN static int -_evas_image_efl_image_animated_animated_frame_get(Eo *eo_obj, Evas_Image_Data *o) -{ - if (!o->cur->u.file) return EINA_FALSE; - if (!evas_object_image_animated_get(eo_obj)) return EINA_FALSE; - return o->cur->frame; -} - EOLIAN void _evas_canvas_image_cache_flush(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e) { @@ -1500,24 +1100,24 @@ _evas_canvas_image_cache_reload(Eo *eo_e, Evas_Public_Data *e) evas_image_cache_flush(eo_e); EINA_INLIST_FOREACH(e->layers, layer) { - Evas_Object_Protected_Data *obj; + Evas_Object_Protected_Data *obj; - EINA_INLIST_FOREACH(layer->objects, obj) - { + EINA_INLIST_FOREACH(layer->objects, obj) + { if (eo_isa(obj->object, MY_CLASS)) { _evas_image_unload(obj->object, obj, 1); evas_object_inform_call_image_unloaded(obj->object); } - } + } } evas_image_cache_flush(eo_e); EINA_INLIST_FOREACH(e->layers, layer) { - Evas_Object_Protected_Data *obj; + Evas_Object_Protected_Data *obj; - EINA_INLIST_FOREACH(layer->objects, obj) - { + EINA_INLIST_FOREACH(layer->objects, obj) + { if (eo_isa(obj->object, MY_CLASS)) { Evas_Image_Data *o = eo_data_scope_get(obj->object, MY_CLASS); @@ -1525,7 +1125,7 @@ _evas_canvas_image_cache_reload(Eo *eo_e, Evas_Public_Data *e) o->changed = EINA_TRUE; evas_object_change(obj->object, obj); } - } + } } evas_image_cache_flush(eo_e); } @@ -1718,11 +1318,12 @@ evas_object_image_init(Evas_Object *eo_obj) } EOLIAN static void -_evas_image_eo_base_destructor(Eo *eo_obj, Evas_Image_Data *_pd EINA_UNUSED) +_evas_image_eo_base_destructor(Eo *eo_obj, Evas_Image_Data *o EINA_UNUSED) { Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS); - evas_object_image_video_surface_set(eo_obj, NULL); + if (obj->legacy) + evas_object_image_video_surface_set(eo_obj, NULL); evas_object_image_free(eo_obj, obj); eo_destructor(eo_super(eo_obj, MY_CLASS)); } @@ -3913,6 +3514,41 @@ evas_object_image_data_copy_set(Eo *eo_obj, void *data) EVAS_OBJECT_WRITE_IMAGE_FREE_FILE_AND_KEY(o); } +/* FIXME: Temporarily allow efl_file_ APIs on Evas.Image. + * They don't belong here, as only Efl.Canvas.Image should support them. + * Elm.Image uses them, though, instead of using the legacy APIs... + */ + +EOLIAN static Eina_Bool +_evas_image_efl_file_file_set(Eo *obj, Evas_Image_Data *pd EINA_UNUSED, const char *file, const char *key) +{ + DBG("efl_file_set shouldn't be used on Evas.Image. please switch to Efl.Canvas.Image"); + return _evas_image_file_set(obj, file, key); +} + +EOLIAN static void +_evas_image_efl_file_file_get(Eo *obj, Evas_Image_Data *pd EINA_UNUSED, const char **file, const char **key) +{ + DBG("efl_file_get shouldn't be used on Evas.Image. please switch to Efl.Canvas.Image"); + _evas_image_file_get(obj, file, key); +} + +EOLIAN static Eina_Bool +_evas_image_efl_file_mmap_set(Eo *obj, Evas_Image_Data *pd EINA_UNUSED, const Eina_File *f, const char *key) +{ + DBG("efl_file_mmap_set shouldn't be used on Evas.Image. please switch to Efl.Canvas.Image"); + return _evas_image_mmap_set(obj, f, key); +} + + +EOLIAN static void +_evas_image_efl_file_mmap_get(Eo *obj, Evas_Image_Data *pd EINA_UNUSED, const Eina_File **f, const char **key) +{ + DBG("efl_file_mmap_get shouldn't be used on Evas.Image. please switch to Efl.Canvas.Image"); + _evas_image_mmap_get(obj, f, key); +} + + #include "canvas/evas_image.eo.c" /* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/ diff --git a/src/lib/evas/canvas/evas_object_main.c b/src/lib/evas/canvas/evas_object_main.c index 71e0276437..c423567c43 100644 --- a/src/lib/evas/canvas/evas_object_main.c +++ b/src/lib/evas/canvas/evas_object_main.c @@ -788,11 +788,13 @@ _evas_object_eo_base_destructor(Eo *eo_obj, Evas_Object_Protected_Data *obj) evas_object_clip_unset(tmp->object); } } + + /* FIXME: Proxies should listen to source death */ EINA_LIST_FOREACH_SAFE(obj->proxy->proxies, l, l2, proxy) { if (eo_isa(proxy, EVAS_IMAGE_CLASS)) evas_object_image_source_unset(proxy); - else if (eo_isa(proxy, EVAS_TEXT_CLASS)) + if (eo_isa(proxy, EFL_GFX_FILTER_INTERFACE)) efl_gfx_filter_source_set(proxy, NULL, eo_obj); } diff --git a/src/modules/evas/engines/gl_common/evas_gl_preload.c b/src/modules/evas/engines/gl_common/evas_gl_preload.c index 52a8429092..d97ce950d8 100644 --- a/src/modules/evas/engines/gl_common/evas_gl_preload.c +++ b/src/modules/evas/engines/gl_common/evas_gl_preload.c @@ -105,7 +105,7 @@ _evas_gl_preload_main_loop_wakeup(void) if (async->tex) { EINA_LIST_FREE(async->tex->targets, target) - evas_obj_image_pixels_dirty_set(target, EINA_TRUE); + evas_object_image_pixels_dirty_set(target, EINA_TRUE); } async->im->cache_entry.flags.preload_done = 0; if (async->tex) |