forked from enlightenment/efl
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.
This commit is contained in:
parent
6b03d46d54
commit
6ac68c9252
|
@ -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 \
|
||||
|
|
|
@ -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.");
|
||||
}
|
|
@ -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
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue