2016-03-14 03:38:44 -07:00
|
|
|
#include "evas_image_private.h"
|
2008-11-04 01:19:35 -08:00
|
|
|
|
2014-06-02 06:47:59 -07:00
|
|
|
#define MY_CLASS EVAS_IMAGE_CLASS
|
2013-11-07 03:16:01 -08:00
|
|
|
#define MY_CLASS_NAME "Evas_Image"
|
2013-01-28 22:36:23 -08:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
/* private magic number for image objects */
|
|
|
|
static const char o_type[] = "image";
|
|
|
|
|
2014-11-12 17:40:16 -08:00
|
|
|
const char *o_image_type = o_type;
|
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
/* private methods for image objects */
|
2012-10-08 18:58:41 -07:00
|
|
|
static void evas_object_image_unload(Evas_Object *eo_obj, Eina_Bool dirty);
|
2014-03-12 07:28:40 -07:00
|
|
|
static void evas_object_image_load(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Evas_Image_Data *o);
|
2012-10-08 18:58:41 -07:00
|
|
|
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);
|
|
|
|
|
|
|
|
static void evas_object_image_init(Evas_Object *eo_obj);
|
2013-07-08 17:46:15 -07:00
|
|
|
static void evas_object_image_render(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj,
|
|
|
|
void *type_private_data,
|
|
|
|
void *output, void *context, void *surface,
|
|
|
|
int x, int y, Eina_Bool do_async);
|
2015-06-18 05:45:21 -07:00
|
|
|
static void _evas_image_render(Eo *eo_obj, Evas_Object_Protected_Data *obj,
|
|
|
|
void *output, void *context, void *surface,
|
2015-10-01 03:59:22 -07:00
|
|
|
int x, int y, int l, int t, int r, int b, Eina_Bool do_async);
|
2013-07-08 17:46:15 -07:00
|
|
|
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,
|
|
|
|
void *type_private_data);
|
|
|
|
static void evas_object_image_render_post(Evas_Object *eo_obj,
|
|
|
|
Evas_Object_Protected_Data *obj,
|
|
|
|
void *type_private_data);
|
2012-10-08 18:58:41 -07:00
|
|
|
|
|
|
|
static unsigned int evas_object_image_id_get(Evas_Object *eo_obj);
|
|
|
|
static unsigned int evas_object_image_visual_id_get(Evas_Object *eo_obj);
|
|
|
|
static void *evas_object_image_engine_data_get(Evas_Object *eo_obj);
|
|
|
|
|
2013-07-08 17:46:15 -07:00
|
|
|
static int evas_object_image_is_opaque(Evas_Object *eo_obj,
|
|
|
|
Evas_Object_Protected_Data *obj,
|
|
|
|
void *type_private_data);
|
|
|
|
static int evas_object_image_was_opaque(Evas_Object *eo_obj,
|
|
|
|
Evas_Object_Protected_Data *obj,
|
|
|
|
void *type_private_data);
|
|
|
|
static int evas_object_image_is_inside(Evas_Object *eo_obj,
|
|
|
|
Evas_Object_Protected_Data *obj,
|
|
|
|
void *type_private_data,
|
|
|
|
Evas_Coord x, Evas_Coord y);
|
|
|
|
static int evas_object_image_has_opaque_rect(Evas_Object *eo_obj,
|
|
|
|
Evas_Object_Protected_Data *obj,
|
|
|
|
void *type_private_data);
|
|
|
|
static int evas_object_image_get_opaque_rect(Evas_Object *eo_obj,
|
|
|
|
Evas_Object_Protected_Data *obj,
|
|
|
|
void *type_private_data,
|
|
|
|
Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
|
2012-10-08 18:58:41 -07:00
|
|
|
static int evas_object_image_can_map(Evas_Object *eo_obj);
|
2002-11-08 00:02:15 -08:00
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
static void *evas_object_image_data_convert_internal(Evas_Image_Data *o, void *data, Evas_Colorspace to_cspace);
|
2012-10-08 18:58:41 -07:00
|
|
|
static void evas_object_image_filled_resize_listener(void *data, Evas *eo_e, Evas_Object *eo_obj, void *einfo);
|
2008-05-18 20:13:16 -07:00
|
|
|
|
2007-05-06 04:29:37 -07:00
|
|
|
static const Evas_Object_Func object_func =
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
/* methods (compulsory) */
|
2012-10-08 18:58:41 -07:00
|
|
|
NULL,
|
2008-11-15 02:39:46 -08:00
|
|
|
evas_object_image_render,
|
|
|
|
evas_object_image_render_pre,
|
|
|
|
evas_object_image_render_post,
|
|
|
|
evas_object_image_id_get,
|
|
|
|
evas_object_image_visual_id_get,
|
|
|
|
evas_object_image_engine_data_get,
|
|
|
|
/* these are optional. NULL = nothing */
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
evas_object_image_is_opaque,
|
|
|
|
evas_object_image_was_opaque,
|
|
|
|
evas_object_image_is_inside,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
2009-02-16 20:53:03 -08:00
|
|
|
NULL,
|
|
|
|
evas_object_image_has_opaque_rect,
|
2009-10-28 01:59:01 -07:00
|
|
|
evas_object_image_get_opaque_rect,
|
2015-07-21 05:54:23 -07:00
|
|
|
evas_object_image_can_map,
|
|
|
|
NULL
|
2002-11-08 00:02:15 -08:00
|
|
|
};
|
|
|
|
|
2013-01-23 17:50:57 -08:00
|
|
|
static const Evas_Object_Image_Load_Opts default_load_opts = {
|
2013-05-20 03:23:36 -07:00
|
|
|
0, 0.0, 0, 0, { 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0 }, 0
|
2013-01-23 17:50:57 -08:00
|
|
|
};
|
|
|
|
|
2013-01-25 04:15:38 -08:00
|
|
|
static const Evas_Object_Image_Pixels default_pixels = {
|
2015-10-11 20:03:52 -07:00
|
|
|
NULL, { NULL, NULL }, { 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL }, ~0x0
|
2013-01-25 04:15:38 -08:00
|
|
|
};
|
|
|
|
|
2013-01-27 16:28:53 -08:00
|
|
|
static const Evas_Object_Image_State default_state = {
|
|
|
|
{ 0, 0, 0, 0 }, // fill
|
|
|
|
{ 0, 0, 0 }, // image
|
2013-04-06 23:33:58 -07:00
|
|
|
{ 1.0, 0, 0, 0, 0, 1 }, // border
|
2014-04-25 04:01:26 -07:00
|
|
|
NULL, NULL, NULL, //source, defmap, scene
|
|
|
|
{ NULL }, //u
|
2014-04-25 04:10:46 -07:00
|
|
|
NULL, //key
|
2014-04-25 04:01:26 -07:00
|
|
|
0, //frame
|
2013-04-06 23:33:58 -07:00
|
|
|
EVAS_COLORSPACE_ARGB8888,
|
evas: add image orient set/get API in software backend for now.
Summary:
Added API's to rotate(0, 90, 180, 270), flip(horizontal, vertical, transpose, transverse)
evas image object. Also added example to demonstrate this.
Signed-off-by: kabeer khan <kabeer.khan@samsung.com>
Reviewers: raster, stephenmhouston, cedric
Subscribers: stephenmhouston, cedric
Differential Revision: https://phab.enlightenment.org/D1950
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-02-11 08:30:49 -08:00
|
|
|
EVAS_IMAGE_ORIENT_NONE,
|
2014-03-17 00:10:03 -07:00
|
|
|
|
2016-03-01 23:38:57 -08:00
|
|
|
EINA_TRUE, // smooth
|
|
|
|
EINA_FALSE, // has_alpha
|
|
|
|
EINA_FALSE, // opaque_valid
|
|
|
|
EINA_FALSE, // opaque
|
|
|
|
EINA_FALSE // mmapped_source
|
2013-01-27 16:28:53 -08:00
|
|
|
};
|
|
|
|
|
2013-01-23 17:50:57 -08:00
|
|
|
Eina_Cow *evas_object_image_load_opts_cow = NULL;
|
2013-01-25 04:15:38 -08:00
|
|
|
Eina_Cow *evas_object_image_pixels_cow = NULL;
|
2013-01-27 16:28:53 -08:00
|
|
|
Eina_Cow *evas_object_image_state_cow = NULL;
|
2013-01-25 04:15:38 -08:00
|
|
|
|
|
|
|
# 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)
|
|
|
|
|
|
|
|
# define EINA_COW_LOAD_OPTS_WRITE_END(Obj, Write) \
|
|
|
|
EINA_COW_WRITE_END(evas_object_image_load_opts_cow, Obj->load_opts, Write)
|
2013-01-23 17:50:57 -08:00
|
|
|
|
2013-07-11 00:03:01 -07:00
|
|
|
# define EVAS_OBJECT_WRITE_IMAGE_FREE_FILE_AND_KEY(Obj) \
|
|
|
|
if ((!Obj->cur->mmaped_source && Obj->cur->u.file) || Obj->cur->key) \
|
|
|
|
{ \
|
|
|
|
EINA_COW_IMAGE_STATE_WRITE_BEGIN(Obj, cur_write) \
|
2013-01-27 16:28:53 -08:00
|
|
|
{ \
|
2013-03-03 18:08:49 -08:00
|
|
|
EINA_COW_WRITE_BEGIN(evas_object_image_state_cow, Obj->prev, Evas_Object_Image_State, prev_write) \
|
2013-01-27 16:28:53 -08:00
|
|
|
EVAS_OBJECT_IMAGE_FREE_FILE_AND_KEY(cur_write, prev_write); \
|
2013-03-03 18:08:49 -08:00
|
|
|
EINA_COW_WRITE_END(evas_object_image_state_cow, Obj->prev, prev_write); \
|
2013-01-27 16:28:53 -08:00
|
|
|
} \
|
2013-07-11 00:03:01 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_END(Obj, cur_write); \
|
2013-01-27 16:28:53 -08:00
|
|
|
}
|
|
|
|
|
2016-03-14 03:38:44 -07:00
|
|
|
void
|
2016-03-07 21:11:07 -08:00
|
|
|
_evas_image_cleanup(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Evas_Image_Data *o)
|
2011-10-02 20:28:52 -07:00
|
|
|
{
|
2014-10-28 22:15:11 -07:00
|
|
|
/* Eina_Cow doesn't know if the resulting memory has changed, better check
|
|
|
|
before we change it */
|
|
|
|
if (o->cur->opaque_valid)
|
2013-03-12 05:58:19 -07:00
|
|
|
{
|
2014-10-28 22:15:11 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
|
|
|
|
{
|
|
|
|
state_write->opaque_valid = 0;
|
|
|
|
}
|
|
|
|
EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
|
2013-03-12 05:58:19 -07:00
|
|
|
}
|
|
|
|
|
2011-10-02 20:28:52 -07:00
|
|
|
if ((o->preloading) && (o->engine_data))
|
|
|
|
{
|
2012-09-04 01:56:46 -07:00
|
|
|
o->preloading = EINA_FALSE;
|
2014-10-22 02:34:51 -07:00
|
|
|
ENFN->image_data_preload_cancel(ENDT, o->engine_data, eo_obj);
|
2011-10-02 20:28:52 -07:00
|
|
|
}
|
2016-03-07 21:11:07 -08:00
|
|
|
if (o->cur->source) _evas_image_proxy_unset(eo_obj, obj, o);
|
|
|
|
if (o->cur->scene) _evas_image_3d_unset(eo_obj, obj, o);
|
2011-10-02 20:28:52 -07:00
|
|
|
}
|
|
|
|
|
2013-01-25 04:15:38 -08:00
|
|
|
static Eina_Bool
|
2015-05-20 06:56:45 -07:00
|
|
|
_init_cow(void)
|
2013-01-25 04:15:38 -08:00
|
|
|
{
|
2013-01-27 16:28:53 -08:00
|
|
|
if (!evas_object_image_load_opts_cow ||
|
|
|
|
!evas_object_image_pixels_cow ||
|
|
|
|
!evas_object_image_state_cow)
|
2013-01-25 04:15:38 -08:00
|
|
|
{
|
|
|
|
evas_object_image_load_opts_cow = eina_cow_add("Evas_Object_Image load opts",
|
|
|
|
sizeof (Evas_Object_Image_Load_Opts),
|
|
|
|
8,
|
2013-04-02 01:10:35 -07:00
|
|
|
&default_load_opts,
|
|
|
|
EINA_TRUE);
|
2013-01-25 04:15:38 -08:00
|
|
|
evas_object_image_pixels_cow = eina_cow_add("Evas_Object_Image pixels",
|
|
|
|
sizeof (Evas_Object_Image_Pixels),
|
|
|
|
8,
|
2013-04-02 01:10:35 -07:00
|
|
|
&default_pixels,
|
|
|
|
EINA_TRUE);
|
2013-01-27 16:28:53 -08:00
|
|
|
evas_object_image_state_cow = eina_cow_add("Evas_Object_Image states",
|
|
|
|
sizeof (Evas_Object_Image_State),
|
|
|
|
8,
|
2013-04-02 01:10:35 -07:00
|
|
|
&default_state,
|
|
|
|
EINA_TRUE);
|
2013-01-25 04:15:38 -08:00
|
|
|
}
|
2013-01-27 16:28:53 -08:00
|
|
|
if (!evas_object_image_load_opts_cow ||
|
|
|
|
!evas_object_image_pixels_cow ||
|
|
|
|
!evas_object_image_state_cow)
|
2013-01-25 04:15:38 -08:00
|
|
|
{
|
2015-05-20 06:56:45 -07:00
|
|
|
ERR("Failed to init cow.");
|
2013-01-25 04:15:38 -08:00
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2015-05-19 03:41:27 -07:00
|
|
|
EOLIAN static Eo *
|
2014-03-18 07:01:24 -07:00
|
|
|
_evas_image_eo_base_constructor(Eo *eo_obj, Evas_Image_Data *o)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2014-06-02 06:47:59 -07:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2013-01-27 16:28:53 -08:00
|
|
|
Evas_Colorspace cspace;
|
2002-11-08 00:02:15 -08:00
|
|
|
|
2016-03-01 10:06:28 -08:00
|
|
|
eo_obj = eo_constructor(eo_super(eo_obj, MY_CLASS));
|
2013-09-24 21:32:56 -07:00
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_image_init(eo_obj);
|
2013-01-23 17:50:57 -08:00
|
|
|
|
2015-05-20 06:56:45 -07:00
|
|
|
if (!_init_cow())
|
2015-05-19 03:41:27 -07:00
|
|
|
return NULL;
|
2013-01-23 17:50:57 -08:00
|
|
|
|
|
|
|
o->load_opts = eina_cow_alloc(evas_object_image_load_opts_cow);
|
2013-01-25 04:15:38 -08:00
|
|
|
o->pixels = eina_cow_alloc(evas_object_image_pixels_cow);
|
2013-01-27 16:28:53 -08:00
|
|
|
o->cur = eina_cow_alloc(evas_object_image_state_cow);
|
|
|
|
o->prev = eina_cow_alloc(evas_object_image_state_cow);
|
2013-04-28 23:30:37 -07:00
|
|
|
o->proxy_src_clip = EINA_TRUE;
|
2013-01-27 16:28:53 -08:00
|
|
|
|
2014-10-22 02:34:51 -07:00
|
|
|
cspace = ENFN->image_colorspace_get(ENDT, o->engine_data);
|
2015-06-18 05:45:21 -07:00
|
|
|
if (cspace != o->cur->cspace)
|
2013-01-27 16:28:53 -08:00
|
|
|
{
|
2013-03-12 05:58:19 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
|
2013-01-27 16:28:53 -08:00
|
|
|
state_write->cspace = cspace;
|
2013-03-12 05:58:19 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
|
2013-01-27 16:28:53 -08:00
|
|
|
}
|
2015-05-19 03:41:27 -07:00
|
|
|
|
|
|
|
return eo_obj;
|
2012-10-08 18:58:41 -07:00
|
|
|
}
|
|
|
|
|
2016-03-01 22:44:12 -08:00
|
|
|
EOLIAN static Eo *
|
|
|
|
_evas_image_eo_base_finalize(Eo *eo_obj, Evas_Image_Data *o)
|
|
|
|
{
|
|
|
|
if (!o->filled_set)
|
|
|
|
efl_gfx_fill_filled_set(eo_obj, EINA_TRUE);
|
|
|
|
return eo_finalize(eo_super(eo_obj, MY_CLASS));
|
|
|
|
}
|
|
|
|
|
2011-03-14 03:53:37 -07:00
|
|
|
EAPI void
|
2013-07-30 19:53:39 -07:00
|
|
|
evas_object_image_memfile_set(Evas_Object *eo_obj, void *data, int size, char *format EINA_UNUSED, char *key)
|
2011-03-14 03:53:37 -07:00
|
|
|
{
|
2013-07-30 19:53:39 -07:00
|
|
|
Eina_File *f;
|
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
|
2011-03-14 03:53:37 -07:00
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
2012-10-08 18:58:41 -07:00
|
|
|
|
2013-08-09 04:35:02 -07:00
|
|
|
f = eina_file_virtualize(NULL, data, size, EINA_TRUE);
|
2013-07-30 19:53:39 -07:00
|
|
|
if (!f) return ;
|
2016-03-01 10:06:28 -08:00
|
|
|
efl_file_mmap_set(eo_obj, f, key);
|
2013-07-30 19:53:39 -07:00
|
|
|
eina_file_close(f);
|
2011-03-14 03:53:37 -07:00
|
|
|
}
|
|
|
|
|
2016-03-07 21:11:07 -08:00
|
|
|
void
|
|
|
|
_evas_image_init_set(const Eina_File *f, const char *file, const char *key,
|
2014-03-12 07:28:40 -07:00
|
|
|
Eo *eo_obj, Evas_Object_Protected_Data *obj, Evas_Image_Data *o,
|
2013-05-07 23:37:37 -07:00
|
|
|
Evas_Image_Load_Opts *lo)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
2016-03-07 21:11:07 -08:00
|
|
|
if (o->cur->source) _evas_image_proxy_unset(eo_obj, obj, o);
|
|
|
|
if (o->cur->scene) _evas_image_3d_unset(eo_obj, obj, o);
|
2013-12-26 23:56:30 -08:00
|
|
|
|
2013-03-12 05:58:19 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
|
2013-01-27 16:28:53 -08:00
|
|
|
{
|
2013-08-11 20:12:13 -07:00
|
|
|
if (f)
|
|
|
|
{
|
|
|
|
if (!state_write->mmaped_source)
|
|
|
|
eina_stringshare_del(state_write->u.file);
|
2015-06-29 04:55:57 -07:00
|
|
|
else if (state_write->u.f)
|
|
|
|
eina_file_close(state_write->u.f);
|
2013-08-11 20:12:13 -07:00
|
|
|
state_write->u.f = eina_file_dup(f);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!state_write->mmaped_source)
|
|
|
|
eina_stringshare_replace(&state_write->u.file, file);
|
|
|
|
else
|
2015-06-29 04:55:57 -07:00
|
|
|
{
|
2013-08-11 20:12:13 -07:00
|
|
|
if (state_write->u.f) eina_file_close(state_write->u.f);
|
|
|
|
state_write->u.file = eina_stringshare_add(file);
|
2015-06-29 04:55:57 -07:00
|
|
|
}
|
2013-08-11 20:12:13 -07:00
|
|
|
}
|
2013-07-11 00:03:01 -07:00
|
|
|
state_write->mmaped_source = !!f;
|
2013-05-07 23:37:37 -07:00
|
|
|
eina_stringshare_replace(&state_write->key, key);
|
2015-06-29 04:55:57 -07:00
|
|
|
|
|
|
|
state_write->opaque_valid = 0;
|
2013-01-27 16:28:53 -08:00
|
|
|
}
|
2013-03-12 05:58:19 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
|
2013-01-27 16:28:53 -08:00
|
|
|
|
2013-07-11 00:03:01 -07:00
|
|
|
if (o->prev->u.file != NULL || o->prev->key != NULL)
|
2013-01-27 16:28:53 -08:00
|
|
|
{
|
2013-07-11 00:03:01 -07:00
|
|
|
EINA_COW_WRITE_BEGIN(evas_object_image_state_cow, o->prev, Evas_Object_Image_State, state_write)
|
|
|
|
{
|
|
|
|
state_write->u.file = NULL;
|
|
|
|
state_write->key = NULL;
|
|
|
|
}
|
|
|
|
EINA_COW_WRITE_END(evas_object_image_state_cow, o->prev, state_write);
|
2013-01-27 16:28:53 -08:00
|
|
|
}
|
2014-04-14 03:03:47 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
if (o->engine_data)
|
2009-09-27 20:51:21 -07:00
|
|
|
{
|
2011-05-02 20:20:02 -07:00
|
|
|
if (o->preloading)
|
|
|
|
{
|
2012-09-04 01:56:46 -07:00
|
|
|
o->preloading = EINA_FALSE;
|
2014-10-22 02:34:51 -07:00
|
|
|
ENFN->image_data_preload_cancel(ENDT, o->engine_data, eo_obj);
|
2011-05-02 20:20:02 -07:00
|
|
|
}
|
2014-10-22 02:34:51 -07:00
|
|
|
ENFN->image_free(ENDT, o->engine_data);
|
2009-09-27 20:51:21 -07:00
|
|
|
}
|
2002-11-08 00:02:15 -08:00
|
|
|
o->load_error = EVAS_LOAD_ERROR_NONE;
|
2013-05-07 23:37:37 -07:00
|
|
|
lo->scale_down_by = o->load_opts->scale_down_by;
|
|
|
|
lo->dpi = o->load_opts->dpi;
|
|
|
|
lo->w = o->load_opts->w;
|
|
|
|
lo->h = o->load_opts->h;
|
|
|
|
lo->region.x = o->load_opts->region.x;
|
|
|
|
lo->region.y = o->load_opts->region.y;
|
|
|
|
lo->region.w = o->load_opts->region.w;
|
|
|
|
lo->region.h = o->load_opts->region.h;
|
|
|
|
lo->scale_load.src_x = o->load_opts->scale_load.src_x;
|
|
|
|
lo->scale_load.src_y = o->load_opts->scale_load.src_y;
|
|
|
|
lo->scale_load.src_w = o->load_opts->scale_load.src_w;
|
|
|
|
lo->scale_load.src_h = o->load_opts->scale_load.src_h;
|
|
|
|
lo->scale_load.dst_w = o->load_opts->scale_load.dst_w;
|
|
|
|
lo->scale_load.dst_h = o->load_opts->scale_load.dst_h;
|
|
|
|
lo->scale_load.smooth = o->load_opts->scale_load.smooth;
|
|
|
|
lo->scale_load.scale_hint = o->load_opts->scale_load.scale_hint;
|
|
|
|
lo->orientation = o->load_opts->orientation;
|
2013-05-20 03:23:36 -07:00
|
|
|
lo->degree = 0;
|
2013-05-07 23:37:37 -07:00
|
|
|
}
|
|
|
|
|
2016-03-07 21:11:07 -08:00
|
|
|
void
|
|
|
|
_evas_image_done_set(Eo *eo_obj, Evas_Object_Protected_Data *obj, Evas_Image_Data *o)
|
2013-05-07 23:37:37 -07:00
|
|
|
{
|
|
|
|
Eina_Bool resize_call = EINA_FALSE;
|
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
if (o->engine_data)
|
|
|
|
{
|
2012-09-04 01:42:38 -07:00
|
|
|
int w, h;
|
|
|
|
int stride;
|
|
|
|
|
2014-10-22 02:34:51 -07:00
|
|
|
ENFN->image_size_get(ENDT, o->engine_data, &w, &h);
|
|
|
|
if (ENFN->image_stride_get)
|
|
|
|
ENFN->image_stride_get(ENDT, o->engine_data, &stride);
|
2012-09-04 01:42:38 -07:00
|
|
|
else
|
|
|
|
stride = w * 4;
|
2014-03-19 19:10:43 -07:00
|
|
|
|
2013-03-12 05:58:19 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
|
2013-01-27 16:28:53 -08:00
|
|
|
{
|
2014-10-22 02:34:51 -07:00
|
|
|
state_write->has_alpha = ENFN->image_alpha_get(ENDT, o->engine_data);
|
|
|
|
state_write->cspace = ENFN->image_colorspace_get(ENDT, o->engine_data);
|
2012-09-04 21:20:42 -07:00
|
|
|
|
2013-01-27 16:28:53 -08:00
|
|
|
if ((o->cur->image.w != w) || (o->cur->image.h != h))
|
|
|
|
resize_call = EINA_TRUE;
|
2012-09-04 21:20:42 -07:00
|
|
|
|
2013-01-27 16:28:53 -08:00
|
|
|
state_write->image.w = w;
|
|
|
|
state_write->image.h = h;
|
|
|
|
state_write->image.stride = stride;
|
|
|
|
}
|
2013-03-12 05:58:19 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-09-04 01:42:38 -07:00
|
|
|
if (o->load_error == EVAS_LOAD_ERROR_NONE)
|
|
|
|
o->load_error = EVAS_LOAD_ERROR_GENERIC;
|
2012-09-04 21:20:42 -07:00
|
|
|
|
2013-03-12 05:58:19 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
|
2013-01-27 16:28:53 -08:00
|
|
|
{
|
|
|
|
state_write->has_alpha = EINA_TRUE;
|
|
|
|
state_write->cspace = EVAS_COLORSPACE_ARGB8888;
|
2012-09-04 21:20:42 -07:00
|
|
|
|
2013-01-27 16:28:53 -08:00
|
|
|
if ((state_write->image.w != 0) || (state_write->image.h != 0))
|
|
|
|
resize_call = EINA_TRUE;
|
|
|
|
|
|
|
|
state_write->image.w = 0;
|
|
|
|
state_write->image.h = 0;
|
|
|
|
state_write->image.stride = 0;
|
|
|
|
}
|
2013-03-12 05:58:19 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
2013-06-12 22:09:28 -07:00
|
|
|
o->written = EINA_FALSE;
|
2012-09-04 01:56:46 -07:00
|
|
|
o->changed = EINA_TRUE;
|
2012-10-08 18:58:41 -07:00
|
|
|
if (resize_call) evas_object_inform_call_image_resize(eo_obj);
|
|
|
|
evas_object_change(eo_obj, obj);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2015-04-03 07:23:13 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_evas_image_efl_file_mmap_set(Eo *eo_obj,
|
|
|
|
Evas_Image_Data *o,
|
|
|
|
const Eina_File *f, const char *key)
|
2013-05-07 23:37:37 -07:00
|
|
|
{
|
2014-06-02 06:47:59 -07:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2013-05-07 23:37:37 -07:00
|
|
|
Evas_Image_Load_Opts lo;
|
|
|
|
|
2013-07-11 00:03:01 -07:00
|
|
|
if (o->cur->u.f == f)
|
2013-05-07 23:37:37 -07:00
|
|
|
{
|
|
|
|
if ((!o->cur->key) && (!key))
|
2015-04-03 07:23:13 -07:00
|
|
|
return EINA_FALSE;
|
2013-05-07 23:37:37 -07:00
|
|
|
if ((o->cur->key) && (key) && (!strcmp(o->cur->key, key)))
|
2015-04-03 07:23:13 -07:00
|
|
|
return EINA_FALSE;
|
2013-05-07 23:37:37 -07:00
|
|
|
}
|
2015-02-10 03:44:38 -08:00
|
|
|
evas_object_async_block(obj);
|
2016-03-07 21:11:07 -08:00
|
|
|
_evas_image_init_set(f, NULL, key, eo_obj, obj, o, &lo);
|
2014-10-22 02:34:51 -07:00
|
|
|
o->engine_data = ENFN->image_mmap(ENDT, o->cur->u.f, o->cur->key, &o->load_error, &lo);
|
2016-03-07 21:11:07 -08:00
|
|
|
_evas_image_done_set(eo_obj, obj, o);
|
2015-04-03 07:23:13 -07:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
2013-05-07 23:37:37 -07:00
|
|
|
}
|
|
|
|
|
2014-03-29 13:19:01 -07:00
|
|
|
EOLIAN static void
|
2015-04-03 07:23:13 -07:00
|
|
|
_evas_image_efl_file_mmap_get(Eo *eo_obj EINA_UNUSED,
|
|
|
|
Evas_Image_Data *o,
|
|
|
|
const Eina_File **f, const char **key)
|
2014-03-29 13:19:01 -07:00
|
|
|
{
|
|
|
|
if (f)
|
|
|
|
*f = o->cur->mmaped_source ? o->cur->u.f : NULL;
|
|
|
|
if (key)
|
|
|
|
*key = o->cur->key;
|
|
|
|
}
|
|
|
|
|
2014-07-22 06:55:51 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_evas_image_efl_file_file_set(Eo *eo_obj, Evas_Image_Data *o, const char *file, const char *key)
|
2013-05-07 23:37:37 -07:00
|
|
|
{
|
2014-06-02 06:47:59 -07:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2013-05-07 23:37:37 -07:00
|
|
|
Evas_Image_Load_Opts lo;
|
|
|
|
|
2013-07-11 00:03:01 -07:00
|
|
|
if ((o->cur->u.file) && (file) && (!strcmp(o->cur->u.file, file)))
|
2013-05-07 23:37:37 -07:00
|
|
|
{
|
|
|
|
if ((!o->cur->key) && (!key))
|
2014-07-22 06:55:51 -07:00
|
|
|
return EINA_FALSE;
|
2013-05-07 23:37:37 -07:00
|
|
|
if ((o->cur->key) && (key) && (!strcmp(o->cur->key, key)))
|
2014-07-22 06:55:51 -07:00
|
|
|
return EINA_FALSE;
|
2013-05-07 23:37:37 -07:00
|
|
|
}
|
|
|
|
/*
|
|
|
|
* WTF? why cancel a null image preload? this is just silly (tm)
|
|
|
|
if (!o->engine_data)
|
2014-10-22 02:34:51 -07:00
|
|
|
ENFN->image_data_preload_cancel(ENDT, o->engine_data, eo_obj);
|
2013-05-07 23:37:37 -07:00
|
|
|
*/
|
2015-02-10 03:44:38 -08:00
|
|
|
evas_object_async_block(obj);
|
2016-03-07 21:11:07 -08:00
|
|
|
_evas_image_init_set(NULL, file, key, eo_obj, obj, o, &lo);
|
2014-10-22 02:34:51 -07:00
|
|
|
o->engine_data = ENFN->image_load(ENDT, o->cur->u.file, o->cur->key, &o->load_error, &lo);
|
2016-03-07 21:11:07 -08:00
|
|
|
_evas_image_done_set(eo_obj, obj, o);
|
2014-07-22 06:55:51 -07:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
2013-05-07 23:37:37 -07:00
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static void
|
2014-07-22 06:55:51 -07:00
|
|
|
_evas_image_efl_file_file_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o, const char **file, const char **key)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2015-04-10 00:18:54 -07:00
|
|
|
if (file)
|
|
|
|
{
|
|
|
|
if (o->cur->mmaped_source)
|
|
|
|
*file = eina_file_filename_get(o->cur->u.f);
|
|
|
|
else
|
|
|
|
*file = o->cur->u.file;
|
|
|
|
}
|
2013-01-27 16:28:53 -08:00
|
|
|
if (key) *key = o->cur->key;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
evas: add image orient set/get API in software backend for now.
Summary:
Added API's to rotate(0, 90, 180, 270), flip(horizontal, vertical, transpose, transverse)
evas image object. Also added example to demonstrate this.
Signed-off-by: kabeer khan <kabeer.khan@samsung.com>
Reviewers: raster, stephenmhouston, cedric
Subscribers: stephenmhouston, cedric
Differential Revision: https://phab.enlightenment.org/D1950
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-02-11 08:30:49 -08:00
|
|
|
EOLIAN static void
|
2016-03-02 03:46:11 -08:00
|
|
|
_evas_image_efl_image_orientation_set(Eo *eo_obj, Evas_Image_Data *o, Efl_Gfx_Orientation _orient)
|
evas: add image orient set/get API in software backend for now.
Summary:
Added API's to rotate(0, 90, 180, 270), flip(horizontal, vertical, transpose, transverse)
evas image object. Also added example to demonstrate this.
Signed-off-by: kabeer khan <kabeer.khan@samsung.com>
Reviewers: raster, stephenmhouston, cedric
Subscribers: stephenmhouston, cedric
Differential Revision: https://phab.enlightenment.org/D1950
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-02-11 08:30:49 -08:00
|
|
|
{
|
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2016-03-02 03:46:11 -08:00
|
|
|
Evas_Image_Orient orient = (Evas_Image_Orient) _orient;
|
evas: add image orient set/get API in software backend for now.
Summary:
Added API's to rotate(0, 90, 180, 270), flip(horizontal, vertical, transpose, transverse)
evas image object. Also added example to demonstrate this.
Signed-off-by: kabeer khan <kabeer.khan@samsung.com>
Reviewers: raster, stephenmhouston, cedric
Subscribers: stephenmhouston, cedric
Differential Revision: https://phab.enlightenment.org/D1950
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-02-11 08:30:49 -08:00
|
|
|
int iw, ih;
|
|
|
|
|
|
|
|
if (o->cur->orient == orient) return;
|
|
|
|
|
|
|
|
if ((o->preloading) && (o->engine_data))
|
|
|
|
{
|
|
|
|
o->preloading = EINA_FALSE;
|
|
|
|
ENFN->image_data_preload_cancel(ENDT, o->engine_data, eo_obj);
|
|
|
|
}
|
|
|
|
|
2015-09-20 19:05:58 -07:00
|
|
|
if (o->engine_data)
|
evas: add image orient set/get API in software backend for now.
Summary:
Added API's to rotate(0, 90, 180, 270), flip(horizontal, vertical, transpose, transverse)
evas image object. Also added example to demonstrate this.
Signed-off-by: kabeer khan <kabeer.khan@samsung.com>
Reviewers: raster, stephenmhouston, cedric
Subscribers: stephenmhouston, cedric
Differential Revision: https://phab.enlightenment.org/D1950
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-02-11 08:30:49 -08:00
|
|
|
{
|
|
|
|
int stride = 0;
|
|
|
|
|
|
|
|
o->engine_data = ENFN->image_orient_set(ENDT, o->engine_data, orient);
|
|
|
|
if(o->engine_data)
|
|
|
|
{
|
|
|
|
EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
|
|
|
|
state_write->orient = orient;
|
|
|
|
EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
|
|
|
|
|
|
|
|
if (ENFN->image_stride_get)
|
|
|
|
ENFN->image_stride_get(ENDT, o->engine_data, &stride);
|
|
|
|
else
|
|
|
|
stride = o->cur->image.w * 4;
|
|
|
|
if (o->cur->image.stride != stride)
|
|
|
|
{
|
|
|
|
EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
|
|
|
|
state_write->image.stride = stride;
|
|
|
|
EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
|
|
|
|
}
|
|
|
|
o->written = EINA_TRUE;
|
|
|
|
}
|
|
|
|
ENFN->image_size_get(ENDT, o->engine_data, &iw, &ih);
|
|
|
|
EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
|
|
|
|
{
|
|
|
|
state_write->image.w = iw;
|
|
|
|
state_write->image.h = ih;
|
|
|
|
}
|
|
|
|
EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
|
|
|
|
}
|
|
|
|
o->changed = EINA_TRUE;
|
|
|
|
evas_object_change(eo_obj, obj);
|
|
|
|
}
|
|
|
|
|
2016-03-02 03:46:11 -08:00
|
|
|
EOLIAN static Efl_Gfx_Orientation
|
|
|
|
_evas_image_efl_image_orientation_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o)
|
evas: add image orient set/get API in software backend for now.
Summary:
Added API's to rotate(0, 90, 180, 270), flip(horizontal, vertical, transpose, transverse)
evas image object. Also added example to demonstrate this.
Signed-off-by: kabeer khan <kabeer.khan@samsung.com>
Reviewers: raster, stephenmhouston, cedric
Subscribers: stephenmhouston, cedric
Differential Revision: https://phab.enlightenment.org/D1950
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-02-11 08:30:49 -08:00
|
|
|
{
|
2016-03-02 03:46:11 -08:00
|
|
|
return (Efl_Gfx_Orientation) o->cur->orient;
|
evas: add image orient set/get API in software backend for now.
Summary:
Added API's to rotate(0, 90, 180, 270), flip(horizontal, vertical, transpose, transverse)
evas image object. Also added example to demonstrate this.
Signed-off-by: kabeer khan <kabeer.khan@samsung.com>
Reviewers: raster, stephenmhouston, cedric
Subscribers: stephenmhouston, cedric
Differential Revision: https://phab.enlightenment.org/D1950
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-02-11 08:30:49 -08:00
|
|
|
}
|
|
|
|
|
2012-10-23 01:44:11 -07:00
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_evas_image_eo_base_dbg_info_get(Eo *eo_obj, Evas_Image_Data *o, Eo_Dbg_Info *root)
|
2013-01-28 22:36:23 -08:00
|
|
|
{
|
2016-03-01 10:06:28 -08:00
|
|
|
eo_dbg_info_get(eo_super(eo_obj, MY_CLASS), root);
|
2013-01-28 22:36:23 -08:00
|
|
|
Eo_Dbg_Info *group = EO_DBG_INFO_LIST_APPEND(root, MY_CLASS_NAME);
|
|
|
|
|
|
|
|
const char *file, *key;
|
2013-07-23 23:49:39 -07:00
|
|
|
if (o->cur->mmaped_source)
|
|
|
|
file = eina_file_filename_get(o->cur->u.f);
|
|
|
|
else
|
|
|
|
file = o->cur->u.file;
|
|
|
|
key = o->cur->key;
|
|
|
|
|
2013-01-29 08:36:01 -08:00
|
|
|
EO_DBG_INFO_APPEND(group, "Image File", EINA_VALUE_TYPE_STRING, file);
|
|
|
|
EO_DBG_INFO_APPEND(group, "Key", EINA_VALUE_TYPE_STRING, key);
|
|
|
|
EO_DBG_INFO_APPEND(group, "Source", EINA_VALUE_TYPE_UINT64,
|
2013-01-30 19:30:59 -08:00
|
|
|
(uint64_t) (uintptr_t) evas_object_image_source_get(eo_obj));
|
2013-01-28 22:36:23 -08:00
|
|
|
|
|
|
|
if (evas_object_image_load_error_get(eo_obj) != EVAS_LOAD_ERROR_NONE)
|
|
|
|
{
|
2014-04-02 03:16:09 -07:00
|
|
|
Evas_Load_Error error = EVAS_LOAD_ERROR_GENERIC;
|
2016-03-02 03:46:11 -08:00
|
|
|
error = (Evas_Load_Error) efl_image_load_error_get(eo_obj);
|
2013-01-29 08:36:01 -08:00
|
|
|
EO_DBG_INFO_APPEND(group, "Load Error", EINA_VALUE_TYPE_STRING,
|
2013-01-28 22:36:23 -08:00
|
|
|
evas_load_error_str(error));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static void
|
2016-03-02 03:46:11 -08:00
|
|
|
_evas_image_efl_image_border_set(Eo *eo_obj, Evas_Image_Data *o, int l, int r, int t, int b)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
2014-06-02 06:47:59 -07:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2012-10-08 18:58:41 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
if (l < 0) l = 0;
|
|
|
|
if (r < 0) r = 0;
|
|
|
|
if (t < 0) t = 0;
|
|
|
|
if (b < 0) b = 0;
|
2013-01-27 16:28:53 -08:00
|
|
|
if ((o->cur->border.l == l) &&
|
|
|
|
(o->cur->border.r == r) &&
|
|
|
|
(o->cur->border.t == t) &&
|
|
|
|
(o->cur->border.b == b)) return;
|
|
|
|
|
2015-02-10 03:44:38 -08:00
|
|
|
evas_object_async_block(obj);
|
2013-03-12 05:58:19 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
|
2013-01-27 16:28:53 -08:00
|
|
|
{
|
|
|
|
state_write->border.l = l;
|
|
|
|
state_write->border.r = r;
|
|
|
|
state_write->border.t = t;
|
|
|
|
state_write->border.b = b;
|
|
|
|
}
|
2013-03-12 05:58:19 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
|
2012-09-04 01:56:46 -07:00
|
|
|
o->changed = EINA_TRUE;
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_change(eo_obj, obj);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static void
|
2016-03-02 03:46:11 -08:00
|
|
|
_evas_image_efl_image_border_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o, int *l, int *r, int *t, int *b)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
2013-01-27 16:28:53 -08:00
|
|
|
if (l) *l = o->cur->border.l;
|
|
|
|
if (r) *r = o->cur->border.r;
|
|
|
|
if (t) *t = o->cur->border.t;
|
|
|
|
if (b) *b = o->cur->border.b;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static void
|
2016-03-02 03:46:11 -08:00
|
|
|
_evas_image_efl_image_border_center_fill_set(Eo *eo_obj, Evas_Image_Data *o, Efl_Gfx_Border_Fill_Mode _fill)
|
2005-03-31 03:39:55 -08:00
|
|
|
{
|
2015-02-10 03:44:38 -08:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2016-03-02 03:46:11 -08:00
|
|
|
Evas_Border_Fill_Mode fill = (Evas_Border_Fill_Mode) _fill;
|
|
|
|
|
2013-01-27 16:28:53 -08:00
|
|
|
if (fill == o->cur->border.fill) return;
|
2015-02-10 03:44:38 -08:00
|
|
|
evas_object_async_block(obj);
|
2013-03-12 05:58:19 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
|
2013-01-27 16:28:53 -08:00
|
|
|
state_write->border.fill = fill;
|
2013-03-12 05:58:19 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
|
2013-01-27 16:28:53 -08:00
|
|
|
|
2012-09-04 01:56:46 -07:00
|
|
|
o->changed = EINA_TRUE;
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_change(eo_obj, obj);
|
2005-03-31 03:39:55 -08:00
|
|
|
}
|
|
|
|
|
2016-03-02 03:46:11 -08:00
|
|
|
EOLIAN static Efl_Gfx_Border_Fill_Mode
|
|
|
|
_evas_image_efl_image_border_center_fill_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
2016-03-02 03:46:11 -08:00
|
|
|
return (Efl_Gfx_Border_Fill_Mode) o->cur->border.fill;
|
2012-10-08 18:58:41 -07:00
|
|
|
}
|
2008-12-12 14:36:47 -08:00
|
|
|
|
2016-03-01 22:44:12 -08:00
|
|
|
EOLIAN static void
|
|
|
|
_evas_image_efl_gfx_fill_filled_set(Eo *eo_obj, Evas_Image_Data* o, Eina_Bool setting)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
2015-02-10 03:44:38 -08:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2008-12-12 14:36:47 -08:00
|
|
|
setting = !!setting;
|
2016-03-01 22:44:12 -08:00
|
|
|
o->filled_set = 1;
|
2008-12-12 14:36:47 -08:00
|
|
|
if (o->filled == setting) return;
|
|
|
|
|
2015-02-10 03:44:38 -08:00
|
|
|
evas_object_async_block(obj);
|
2008-12-12 14:36:47 -08:00
|
|
|
o->filled = setting;
|
|
|
|
if (!o->filled)
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_event_callback_del(eo_obj, EVAS_CALLBACK_RESIZE,
|
2012-09-04 01:42:38 -07:00
|
|
|
evas_object_image_filled_resize_listener);
|
2008-12-12 14:36:47 -08:00
|
|
|
else
|
|
|
|
{
|
2012-09-04 01:42:38 -07:00
|
|
|
Evas_Coord w, h;
|
2008-12-12 14:36:47 -08:00
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_geometry_get(eo_obj, NULL, NULL, &w, &h);
|
|
|
|
evas_object_image_fill_set(eo_obj, 0, 0, w, h);
|
2008-12-12 14:36:47 -08:00
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_event_callback_add(eo_obj, EVAS_CALLBACK_RESIZE,
|
2012-09-04 01:42:38 -07:00
|
|
|
evas_object_image_filled_resize_listener,
|
|
|
|
NULL);
|
2008-12-12 14:36:47 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2016-03-01 22:44:12 -08:00
|
|
|
_evas_image_efl_gfx_fill_filled_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
2014-03-12 07:28:40 -07:00
|
|
|
return o->filled;
|
2010-02-20 22:21:15 -08:00
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static void
|
2016-03-02 03:46:11 -08:00
|
|
|
_evas_image_efl_image_border_scale_set(Eo *eo_obj, Evas_Image_Data *o, double scale)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
2015-02-10 03:44:38 -08:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2013-01-27 16:28:53 -08:00
|
|
|
|
|
|
|
if (scale == o->cur->border.scale) return;
|
2015-02-10 03:44:38 -08:00
|
|
|
evas_object_async_block(obj);
|
2013-03-12 05:58:19 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
|
2013-01-27 16:28:53 -08:00
|
|
|
state_write->border.scale = scale;
|
2013-03-12 05:58:19 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
|
2013-01-27 16:28:53 -08:00
|
|
|
|
2012-09-04 01:56:46 -07:00
|
|
|
o->changed = EINA_TRUE;
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_change(eo_obj, obj);
|
2010-02-20 22:21:15 -08:00
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static double
|
2016-03-02 03:46:11 -08:00
|
|
|
_evas_image_efl_image_border_scale_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
2014-03-12 07:28:40 -07:00
|
|
|
return o->cur->border.scale;
|
2005-03-31 03:39:55 -08:00
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static void
|
2015-04-03 07:23:24 -07:00
|
|
|
_evas_image_efl_gfx_fill_fill_set(Eo *eo_obj, Evas_Image_Data *o,
|
|
|
|
int x, int y, int w, int h)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
2015-02-10 03:44:38 -08:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2009-09-23 21:55:01 -07:00
|
|
|
if (w == 0) return;
|
|
|
|
if (h == 0) return;
|
2012-07-19 22:41:25 -07:00
|
|
|
if (w < 0) w = -w;
|
|
|
|
if (h < 0) h = -h;
|
|
|
|
|
2013-01-27 16:28:53 -08:00
|
|
|
if ((o->cur->fill.x == x) &&
|
|
|
|
(o->cur->fill.y == y) &&
|
|
|
|
(o->cur->fill.w == w) &&
|
|
|
|
(o->cur->fill.h == h)) return;
|
|
|
|
|
2015-02-10 03:44:38 -08:00
|
|
|
evas_object_async_block(obj);
|
2013-03-12 05:58:19 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
|
2013-01-27 16:28:53 -08:00
|
|
|
{
|
|
|
|
state_write->fill.x = x;
|
|
|
|
state_write->fill.y = y;
|
|
|
|
state_write->fill.w = w;
|
|
|
|
state_write->fill.h = h;
|
2013-03-12 05:58:19 -07:00
|
|
|
state_write->opaque_valid = 0;
|
2013-01-27 16:28:53 -08:00
|
|
|
}
|
2013-03-12 05:58:19 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
|
2013-01-27 16:28:53 -08:00
|
|
|
|
2012-09-04 01:56:46 -07:00
|
|
|
o->changed = EINA_TRUE;
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_change(eo_obj, obj);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static void
|
2015-04-03 07:23:24 -07:00
|
|
|
_evas_image_efl_gfx_fill_fill_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o,
|
|
|
|
int *x, int *y, int *w, int *h)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2013-01-27 16:28:53 -08:00
|
|
|
if (x) *x = o->cur->fill.x;
|
|
|
|
if (y) *y = o->cur->fill.y;
|
|
|
|
if (w) *w = o->cur->fill.w;
|
|
|
|
if (h) *h = o->cur->fill.h;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2016-03-03 22:57:36 -08:00
|
|
|
/* 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)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
2014-06-02 06:47:59 -07:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2016-03-03 22:57:36 -08:00
|
|
|
Evas_Image_Data *o = eo_data_scope_get(eo_obj, MY_CLASS);
|
2012-10-08 18:58:41 -07:00
|
|
|
|
|
|
|
int stride = 0;
|
|
|
|
|
2014-05-12 03:52:02 -07:00
|
|
|
if (o->cur->scene) return;
|
|
|
|
|
2015-02-10 03:44:38 -08:00
|
|
|
evas_object_async_block(obj);
|
2016-03-07 21:11:07 -08:00
|
|
|
_evas_image_cleanup(eo_obj, obj, o);
|
2002-11-08 00:02:15 -08:00
|
|
|
if (w < 1) w = 1;
|
|
|
|
if (h < 1) h = 1;
|
2013-10-13 20:41:28 -07:00
|
|
|
if (w >= 32768) return;
|
|
|
|
if (h >= 32768) return;
|
2013-01-27 16:28:53 -08:00
|
|
|
if ((w == o->cur->image.w) &&
|
|
|
|
(h == o->cur->image.h)) return;
|
|
|
|
|
2013-03-12 05:58:19 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
|
2013-01-27 16:28:53 -08:00
|
|
|
{
|
|
|
|
state_write->image.w = w;
|
|
|
|
state_write->image.h = h;
|
|
|
|
}
|
2013-03-12 05:58:19 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
|
2012-10-09 00:49:07 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
if (o->engine_data)
|
2014-10-22 02:34:51 -07:00
|
|
|
o->engine_data = ENFN->image_size_set(ENDT, o->engine_data, w, h);
|
2002-11-08 00:02:15 -08:00
|
|
|
else
|
2014-10-22 02:34:51 -07:00
|
|
|
o->engine_data = ENFN->image_new_from_copied_data
|
|
|
|
(ENDT, w, h, NULL, o->cur->has_alpha, o->cur->cspace);
|
2011-10-02 20:28:52 -07:00
|
|
|
|
2010-08-18 22:03:37 -07:00
|
|
|
if (o->engine_data)
|
|
|
|
{
|
2014-10-22 02:34:51 -07:00
|
|
|
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);
|
2010-08-18 22:03:37 -07:00
|
|
|
else
|
2010-10-01 05:18:18 -07:00
|
|
|
stride = w * 4;
|
2010-08-18 22:03:37 -07:00
|
|
|
}
|
2007-07-23 07:22:57 -07:00
|
|
|
else
|
2010-10-01 05:18:18 -07:00
|
|
|
stride = w * 4;
|
2013-03-12 05:58:19 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, cur_write)
|
2013-01-27 16:28:53 -08:00
|
|
|
{
|
|
|
|
cur_write->image.stride = stride;
|
2007-07-23 07:22:57 -07:00
|
|
|
|
2006-12-17 07:48:52 -08:00
|
|
|
/* FIXME - in engine call above
|
2002-11-08 00:02:15 -08:00
|
|
|
if (o->engine_data)
|
2014-10-22 02:34:51 -07:00
|
|
|
o->engine_data = ENFN->image_alpha_set(ENDT, o->engine_data, o->cur->has_alpha);
|
2007-10-05 12:37:21 -07:00
|
|
|
*/
|
2013-01-27 16:28:53 -08:00
|
|
|
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);
|
|
|
|
}
|
2013-03-12 05:58:19 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_END(o, cur_write);
|
2013-01-27 16:28:53 -08:00
|
|
|
|
2013-06-12 22:09:28 -07:00
|
|
|
o->written = EINA_TRUE;
|
2012-09-04 01:56:46 -07:00
|
|
|
o->changed = EINA_TRUE;
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_inform_call_image_resize(eo_obj);
|
|
|
|
evas_object_change(eo_obj, obj);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static void
|
2016-03-01 23:18:40 -08:00
|
|
|
_evas_image_efl_gfx_view_view_size_get(Eo *eo_obj, Evas_Image_Data *o, int *w, int *h)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
2015-05-27 19:11:56 -07:00
|
|
|
int uvw, uvh;
|
|
|
|
Evas_Object_Protected_Data *source = NULL;
|
|
|
|
Evas_Object_Protected_Data *obj;
|
|
|
|
|
|
|
|
obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
|
|
|
if (o->cur->source)
|
|
|
|
source = eo_data_scope_get(o->cur->source, EVAS_OBJECT_CLASS);
|
|
|
|
|
|
|
|
if (o->cur->scene)
|
|
|
|
{
|
|
|
|
uvw = obj->data_3d->w;
|
|
|
|
uvh = obj->data_3d->h;
|
|
|
|
}
|
|
|
|
else if (!o->cur->source)
|
|
|
|
{
|
|
|
|
uvw = o->cur->image.w;
|
|
|
|
uvh = o->cur->image.h;
|
|
|
|
}
|
|
|
|
else if (source->proxy->surface && !source->proxy->redraw)
|
|
|
|
{
|
|
|
|
uvw = source->proxy->w;
|
|
|
|
uvh = source->proxy->h;
|
|
|
|
}
|
|
|
|
else if (source->type == o_type &&
|
|
|
|
((Evas_Image_Data *)eo_data_scope_get(o->cur->source, MY_CLASS))->engine_data)
|
|
|
|
{
|
|
|
|
uvw = source->cur->geometry.w;
|
|
|
|
uvh = source->cur->geometry.h;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
uvw = source->proxy->w;
|
|
|
|
uvh = source->proxy->h;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (w) *w = uvw;
|
|
|
|
if (h) *h = uvh;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static int
|
2016-03-03 22:57:36 -08:00
|
|
|
_evas_image_efl_gfx_buffer_stride_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
2016-03-02 03:46:11 -08:00
|
|
|
return o->cur->image.stride;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2016-03-02 03:46:11 -08:00
|
|
|
EOLIAN static Efl_Image_Load_Error
|
|
|
|
_evas_image_efl_image_load_load_error_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o)
|
2008-05-18 20:13:16 -07:00
|
|
|
{
|
2016-03-02 03:46:11 -08:00
|
|
|
return (Efl_Image_Load_Error) o->load_error;
|
2012-10-08 18:58:41 -07:00
|
|
|
}
|
|
|
|
|
2015-07-01 22:26:44 -07:00
|
|
|
/* deprecated */
|
|
|
|
EAPI void*
|
|
|
|
evas_object_image_data_convert(Evas_Object *eo_obj, Evas_Colorspace to_cspace)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
2014-06-02 06:47:59 -07:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2015-07-01 22:26:44 -07:00
|
|
|
Evas_Image_Data *o;
|
2008-05-18 20:13:16 -07:00
|
|
|
DATA32 *data;
|
2012-07-03 00:30:05 -07:00
|
|
|
void* result = NULL;
|
2008-05-18 20:13:16 -07:00
|
|
|
|
2015-07-01 22:26:44 -07:00
|
|
|
if (!eo_isa(eo_obj, MY_CLASS))
|
|
|
|
{
|
|
|
|
CRI("Object is not an %s!", eo_class_name_get(MY_CLASS));
|
2015-07-15 08:06:32 -07:00
|
|
|
return NULL;
|
2015-07-01 22:26:44 -07:00
|
|
|
}
|
2015-07-01 19:52:16 -07:00
|
|
|
|
2015-02-10 03:44:38 -08:00
|
|
|
evas_object_async_block(obj);
|
2015-07-01 22:26:44 -07:00
|
|
|
o = eo_data_scope_get(eo_obj, MY_CLASS);
|
2011-05-02 20:20:02 -07:00
|
|
|
if ((o->preloading) && (o->engine_data))
|
|
|
|
{
|
2012-09-04 01:56:46 -07:00
|
|
|
o->preloading = EINA_FALSE;
|
2014-10-22 02:34:51 -07:00
|
|
|
ENFN->image_data_preload_cancel(ENDT, o->engine_data, eo_obj);
|
2011-05-02 20:20:02 -07:00
|
|
|
}
|
2014-03-12 07:28:40 -07:00
|
|
|
if (!o->engine_data) return NULL;
|
2011-11-05 04:58:41 -07:00
|
|
|
if (o->video_surface)
|
2013-01-25 04:15:38 -08:00
|
|
|
o->pixels->video.update_pixels(o->pixels->video.data, eo_obj, &o->pixels->video);
|
2014-03-12 07:28:40 -07:00
|
|
|
if (o->cur->cspace == to_cspace) return NULL;
|
2008-05-18 20:13:16 -07:00
|
|
|
data = NULL;
|
2015-07-01 19:52:16 -07:00
|
|
|
o->engine_data = ENFN->image_data_get(ENDT, o->engine_data, 0, &data, &o->load_error, NULL);
|
2012-07-03 00:30:05 -07:00
|
|
|
result = evas_object_image_data_convert_internal(o, data, to_cspace);
|
|
|
|
if (o->engine_data)
|
|
|
|
{
|
2014-10-22 02:34:51 -07:00
|
|
|
o->engine_data = ENFN->image_data_put(ENDT, o->engine_data, data);
|
2012-07-03 00:30:05 -07:00
|
|
|
}
|
2008-05-18 20:13:16 -07:00
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
return result;
|
2012-10-08 18:58:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-04-02 05:58:32 -07:00
|
|
|
_image_preload_internal(Eo *eo_obj, void *_pd, Eina_Bool cancel)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
2014-03-12 07:28:40 -07:00
|
|
|
Evas_Image_Data *o = _pd;
|
2012-10-08 18:58:41 -07:00
|
|
|
|
2008-12-19 13:56:31 -08:00
|
|
|
if (!o->engine_data)
|
|
|
|
{
|
2012-09-04 01:56:46 -07:00
|
|
|
o->preloading = EINA_TRUE;
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_inform_call_image_preloaded(eo_obj);
|
2012-09-04 01:42:38 -07:00
|
|
|
return;
|
2008-12-19 13:56:31 -08:00
|
|
|
}
|
2011-05-02 20:20:02 -07:00
|
|
|
// FIXME: if already busy preloading, then dont request again until
|
|
|
|
// preload done
|
2014-06-02 06:47:59 -07:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2008-09-16 07:52:57 -07:00
|
|
|
if (cancel)
|
2011-05-02 20:20:02 -07:00
|
|
|
{
|
|
|
|
if (o->preloading)
|
|
|
|
{
|
2012-09-04 01:56:46 -07:00
|
|
|
o->preloading = EINA_FALSE;
|
2014-10-22 02:34:51 -07:00
|
|
|
ENFN->image_data_preload_cancel(ENDT, o->engine_data, eo_obj);
|
2011-05-02 20:20:02 -07:00
|
|
|
}
|
|
|
|
}
|
2008-09-16 07:52:57 -07:00
|
|
|
else
|
2011-05-02 20:20:02 -07:00
|
|
|
{
|
|
|
|
if (!o->preloading)
|
|
|
|
{
|
2012-09-04 01:56:46 -07:00
|
|
|
o->preloading = EINA_TRUE;
|
2014-10-22 02:34:51 -07:00
|
|
|
ENFN->image_data_preload_request(ENDT, o->engine_data, eo_obj);
|
2011-05-02 20:20:02 -07:00
|
|
|
}
|
|
|
|
}
|
2008-09-16 07:52:57 -07:00
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static void
|
2016-03-02 03:46:11 -08:00
|
|
|
_evas_image_efl_image_load_load_async_start(Eo *eo_obj, Evas_Image_Data *_pd EINA_UNUSED)
|
2013-04-02 05:58:32 -07:00
|
|
|
{
|
2015-02-10 03:44:38 -08:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
|
|
|
evas_object_async_block(obj);
|
2013-04-02 05:58:32 -07:00
|
|
|
_image_preload_internal(eo_obj, _pd, EINA_FALSE);
|
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static void
|
2016-03-02 03:46:11 -08:00
|
|
|
_evas_image_efl_image_load_load_async_cancel(Eo *eo_obj, Evas_Image_Data *_pd EINA_UNUSED)
|
2013-04-02 05:58:32 -07:00
|
|
|
{
|
2015-02-10 03:44:38 -08:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
|
|
|
evas_object_async_block(obj);
|
2013-04-02 05:58:32 -07:00
|
|
|
_image_preload_internal(eo_obj, _pd, EINA_TRUE);
|
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static void
|
2016-03-03 22:57:36 -08:00
|
|
|
_evas_image_efl_gfx_buffer_buffer_update_add(Eo *eo_obj, Evas_Image_Data *o, int x, int y, int w, int h)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
2015-02-10 03:44:38 -08:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2012-10-08 18:58:41 -07:00
|
|
|
Eina_Rectangle *r;
|
2012-12-15 18:01:11 -08:00
|
|
|
int cnt;
|
2012-10-08 18:58:41 -07:00
|
|
|
|
2013-01-27 16:28:53 -08:00
|
|
|
RECTS_CLIP_TO_RECT(x, y, w, h, 0, 0, o->cur->image.w, o->cur->image.h);
|
2002-11-08 00:02:15 -08:00
|
|
|
if ((w <= 0) || (h <= 0)) return;
|
2013-06-12 22:09:28 -07:00
|
|
|
if (!o->written) return;
|
2015-02-10 03:44:38 -08:00
|
|
|
evas_object_async_block(obj);
|
2013-01-25 04:15:38 -08:00
|
|
|
cnt = eina_list_count(o->pixels->pixel_updates);
|
2012-12-15 18:01:11 -08:00
|
|
|
if (cnt == 1)
|
|
|
|
{ // detect single blob case already there to do a nop
|
2013-01-25 04:15:38 -08:00
|
|
|
if ((r = o->pixels->pixel_updates->data))
|
2012-12-15 18:01:11 -08:00
|
|
|
{ // already a single full rect there.
|
2013-06-28 01:25:30 -07:00
|
|
|
if ((r->x == 0) && (r->y == 0) && (r->w == o->cur->image.w) && (r->h == o->cur->image.h))
|
2012-12-15 18:01:11 -08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2015-10-02 00:32:05 -07:00
|
|
|
if ((cnt >= 512) ||
|
|
|
|
(((x == 0) && (y == 0) && (w == o->cur->image.w) && (h == o->cur->image.h))))
|
2012-12-15 18:01:11 -08:00
|
|
|
{ // too many update rects - just make a single blob update
|
2013-01-25 04:15:38 -08:00
|
|
|
EINA_COW_PIXEL_WRITE_BEGIN(o, pixi_write)
|
|
|
|
{
|
|
|
|
EINA_LIST_FREE(pixi_write->pixel_updates, r) eina_rectangle_free(r);
|
2013-01-27 16:28:53 -08:00
|
|
|
NEW_RECT(r, 0, 0, o->cur->image.w, o->cur->image.h);
|
2013-01-25 04:15:38 -08:00
|
|
|
if (r) pixi_write->pixel_updates = eina_list_append(pixi_write->pixel_updates, r);
|
|
|
|
}
|
|
|
|
EINA_COW_PIXEL_WRITE_END(o, pixi_write);
|
2012-12-15 18:01:11 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
NEW_RECT(r, x, y, w, h);
|
2013-01-25 04:15:38 -08:00
|
|
|
EINA_COW_PIXEL_WRITE_BEGIN(o, pixi_write)
|
|
|
|
if (r) pixi_write->pixel_updates = eina_list_append(pixi_write->pixel_updates, r);
|
|
|
|
EINA_COW_PIXEL_WRITE_END(o, pixi_write);
|
2012-12-15 18:01:11 -08:00
|
|
|
}
|
2014-04-14 03:03:47 -07:00
|
|
|
|
2012-09-04 01:56:46 -07:00
|
|
|
o->changed = EINA_TRUE;
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_change(eo_obj, obj);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static void
|
2016-03-02 03:46:11 -08:00
|
|
|
_evas_image_efl_image_alpha_set(Eo *eo_obj, Evas_Image_Data *o, Eina_Bool has_alpha)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
2014-06-02 06:47:59 -07:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2012-10-08 18:58:41 -07:00
|
|
|
|
2015-02-10 03:44:38 -08:00
|
|
|
evas_object_async_block(obj);
|
2011-05-02 20:20:02 -07:00
|
|
|
if ((o->preloading) && (o->engine_data))
|
|
|
|
{
|
2012-09-04 01:56:46 -07:00
|
|
|
o->preloading = EINA_FALSE;
|
2014-10-22 02:34:51 -07:00
|
|
|
ENFN->image_data_preload_cancel(ENDT, o->engine_data, eo_obj);
|
2011-05-02 20:20:02 -07:00
|
|
|
}
|
2015-07-01 23:41:06 -07:00
|
|
|
|
|
|
|
has_alpha = !!has_alpha;
|
|
|
|
if (has_alpha == o->cur->has_alpha)
|
2002-11-08 00:02:15 -08:00
|
|
|
return;
|
2015-07-01 23:41:06 -07:00
|
|
|
|
|
|
|
EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
|
|
|
|
state_write->has_alpha = has_alpha;
|
|
|
|
EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
|
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
if (o->engine_data)
|
2010-05-21 00:10:45 -07:00
|
|
|
{
|
2010-08-19 00:32:44 -07:00
|
|
|
int stride = 0;
|
2011-03-14 03:53:37 -07:00
|
|
|
|
2014-10-22 02:34:51 -07:00
|
|
|
o->engine_data = ENFN->image_alpha_set(ENDT, o->engine_data, o->cur->has_alpha);
|
|
|
|
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);
|
2010-08-19 00:32:44 -07:00
|
|
|
else
|
2014-10-22 02:34:51 -07:00
|
|
|
stride = o->cur->image.w * 4;
|
|
|
|
|
2013-01-27 16:28:53 -08:00
|
|
|
if (o->cur->image.stride != stride)
|
|
|
|
{
|
2013-03-12 05:58:19 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
|
2013-01-27 16:28:53 -08:00
|
|
|
state_write->image.stride = stride;
|
2013-03-12 05:58:19 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
|
2013-01-27 16:28:53 -08:00
|
|
|
}
|
2013-06-12 22:09:28 -07:00
|
|
|
o->written = EINA_TRUE;
|
2010-05-21 00:10:45 -07:00
|
|
|
}
|
2013-01-27 16:28:53 -08:00
|
|
|
evas_object_image_data_update_add(eo_obj, 0, 0, o->cur->image.w, o->cur->image.h);
|
|
|
|
EVAS_OBJECT_WRITE_IMAGE_FREE_FILE_AND_KEY(o);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2016-03-02 03:46:11 -08:00
|
|
|
_evas_image_efl_image_alpha_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2014-03-12 07:28:40 -07:00
|
|
|
return o->cur->has_alpha;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static void
|
2014-07-23 09:03:40 -07:00
|
|
|
_evas_image_efl_image_smooth_scale_set(Eo *eo_obj, Evas_Image_Data *o, Eina_Bool smooth_scale)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
2015-02-10 03:44:38 -08:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2012-10-08 18:58:41 -07:00
|
|
|
|
2015-02-10 03:44:38 -08:00
|
|
|
evas_object_async_block(obj);
|
2013-01-27 16:28:53 -08:00
|
|
|
if (((smooth_scale) && (o->cur->smooth_scale)) ||
|
|
|
|
((!smooth_scale) && (!o->cur->smooth_scale)))
|
2002-11-08 00:02:15 -08:00
|
|
|
return;
|
2013-03-12 05:58:19 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
|
2013-01-27 16:28:53 -08:00
|
|
|
state_write->smooth_scale = smooth_scale;
|
2013-03-12 05:58:19 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
|
2013-01-27 16:28:53 -08:00
|
|
|
|
2012-09-04 01:56:46 -07:00
|
|
|
o->changed = EINA_TRUE;
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_change(eo_obj, obj);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2014-07-23 09:03:40 -07:00
|
|
|
_evas_image_efl_image_smooth_scale_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2014-03-12 07:28:40 -07:00
|
|
|
return o->cur->smooth_scale;
|
2012-10-08 18:58:41 -07:00
|
|
|
}
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2016-03-02 02:39:41 -08:00
|
|
|
EOLIAN static double
|
|
|
|
_evas_image_efl_image_ratio_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o)
|
|
|
|
{
|
|
|
|
if (!o->cur->image.h) return 1.0;
|
|
|
|
return (double) o->cur->image.w / (double) o->cur->image.h;
|
|
|
|
}
|
|
|
|
|
2015-07-01 22:26:44 -07:00
|
|
|
/* deprecated */
|
|
|
|
EAPI void
|
2015-07-05 22:22:45 -07:00
|
|
|
evas_object_image_reload(Eo *eo_obj)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
2014-06-02 06:47:59 -07:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2015-07-01 22:26:44 -07:00
|
|
|
Evas_Image_Data *o;
|
|
|
|
|
|
|
|
if (!eo_isa(eo_obj, MY_CLASS))
|
|
|
|
{
|
|
|
|
CRI("Object is not an %s!", eo_class_name_get(MY_CLASS));
|
|
|
|
return;
|
|
|
|
}
|
2012-10-08 18:58:41 -07:00
|
|
|
|
2015-02-10 03:44:38 -08:00
|
|
|
evas_object_async_block(obj);
|
2015-07-01 22:26:44 -07:00
|
|
|
o = eo_data_scope_get(eo_obj, MY_CLASS);
|
2011-05-02 20:20:02 -07:00
|
|
|
if ((o->preloading) && (o->engine_data))
|
|
|
|
{
|
2012-09-04 01:56:46 -07:00
|
|
|
o->preloading = EINA_FALSE;
|
2014-10-22 02:34:51 -07:00
|
|
|
ENFN->image_data_preload_cancel(ENDT, o->engine_data, eo_obj);
|
2011-05-02 20:20:02 -07:00
|
|
|
}
|
2013-07-11 00:03:01 -07:00
|
|
|
if ((!o->cur->u.file) ||
|
2004-09-22 19:18:15 -07:00
|
|
|
(o->pixels_checked_out > 0)) return;
|
2004-09-22 19:08:26 -07:00
|
|
|
if (o->engine_data)
|
2014-10-22 02:34:51 -07:00
|
|
|
o->engine_data = ENFN->image_dirty_region(ENDT, o->engine_data, 0, 0, o->cur->image.w, o->cur->image.h);
|
2013-06-12 22:09:28 -07:00
|
|
|
o->written = EINA_FALSE;
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_image_unload(eo_obj, 1);
|
|
|
|
evas_object_inform_call_image_unloaded(eo_obj);
|
2013-07-11 00:03:01 -07:00
|
|
|
evas_object_image_load(eo_obj, obj, o);
|
2013-01-27 16:28:53 -08:00
|
|
|
|
|
|
|
EINA_COW_WRITE_BEGIN(evas_object_image_state_cow, o->prev, Evas_Object_Image_State, prev_write)
|
|
|
|
{
|
2013-07-11 00:03:01 -07:00
|
|
|
prev_write->u.file = NULL;
|
2013-01-27 16:28:53 -08:00
|
|
|
prev_write->key = NULL;
|
|
|
|
}
|
|
|
|
EINA_COW_WRITE_END(evas_object_image_state_cow, o->prev, prev_write);
|
|
|
|
|
2012-09-04 01:56:46 -07:00
|
|
|
o->changed = EINA_TRUE;
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_change(eo_obj, obj);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2015-06-25 04:17:58 -07:00
|
|
|
_evas_image_efl_file_save(const Eo *eo_obj, Evas_Image_Data *o, const char *file, const char *key, const char *flags)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
|
|
|
DATA32 *data = NULL;
|
|
|
|
int quality = 80, compress = 9, ok = 0;
|
2014-06-12 23:22:26 -07:00
|
|
|
char *encoding = NULL;
|
2015-07-01 19:52:16 -07:00
|
|
|
Image_Entry *ie;
|
2015-10-30 00:41:32 -07:00
|
|
|
Eina_Bool putback = EINA_FALSE, tofree = EINA_FALSE, no_convert = EINA_FALSE;
|
|
|
|
Evas_Colorspace cspace = EVAS_COLORSPACE_ARGB8888;
|
|
|
|
int want_cspace = EVAS_COLORSPACE_ARGB8888;
|
2015-06-29 23:37:55 -07:00
|
|
|
int imagew, imageh;
|
|
|
|
void *pixels;
|
|
|
|
|
2014-06-02 06:47:59 -07:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2015-06-29 23:37:55 -07:00
|
|
|
Evas_Object_Protected_Data *source = (o->cur->source ? eo_data_scope_get(o->cur->source, EVAS_OBJECT_CLASS) : NULL);
|
|
|
|
|
2015-02-10 03:44:38 -08:00
|
|
|
evas_object_async_block(obj);
|
2015-06-29 23:37:55 -07:00
|
|
|
|
|
|
|
if (o->cur->scene)
|
|
|
|
{
|
2016-03-07 21:11:07 -08:00
|
|
|
_evas_image_3d_render(obj->layer->evas->evas, (Eo *) eo_obj, obj, o, o->cur->scene);
|
2015-06-29 23:37:55 -07:00
|
|
|
pixels = obj->data_3d->surface;
|
|
|
|
imagew = obj->data_3d->w;
|
|
|
|
imageh = obj->data_3d->h;
|
|
|
|
}
|
|
|
|
else if (!o->cur->source)
|
|
|
|
{
|
|
|
|
// pixels = evas_process_dirty_pixels(eo_obj, obj, o, output, surface, o->engine_data);
|
|
|
|
pixels = o->engine_data;
|
|
|
|
imagew = o->cur->image.w;
|
|
|
|
imageh = o->cur->image.h;
|
|
|
|
putback = EINA_TRUE;
|
|
|
|
}
|
|
|
|
else if (source->proxy->surface && !source->proxy->redraw)
|
|
|
|
{
|
|
|
|
pixels = source->proxy->surface;
|
|
|
|
imagew = source->proxy->w;
|
|
|
|
imageh = source->proxy->h;
|
|
|
|
}
|
|
|
|
else if (source->type == o_type &&
|
|
|
|
((Evas_Image_Data *)eo_data_scope_get(o->cur->source, MY_CLASS))->engine_data)
|
|
|
|
{
|
|
|
|
Evas_Image_Data *oi;
|
|
|
|
oi = eo_data_scope_get(o->cur->source, MY_CLASS);
|
|
|
|
pixels = oi->engine_data;
|
|
|
|
imagew = oi->cur->image.w;
|
|
|
|
imageh = oi->cur->image.h;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
o->proxyrendering = EINA_TRUE;
|
|
|
|
evas_render_proxy_subrender(obj->layer->evas->evas, o->cur->source,
|
|
|
|
(Eo *) eo_obj, obj, EINA_FALSE);
|
|
|
|
pixels = source->proxy->surface;
|
|
|
|
imagew = source->proxy->w;
|
|
|
|
imageh = source->proxy->h;
|
|
|
|
o->proxyrendering = EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2005-11-10 22:09:46 -08:00
|
|
|
if (flags)
|
|
|
|
{
|
2015-10-30 00:41:32 -07:00
|
|
|
const char *ext = NULL;
|
2012-09-04 01:42:38 -07:00
|
|
|
char *p, *pp;
|
|
|
|
char *tflags;
|
2012-08-26 00:04:46 -07:00
|
|
|
|
2012-09-04 01:42:38 -07:00
|
|
|
tflags = alloca(strlen(flags) + 1);
|
|
|
|
strcpy(tflags, flags);
|
|
|
|
p = tflags;
|
|
|
|
while (p)
|
|
|
|
{
|
|
|
|
pp = strchr(p, ' ');
|
|
|
|
if (pp) *pp = 0;
|
|
|
|
sscanf(p, "quality=%i", &quality);
|
|
|
|
sscanf(p, "compress=%i", &compress);
|
2014-06-12 23:22:26 -07:00
|
|
|
sscanf(p, "encoding=%ms", &encoding);
|
2012-09-04 01:42:38 -07:00
|
|
|
if (pp) p = pp + 1;
|
|
|
|
else break;
|
|
|
|
}
|
2015-10-30 00:41:32 -07:00
|
|
|
|
|
|
|
if (file) ext = strrchr(file, '.');
|
|
|
|
if (encoding && ext && !strcasecmp(ext, ".tgv"))
|
|
|
|
{
|
|
|
|
if (!strcmp(encoding, "auto"))
|
|
|
|
want_cspace = -1;
|
|
|
|
else if (!strcmp(encoding, "etc1"))
|
|
|
|
want_cspace = EVAS_COLORSPACE_ETC1;
|
|
|
|
else if (!strcmp(encoding, "etc2"))
|
|
|
|
{
|
|
|
|
if (!ENFN->image_alpha_get(ENDT, pixels))
|
|
|
|
want_cspace = EVAS_COLORSPACE_RGB8_ETC2;
|
|
|
|
else
|
|
|
|
want_cspace = EVAS_COLORSPACE_RGBA8_ETC2_EAC;
|
|
|
|
}
|
|
|
|
else if (!strcmp(encoding, "etc1+alpha"))
|
|
|
|
want_cspace = EVAS_COLORSPACE_ETC1_ALPHA;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
free(encoding);
|
|
|
|
encoding = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!ENFN->image_data_has)
|
|
|
|
pixels = ENFN->image_data_get(ENDT, pixels, 0, &data, &o->load_error, &tofree);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (ENFN->image_data_has(ENDT, pixels, &cspace))
|
|
|
|
{
|
|
|
|
if ((want_cspace != (int) cspace) && (want_cspace != -1))
|
|
|
|
cspace = EVAS_COLORSPACE_ARGB8888;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cspace = ENFN->image_file_colorspace_get(ENDT, pixels);
|
|
|
|
if ((want_cspace != (int) cspace) && (want_cspace != -1))
|
|
|
|
cspace = EVAS_COLORSPACE_ARGB8888;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ENFN->image_colorspace_set(ENDT, pixels, cspace);
|
|
|
|
no_convert = EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pixels = ENFN->image_data_get(ENDT, pixels, 0, &data, &o->load_error, &tofree);
|
2005-11-10 22:09:46 -08:00
|
|
|
}
|
2015-10-30 00:41:32 -07:00
|
|
|
|
|
|
|
if (!pixels)
|
|
|
|
{
|
|
|
|
WRN("Could not get image pixels.");
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (cspace)
|
|
|
|
{
|
|
|
|
case EVAS_COLORSPACE_ARGB8888:
|
|
|
|
break;
|
|
|
|
case EVAS_COLORSPACE_ETC1:
|
|
|
|
case EVAS_COLORSPACE_ETC1_ALPHA:
|
|
|
|
case EVAS_COLORSPACE_RGB8_ETC2:
|
|
|
|
case EVAS_COLORSPACE_RGBA8_ETC2_EAC:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
DBG("Need to convert colorspace before saving");
|
|
|
|
cspace = EVAS_COLORSPACE_ARGB8888;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2015-07-01 19:52:16 -07:00
|
|
|
ie = evas_cache_image_data(evas_common_image_cache_get(),
|
2015-10-30 00:41:32 -07:00
|
|
|
imagew, imageh, data, o->cur->has_alpha, cspace);
|
2015-07-01 19:52:16 -07:00
|
|
|
if (ie)
|
2005-11-10 22:09:46 -08:00
|
|
|
{
|
2015-07-01 19:52:16 -07:00
|
|
|
RGBA_Image *im = (RGBA_Image *) ie;
|
2015-10-30 00:41:32 -07:00
|
|
|
DATA32 *old_data = NULL;
|
|
|
|
|
|
|
|
// FIXME: Something is fishy here... what about the previous pointer?
|
|
|
|
if ((o->cur->cspace == cspace) || no_convert)
|
2012-09-04 01:42:38 -07:00
|
|
|
im->image.data = data;
|
|
|
|
else
|
2015-10-30 00:41:32 -07:00
|
|
|
{
|
|
|
|
old_data = im->image.data;
|
|
|
|
im->image.data = evas_object_image_data_convert_internal(o, data, EVAS_COLORSPACE_ARGB8888);
|
|
|
|
}
|
2012-09-04 01:42:38 -07:00
|
|
|
if (im->image.data)
|
|
|
|
{
|
2014-06-12 23:22:26 -07:00
|
|
|
ok = evas_common_save_image_to_file(im, file, key, quality, compress, encoding);
|
2008-05-18 20:13:16 -07:00
|
|
|
|
2015-10-30 00:41:32 -07:00
|
|
|
if (old_data)
|
|
|
|
{
|
|
|
|
free(im->image.data);
|
|
|
|
im->image.data = old_data;
|
|
|
|
}
|
2012-09-04 01:42:38 -07:00
|
|
|
}
|
2015-07-01 19:52:16 -07:00
|
|
|
evas_cache_image_drop(ie);
|
2005-11-10 22:09:46 -08:00
|
|
|
}
|
2015-07-01 19:52:16 -07:00
|
|
|
|
|
|
|
if (tofree)
|
|
|
|
ENFN->image_free(ENDT, pixels);
|
|
|
|
else if (putback)
|
2015-06-29 23:37:55 -07:00
|
|
|
o->engine_data = ENFN->image_data_put(ENDT, pixels, data);
|
2014-06-16 23:29:51 -07:00
|
|
|
|
|
|
|
free(encoding);
|
2014-03-12 07:28:40 -07:00
|
|
|
return ok;
|
2005-11-10 22:09:46 -08:00
|
|
|
}
|
|
|
|
|
2015-07-01 22:26:44 -07:00
|
|
|
/* deprecated */
|
|
|
|
EAPI Eina_Bool
|
|
|
|
evas_object_image_pixels_import(Evas_Object *eo_obj, Evas_Pixel_Import_Source *pixels)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
2014-06-02 06:47:59 -07:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2015-07-01 22:26:44 -07:00
|
|
|
Evas_Image_Data *o;
|
2012-10-08 18:58:41 -07:00
|
|
|
|
2015-07-01 22:26:44 -07:00
|
|
|
if (!eo_isa(eo_obj, MY_CLASS))
|
|
|
|
{
|
|
|
|
CRI("Object is not an %s!", eo_class_name_get(MY_CLASS));
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2015-07-01 19:52:16 -07:00
|
|
|
|
2015-02-10 03:44:38 -08:00
|
|
|
evas_object_async_block(obj);
|
2015-07-01 22:26:44 -07:00
|
|
|
o = eo_data_scope_get(eo_obj, MY_CLASS);
|
2016-03-07 21:11:07 -08:00
|
|
|
_evas_image_cleanup(eo_obj, obj, o);
|
2014-11-03 03:27:56 -08:00
|
|
|
if ((pixels->w != o->cur->image.w) || (pixels->h != o->cur->image.h)) return EINA_FALSE;
|
2012-10-09 00:49:07 -07:00
|
|
|
|
2003-12-09 17:12:13 -08:00
|
|
|
switch (pixels->format)
|
|
|
|
{
|
2005-05-21 19:49:50 -07:00
|
|
|
#if 0
|
2003-12-09 17:12:13 -08:00
|
|
|
case EVAS_PIXEL_FORMAT_ARGB32:
|
2012-08-26 00:04:46 -07:00
|
|
|
{
|
|
|
|
if (o->engine_data)
|
|
|
|
{
|
|
|
|
DATA32 *image_pixels = NULL;
|
|
|
|
|
|
|
|
o->engine_data =
|
2014-10-22 02:34:51 -07:00
|
|
|
ENFN->image_data_get(ENDT,
|
|
|
|
o->engine_data,
|
|
|
|
1,
|
|
|
|
&image_pixels,
|
|
|
|
&o->load_error);
|
2005-05-21 19:49:50 -07:00
|
|
|
/* FIXME: need to actualyl support this */
|
2013-01-27 16:28:53 -08:00
|
|
|
/* memcpy(image_pixels, pixels->rows, o->cur->image.w * o->cur->image.h * 4);*/
|
2012-08-26 00:04:46 -07:00
|
|
|
if (o->engine_data)
|
|
|
|
o->engine_data =
|
2014-10-22 02:34:51 -07:00
|
|
|
ENFN->image_data_put(ENDT, o->engine_data, image_pixels);
|
|
|
|
if (o->engine_data)
|
2012-08-26 00:04:46 -07:00
|
|
|
o->engine_data =
|
2014-10-22 02:34:51 -07:00
|
|
|
ENFN->image_alpha_set(ENDT, o->engine_data, o->cur->has_alpha);
|
2012-09-04 01:56:46 -07:00
|
|
|
o->changed = EINA_TRUE;
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_change(eo_obj, obj);
|
2012-08-26 00:04:46 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2005-05-21 19:49:50 -07:00
|
|
|
#endif
|
2003-12-09 17:12:13 -08:00
|
|
|
case EVAS_PIXEL_FORMAT_YUV420P_601:
|
2012-09-04 01:42:38 -07:00
|
|
|
{
|
|
|
|
if (o->engine_data)
|
|
|
|
{
|
|
|
|
DATA32 *image_pixels = NULL;
|
|
|
|
|
2015-07-01 19:52:16 -07:00
|
|
|
o->engine_data = ENFN->image_data_get(ENDT, o->engine_data, 1, &image_pixels,&o->load_error, NULL);
|
2012-09-04 01:42:38 -07:00
|
|
|
if (image_pixels)
|
2015-05-27 04:17:20 -07:00
|
|
|
evas_common_convert_yuv_422p_601_rgba((DATA8 **) pixels->rows, (DATA8 *) image_pixels, o->cur->image.w, o->cur->image.h);
|
2012-09-04 01:42:38 -07:00
|
|
|
if (o->engine_data)
|
2014-10-22 02:34:51 -07:00
|
|
|
o->engine_data = ENFN->image_data_put(ENDT, o->engine_data, image_pixels);
|
2012-09-04 01:42:38 -07:00
|
|
|
if (o->engine_data)
|
2014-10-22 02:34:51 -07:00
|
|
|
o->engine_data = ENFN->image_alpha_set(ENDT, o->engine_data, o->cur->has_alpha);
|
2012-09-04 01:56:46 -07:00
|
|
|
o->changed = EINA_TRUE;
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_change(eo_obj, obj);
|
2012-09-04 01:42:38 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2003-12-09 17:12:13 -08:00
|
|
|
default:
|
2014-11-03 03:27:56 -08:00
|
|
|
return EINA_FALSE;
|
2012-09-04 01:42:38 -07:00
|
|
|
break;
|
2003-12-09 17:12:13 -08:00
|
|
|
}
|
2014-11-03 03:27:56 -08:00
|
|
|
return EINA_TRUE;
|
2012-10-08 18:58:41 -07:00
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
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)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
2015-02-10 03:44:38 -08:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
|
|
|
evas_object_async_block(obj);
|
2013-01-25 04:15:38 -08:00
|
|
|
EINA_COW_PIXEL_WRITE_BEGIN(o, pixi_write)
|
2014-03-12 07:28:40 -07:00
|
|
|
{
|
|
|
|
pixi_write->func.get_pixels = func;
|
|
|
|
pixi_write->func.get_pixels_data = data;
|
|
|
|
}
|
|
|
|
EINA_COW_PIXEL_WRITE_END(o, pixi_write);
|
2012-10-08 18:58:41 -07:00
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_evas_image_pixels_dirty_set(Eo *eo_obj, Evas_Image_Data *o, Eina_Bool dirty)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
2014-06-02 06:47:59 -07:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2015-02-10 03:44:38 -08:00
|
|
|
evas_object_async_block(obj);
|
2012-09-04 01:56:46 -07:00
|
|
|
if (dirty) o->dirty_pixels = EINA_TRUE;
|
|
|
|
else o->dirty_pixels = EINA_FALSE;
|
|
|
|
o->changed = EINA_TRUE;
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_change(eo_obj, obj);
|
2003-12-09 17:12:13 -08:00
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_evas_image_pixels_dirty_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
2014-03-12 07:28:40 -07:00
|
|
|
return (o->dirty_pixels ? 1 : 0);
|
2012-10-08 18:58:41 -07:00
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static void
|
2016-03-02 03:46:11 -08:00
|
|
|
_evas_image_efl_image_load_load_dpi_set(Eo *eo_obj, Evas_Image_Data *o, double dpi)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
2015-02-10 03:44:38 -08:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2013-01-23 17:50:57 -08:00
|
|
|
if (dpi == o->load_opts->dpi) return;
|
2015-02-10 03:44:38 -08:00
|
|
|
evas_object_async_block(obj);
|
2013-01-25 04:15:38 -08:00
|
|
|
EINA_COW_LOAD_OPTS_WRITE_BEGIN(o, low)
|
2013-01-23 17:50:57 -08:00
|
|
|
low->dpi = dpi;
|
2013-01-25 04:15:38 -08:00
|
|
|
EINA_COW_LOAD_OPTS_WRITE_END(o, low);
|
2013-01-23 17:50:57 -08:00
|
|
|
|
2013-07-11 00:03:01 -07:00
|
|
|
if (o->cur->u.file)
|
2006-08-18 07:45:26 -07:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_image_unload(eo_obj, 0);
|
|
|
|
evas_object_inform_call_image_unloaded(eo_obj);
|
2013-07-11 00:03:01 -07:00
|
|
|
evas_object_image_load(eo_obj, obj, o);
|
2012-09-04 01:56:46 -07:00
|
|
|
o->changed = EINA_TRUE;
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_change(eo_obj, obj);
|
2006-08-18 07:45:26 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static double
|
2016-03-02 03:46:11 -08:00
|
|
|
_evas_image_efl_image_load_load_dpi_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
2014-03-12 07:28:40 -07:00
|
|
|
return o->load_opts->dpi;
|
2012-10-08 18:58:41 -07:00
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static void
|
2016-03-02 03:46:11 -08:00
|
|
|
_evas_image_efl_image_load_load_size_set(Eo *eo_obj, Evas_Image_Data *o, int w, int h)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
2015-02-10 03:44:38 -08:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2013-01-23 17:50:57 -08:00
|
|
|
if ((o->load_opts->w == w) && (o->load_opts->h == h)) return;
|
2015-02-10 03:44:38 -08:00
|
|
|
evas_object_async_block(obj);
|
2013-01-25 04:15:38 -08:00
|
|
|
EINA_COW_LOAD_OPTS_WRITE_BEGIN(o, low)
|
2013-01-23 17:50:57 -08:00
|
|
|
{
|
|
|
|
low->w = w;
|
|
|
|
low->h = h;
|
|
|
|
}
|
2013-01-25 04:15:38 -08:00
|
|
|
EINA_COW_LOAD_OPTS_WRITE_END(o, low);
|
2013-01-23 17:50:57 -08:00
|
|
|
|
2013-07-11 00:03:01 -07:00
|
|
|
if (o->cur->u.file)
|
2006-08-18 07:45:26 -07:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_image_unload(eo_obj, 0);
|
|
|
|
evas_object_inform_call_image_unloaded(eo_obj);
|
2013-07-11 00:03:01 -07:00
|
|
|
evas_object_image_load(eo_obj, obj, o);
|
2012-09-04 01:56:46 -07:00
|
|
|
o->changed = EINA_TRUE;
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_change(eo_obj, obj);
|
2006-08-18 07:45:26 -07:00
|
|
|
}
|
2013-04-22 08:41:24 -07:00
|
|
|
o->proxyerror = 0;
|
2006-08-18 07:45:26 -07:00
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static void
|
2016-03-02 03:46:11 -08:00
|
|
|
_evas_image_efl_image_load_load_size_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o, int *w, int *h)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
2013-01-23 17:50:57 -08:00
|
|
|
if (w) *w = o->load_opts->w;
|
|
|
|
if (h) *h = o->load_opts->h;
|
2006-08-18 07:45:26 -07:00
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static void
|
2016-03-02 03:46:11 -08:00
|
|
|
_evas_image_efl_image_load_load_scale_down_set(Eo *eo_obj, Evas_Image_Data *o, int scale_down)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
2015-02-10 03:44:38 -08:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2013-01-23 17:50:57 -08:00
|
|
|
if (o->load_opts->scale_down_by == scale_down) return;
|
2015-02-10 03:44:38 -08:00
|
|
|
evas_object_async_block(obj);
|
2013-01-25 04:15:38 -08:00
|
|
|
EINA_COW_LOAD_OPTS_WRITE_BEGIN(o, low)
|
2013-01-23 17:50:57 -08:00
|
|
|
low->scale_down_by = scale_down;
|
2013-01-25 04:15:38 -08:00
|
|
|
EINA_COW_LOAD_OPTS_WRITE_END(o, low);
|
2013-01-23 17:50:57 -08:00
|
|
|
|
2013-07-11 00:03:01 -07:00
|
|
|
if (o->cur->u.file)
|
2006-08-18 07:45:26 -07:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_image_unload(eo_obj, 0);
|
|
|
|
evas_object_inform_call_image_unloaded(eo_obj);
|
2013-07-11 00:03:01 -07:00
|
|
|
evas_object_image_load(eo_obj, obj, o);
|
2012-09-04 01:56:46 -07:00
|
|
|
o->changed = EINA_TRUE;
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_change(eo_obj, obj);
|
2006-08-18 07:45:26 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static int
|
2016-03-02 03:46:11 -08:00
|
|
|
_evas_image_efl_image_load_load_scale_down_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
2014-03-12 07:28:40 -07:00
|
|
|
return o->load_opts->scale_down_by;
|
2012-10-08 18:58:41 -07:00
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static void
|
2016-03-02 03:46:11 -08:00
|
|
|
_evas_image_efl_image_load_load_region_set(Eo *eo_obj, Evas_Image_Data *o, int x, int y, int w, int h)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
2015-02-10 03:44:38 -08:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2013-01-23 17:50:57 -08:00
|
|
|
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;
|
2015-02-10 03:44:38 -08:00
|
|
|
evas_object_async_block(obj);
|
2013-01-25 04:15:38 -08:00
|
|
|
EINA_COW_LOAD_OPTS_WRITE_BEGIN(o, low)
|
2013-01-23 17:50:57 -08:00
|
|
|
{
|
|
|
|
low->region.x = x;
|
|
|
|
low->region.y = y;
|
|
|
|
low->region.w = w;
|
|
|
|
low->region.h = h;
|
|
|
|
}
|
2013-01-25 04:15:38 -08:00
|
|
|
EINA_COW_LOAD_OPTS_WRITE_END(o, low);
|
2013-01-23 17:50:57 -08:00
|
|
|
|
2013-07-11 00:03:01 -07:00
|
|
|
if (o->cur->u.file)
|
2009-09-15 06:34:12 -07:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_image_unload(eo_obj, 0);
|
|
|
|
evas_object_inform_call_image_unloaded(eo_obj);
|
2013-07-11 00:03:01 -07:00
|
|
|
evas_object_image_load(eo_obj, obj, o);
|
2012-09-04 01:56:46 -07:00
|
|
|
o->changed = EINA_TRUE;
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_change(eo_obj, obj);
|
2009-09-15 06:34:12 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static void
|
2016-03-02 03:46:11 -08:00
|
|
|
_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)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
2013-01-23 17:50:57 -08:00
|
|
|
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;
|
2009-09-15 06:34:12 -07:00
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static void
|
2016-03-02 03:46:11 -08:00
|
|
|
_evas_image_efl_image_load_load_orientation_set(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o, Eina_Bool enable)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
2015-02-10 03:44:38 -08:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2013-06-20 04:28:18 -07:00
|
|
|
if (o->load_opts->orientation == !!enable) return;
|
2015-02-10 03:44:38 -08:00
|
|
|
evas_object_async_block(obj);
|
2013-01-23 17:50:57 -08:00
|
|
|
|
2013-01-25 04:15:38 -08:00
|
|
|
EINA_COW_LOAD_OPTS_WRITE_BEGIN(o, low)
|
2013-01-23 17:50:57 -08:00
|
|
|
low->orientation = !!enable;
|
2013-01-25 04:15:38 -08:00
|
|
|
EINA_COW_LOAD_OPTS_WRITE_END(o, low);
|
2011-06-07 06:39:13 -07:00
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2016-03-02 03:46:11 -08:00
|
|
|
_evas_image_efl_image_load_load_orientation_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
2014-03-12 07:28:40 -07:00
|
|
|
return o->load_opts->orientation;;
|
2012-10-08 18:58:41 -07:00
|
|
|
}
|
2010-05-21 00:10:45 -07:00
|
|
|
|
2016-03-02 03:46:11 -08:00
|
|
|
/* 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)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
2014-06-02 06:47:59 -07:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2016-03-02 03:46:11 -08:00
|
|
|
Evas_Image_Data *o = eo_data_scope_get(eo_obj, MY_CLASS);
|
2015-02-10 03:44:38 -08:00
|
|
|
evas_object_async_block(obj);
|
2012-10-08 18:58:41 -07:00
|
|
|
|
2016-03-07 21:11:07 -08:00
|
|
|
_evas_image_cleanup(eo_obj, obj, o);
|
2010-05-21 00:10:45 -07:00
|
|
|
|
2013-03-12 05:58:19 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
|
2013-01-27 16:28:53 -08:00
|
|
|
state_write->cspace = cspace;
|
2013-03-12 05:58:19 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
|
2013-01-27 16:28:53 -08:00
|
|
|
|
2006-12-17 07:48:52 -08:00
|
|
|
if (o->engine_data)
|
2014-10-22 02:34:51 -07:00
|
|
|
ENFN->image_colorspace_set(ENDT, o->engine_data, cspace);
|
2006-12-09 00:52:08 -08:00
|
|
|
}
|
|
|
|
|
2016-03-02 03:46:11 -08:00
|
|
|
EOLIAN static Efl_Gfx_Colorspace
|
|
|
|
_evas_image_efl_gfx_buffer_colorspace_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
2016-03-02 03:46:11 -08:00
|
|
|
return (Efl_Gfx_Colorspace) o->cur->cspace;
|
2012-10-08 18:58:41 -07:00
|
|
|
}
|
|
|
|
|
2016-03-07 22:53:02 -08:00
|
|
|
EAPI void
|
|
|
|
evas_object_image_video_surface_set(Evas_Object *eo_obj, Evas_Video_Surface *surf)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
2016-03-07 22:53:02 -08:00
|
|
|
EVAS_OBJECT_LEGACY_API(eo_obj);
|
|
|
|
|
2014-06-02 06:47:59 -07:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2016-03-07 22:53:02 -08:00
|
|
|
Evas_Image_Data *o = eo_data_scope_get(eo_obj, EVAS_IMAGE_CLASS);
|
2015-02-10 03:44:38 -08:00
|
|
|
evas_object_async_block(obj);
|
2012-10-08 18:58:41 -07:00
|
|
|
|
2016-03-07 21:11:07 -08:00
|
|
|
_evas_image_cleanup(eo_obj, obj, o);
|
2011-10-02 20:28:52 -07:00
|
|
|
if (o->video_surface)
|
2011-05-02 20:20:02 -07:00
|
|
|
{
|
2012-09-04 01:56:46 -07:00
|
|
|
o->video_surface = EINA_FALSE;
|
2012-10-08 18:58:41 -07:00
|
|
|
obj->layer->evas->video_objects = eina_list_remove(obj->layer->evas->video_objects, eo_obj);
|
2011-05-02 20:20:02 -07:00
|
|
|
}
|
2011-10-02 20:28:52 -07:00
|
|
|
|
|
|
|
if (surf)
|
|
|
|
{
|
2013-06-20 04:28:18 -07:00
|
|
|
if (surf->version != EVAS_VIDEO_SURFACE_VERSION) return;
|
2011-10-02 20:28:52 -07:00
|
|
|
|
2012-09-04 01:42:38 -07:00
|
|
|
if (!surf->update_pixels ||
|
|
|
|
!surf->move ||
|
|
|
|
!surf->resize ||
|
|
|
|
!surf->hide ||
|
|
|
|
!surf->show)
|
2013-06-20 04:28:18 -07:00
|
|
|
return;
|
2011-10-02 20:28:52 -07:00
|
|
|
|
|
|
|
o->created = EINA_TRUE;
|
2012-09-04 01:56:46 -07:00
|
|
|
o->video_surface = EINA_TRUE;
|
2013-01-25 04:15:38 -08:00
|
|
|
|
|
|
|
EINA_COW_PIXEL_WRITE_BEGIN(o, pixi_write)
|
|
|
|
pixi_write->video = *surf;
|
|
|
|
EINA_COW_PIXEL_WRITE_END(o, pixi_write)
|
2011-10-02 20:28:52 -07:00
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
obj->layer->evas->video_objects = eina_list_append(obj->layer->evas->video_objects, eo_obj);
|
2011-10-02 20:28:52 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-01-26 22:31:11 -08:00
|
|
|
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)
|
2013-06-20 04:28:18 -07:00
|
|
|
return;
|
2013-01-26 22:31:11 -08:00
|
|
|
|
2012-09-04 01:56:46 -07:00
|
|
|
o->video_surface = EINA_FALSE;
|
2013-01-25 04:15:38 -08:00
|
|
|
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)
|
2011-10-02 20:28:52 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-03-07 22:53:02 -08:00
|
|
|
EAPI const Evas_Video_Surface*
|
|
|
|
evas_object_image_video_surface_get(const Evas_Object *eo_obj)
|
evas/image: Add video surface caps.
Wayland subsurfaces can be used as video surfaces too, similarly to
Ecore_X windows. However, they support a different set of features. Some
of them, like subsurface clipping and scaling, might be added in the
future, but so far we must work with what we have.
This commit allows to set an enum bitfield to the Video_Surface, with
the default value being one that will keep the same behavior as before,
for Ecore_X window. Thus, backward compatibility should not be broken.
It's possible to inform Evas that the surface in question is not able to
resize or scale, or that it's above or below the original canvas
surface. This allows Evas to show the surface itself, or use a buffer of
pixels instead, when the capabilities are not available.
2013-09-26 09:49:18 -07:00
|
|
|
{
|
2016-03-07 22:53:02 -08:00
|
|
|
EVAS_OBJECT_LEGACY_API(eo_obj, NULL);
|
|
|
|
|
|
|
|
Evas_Image_Data *o = eo_data_scope_get(eo_obj, EVAS_IMAGE_CLASS);
|
2014-03-12 07:28:40 -07:00
|
|
|
return (!o->video_surface ? NULL : &o->pixels->video);
|
evas/image: Add video surface caps.
Wayland subsurfaces can be used as video surfaces too, similarly to
Ecore_X windows. However, they support a different set of features. Some
of them, like subsurface clipping and scaling, might be added in the
future, but so far we must work with what we have.
This commit allows to set an enum bitfield to the Video_Surface, with
the default value being one that will keep the same behavior as before,
for Ecore_X window. Thus, backward compatibility should not be broken.
It's possible to inform Evas that the surface in question is not able to
resize or scale, or that it's above or below the original canvas
surface. This allows Evas to show the surface itself, or use a buffer of
pixels instead, when the capabilities are not available.
2013-09-26 09:49:18 -07:00
|
|
|
}
|
|
|
|
|
2016-03-07 22:53:02 -08:00
|
|
|
EAPI void
|
|
|
|
evas_object_image_video_surface_caps_set(Evas_Object *eo_obj, unsigned int caps)
|
evas/image: Add video surface caps.
Wayland subsurfaces can be used as video surfaces too, similarly to
Ecore_X windows. However, they support a different set of features. Some
of them, like subsurface clipping and scaling, might be added in the
future, but so far we must work with what we have.
This commit allows to set an enum bitfield to the Video_Surface, with
the default value being one that will keep the same behavior as before,
for Ecore_X window. Thus, backward compatibility should not be broken.
It's possible to inform Evas that the surface in question is not able to
resize or scale, or that it's above or below the original canvas
surface. This allows Evas to show the surface itself, or use a buffer of
pixels instead, when the capabilities are not available.
2013-09-26 09:49:18 -07:00
|
|
|
{
|
2016-03-07 22:53:02 -08:00
|
|
|
EVAS_OBJECT_LEGACY_API(eo_obj);
|
|
|
|
|
2014-06-02 06:47:59 -07:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2016-03-07 22:53:02 -08:00
|
|
|
Evas_Image_Data *o = eo_data_scope_get(eo_obj, EVAS_IMAGE_CLASS);
|
2015-02-10 03:44:38 -08:00
|
|
|
evas_object_async_block(obj);
|
evas/image: Add video surface caps.
Wayland subsurfaces can be used as video surfaces too, similarly to
Ecore_X windows. However, they support a different set of features. Some
of them, like subsurface clipping and scaling, might be added in the
future, but so far we must work with what we have.
This commit allows to set an enum bitfield to the Video_Surface, with
the default value being one that will keep the same behavior as before,
for Ecore_X window. Thus, backward compatibility should not be broken.
It's possible to inform Evas that the surface in question is not able to
resize or scale, or that it's above or below the original canvas
surface. This allows Evas to show the surface itself, or use a buffer of
pixels instead, when the capabilities are not available.
2013-09-26 09:49:18 -07:00
|
|
|
|
2016-03-07 21:11:07 -08:00
|
|
|
_evas_image_cleanup(eo_obj, obj, o);
|
evas/image: Add video surface caps.
Wayland subsurfaces can be used as video surfaces too, similarly to
Ecore_X windows. However, they support a different set of features. Some
of them, like subsurface clipping and scaling, might be added in the
future, but so far we must work with what we have.
This commit allows to set an enum bitfield to the Video_Surface, with
the default value being one that will keep the same behavior as before,
for Ecore_X window. Thus, backward compatibility should not be broken.
It's possible to inform Evas that the surface in question is not able to
resize or scale, or that it's above or below the original canvas
surface. This allows Evas to show the surface itself, or use a buffer of
pixels instead, when the capabilities are not available.
2013-09-26 09:49:18 -07:00
|
|
|
|
|
|
|
if (caps == o->pixels->video_caps)
|
2016-03-07 22:53:02 -08:00
|
|
|
return;
|
evas/image: Add video surface caps.
Wayland subsurfaces can be used as video surfaces too, similarly to
Ecore_X windows. However, they support a different set of features. Some
of them, like subsurface clipping and scaling, might be added in the
future, but so far we must work with what we have.
This commit allows to set an enum bitfield to the Video_Surface, with
the default value being one that will keep the same behavior as before,
for Ecore_X window. Thus, backward compatibility should not be broken.
It's possible to inform Evas that the surface in question is not able to
resize or scale, or that it's above or below the original canvas
surface. This allows Evas to show the surface itself, or use a buffer of
pixels instead, when the capabilities are not available.
2013-09-26 09:49:18 -07:00
|
|
|
|
|
|
|
EINA_COW_PIXEL_WRITE_BEGIN(o, pixi_write)
|
|
|
|
pixi_write->video_caps = caps;
|
|
|
|
EINA_COW_PIXEL_WRITE_END(o, pixi_write)
|
|
|
|
}
|
|
|
|
|
2016-03-07 22:53:02 -08:00
|
|
|
EAPI unsigned int
|
|
|
|
evas_object_image_video_surface_caps_get(const Evas_Object *eo_obj)
|
evas/image: Add video surface caps.
Wayland subsurfaces can be used as video surfaces too, similarly to
Ecore_X windows. However, they support a different set of features. Some
of them, like subsurface clipping and scaling, might be added in the
future, but so far we must work with what we have.
This commit allows to set an enum bitfield to the Video_Surface, with
the default value being one that will keep the same behavior as before,
for Ecore_X window. Thus, backward compatibility should not be broken.
It's possible to inform Evas that the surface in question is not able to
resize or scale, or that it's above or below the original canvas
surface. This allows Evas to show the surface itself, or use a buffer of
pixels instead, when the capabilities are not available.
2013-09-26 09:49:18 -07:00
|
|
|
{
|
2016-03-07 22:53:02 -08:00
|
|
|
EVAS_OBJECT_LEGACY_API(eo_obj, 0);
|
|
|
|
|
|
|
|
Evas_Image_Data *o = eo_data_scope_get(eo_obj, EVAS_IMAGE_CLASS);
|
2014-03-12 07:28:40 -07:00
|
|
|
return (!o->video_surface ? 0 : o->pixels->video_caps);
|
evas/image: Add video surface caps.
Wayland subsurfaces can be used as video surfaces too, similarly to
Ecore_X windows. However, they support a different set of features. Some
of them, like subsurface clipping and scaling, might be added in the
future, but so far we must work with what we have.
This commit allows to set an enum bitfield to the Video_Surface, with
the default value being one that will keep the same behavior as before,
for Ecore_X window. Thus, backward compatibility should not be broken.
It's possible to inform Evas that the surface in question is not able to
resize or scale, or that it's above or below the original canvas
surface. This allows Evas to show the surface itself, or use a buffer of
pixels instead, when the capabilities are not available.
2013-09-26 09:49:18 -07:00
|
|
|
}
|
|
|
|
|
2013-10-27 18:26:32 -07:00
|
|
|
static void
|
|
|
|
_on_image_native_surface_del(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void *einfo EINA_UNUSED)
|
|
|
|
{
|
|
|
|
evas_object_image_native_surface_set(obj, NULL);
|
|
|
|
}
|
|
|
|
|
2016-03-08 23:21:08 -08:00
|
|
|
Eina_Bool
|
|
|
|
_evas_image_native_surface_set(Eo *eo_obj, Evas_Native_Surface *surf)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
2016-03-08 23:21:08 -08:00
|
|
|
Evas_Image_Data *o = eo_data_scope_get(eo_obj, EVAS_IMAGE_CLASS);
|
2015-02-10 03:44:38 -08:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
|
|
|
evas_object_async_block(obj);
|
2013-10-27 18:26:32 -07:00
|
|
|
evas_object_event_callback_del_full
|
|
|
|
(eo_obj, EVAS_CALLBACK_DEL, _on_image_native_surface_del, NULL);
|
|
|
|
if (surf) // We need to unset native surf on del to remove shared hash refs
|
|
|
|
evas_object_event_callback_add
|
|
|
|
(eo_obj, EVAS_CALLBACK_DEL, _on_image_native_surface_del, NULL);
|
2012-10-08 18:58:41 -07:00
|
|
|
|
2012-12-21 09:30:44 -08:00
|
|
|
evas_render_rendering_wait(obj->layer->evas);
|
2016-03-07 21:11:07 -08:00
|
|
|
_evas_image_cleanup(eo_obj, obj, o);
|
2016-03-08 23:21:08 -08:00
|
|
|
if (!ENFN->image_native_set) return EINA_FALSE;
|
2010-12-06 01:02:16 -08:00
|
|
|
if ((surf) &&
|
|
|
|
((surf->version < 2) ||
|
2016-03-08 23:21:08 -08:00
|
|
|
(surf->version > EVAS_NATIVE_SURFACE_VERSION))) return EINA_FALSE;
|
2014-10-22 02:34:51 -07:00
|
|
|
o->engine_data = ENFN->image_native_set(ENDT, o->engine_data, surf);
|
2016-03-08 23:21:08 -08:00
|
|
|
return (o->engine_data != NULL);
|
2006-12-09 00:52:08 -08:00
|
|
|
}
|
|
|
|
|
2016-03-08 23:21:08 -08:00
|
|
|
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)
|
2009-05-07 06:29:56 -07:00
|
|
|
{
|
2014-06-02 06:47:59 -07:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2016-03-08 23:21:08 -08:00
|
|
|
Evas_Image_Data *o = eo_data_scope_get(eo_obj, EVAS_IMAGE_CLASS);
|
|
|
|
Evas_Native_Surface *surf = NULL;
|
2012-10-08 18:58:41 -07:00
|
|
|
|
2014-10-22 02:34:51 -07:00
|
|
|
if (ENFN->image_native_get)
|
|
|
|
surf = ENFN->image_native_get(ENDT, o->engine_data);
|
2012-10-08 18:58:41 -07:00
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
return surf;
|
2012-10-08 18:58:41 -07:00
|
|
|
}
|
|
|
|
|
2016-03-08 23:21:08 -08:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static void
|
2016-03-10 20:59:14 -08:00
|
|
|
_evas_image_efl_image_scale_hint_set(Eo *eo_obj, Evas_Image_Data *o, Efl_Image_Scale_Hint hint)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
2014-06-02 06:47:59 -07:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2015-02-10 03:44:38 -08:00
|
|
|
evas_object_async_block(obj);
|
2010-08-11 23:02:15 -07:00
|
|
|
if (o->scale_hint == hint) return;
|
2009-05-07 06:29:56 -07:00
|
|
|
o->scale_hint = hint;
|
2010-08-18 22:18:17 -07:00
|
|
|
if (o->engine_data)
|
|
|
|
{
|
2010-08-19 00:32:44 -07:00
|
|
|
int stride = 0;
|
2012-09-04 01:42:38 -07:00
|
|
|
|
2014-10-22 02:34:51 -07:00
|
|
|
if (ENFN->image_scale_hint_set)
|
2015-10-05 22:29:57 -07:00
|
|
|
ENFN->image_scale_hint_set(ENDT, o->engine_data, o->scale_hint);
|
2014-10-22 02:34:51 -07:00
|
|
|
if (ENFN->image_stride_get)
|
2015-10-05 22:29:57 -07:00
|
|
|
ENFN->image_stride_get(ENDT, o->engine_data, &stride);
|
2010-08-19 00:32:44 -07:00
|
|
|
else
|
2014-10-22 02:34:51 -07:00
|
|
|
stride = o->cur->image.w * 4;
|
2013-01-27 16:28:53 -08:00
|
|
|
|
|
|
|
if (o->cur->image.stride != stride)
|
|
|
|
{
|
2013-03-12 05:58:19 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
|
2013-01-27 16:28:53 -08:00
|
|
|
state_write->image.stride = stride;
|
2013-03-12 05:58:19 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
|
2013-01-27 16:28:53 -08:00
|
|
|
}
|
2010-08-18 22:18:17 -07:00
|
|
|
}
|
2009-05-07 06:29:56 -07:00
|
|
|
}
|
|
|
|
|
2016-03-10 20:59:14 -08:00
|
|
|
EOLIAN static Efl_Image_Scale_Hint
|
|
|
|
_evas_image_efl_image_scale_hint_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
2016-03-10 20:59:14 -08:00
|
|
|
return o->scale_hint;
|
2012-10-08 18:58:41 -07:00
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static void
|
2016-03-10 20:59:14 -08:00
|
|
|
_evas_image_efl_image_content_hint_set(Eo *eo_obj, Evas_Image_Data *o, Efl_Image_Content_Hint hint)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
2014-06-02 06:47:59 -07:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2015-02-10 03:44:38 -08:00
|
|
|
evas_object_async_block(obj);
|
2010-08-11 23:02:15 -07:00
|
|
|
if (o->content_hint == hint) return;
|
2010-03-06 20:19:17 -08:00
|
|
|
o->content_hint = hint;
|
2010-08-18 22:18:17 -07:00
|
|
|
if (o->engine_data)
|
|
|
|
{
|
2010-08-19 00:32:44 -07:00
|
|
|
int stride = 0;
|
2012-09-04 01:42:38 -07:00
|
|
|
|
2014-10-22 02:34:51 -07:00
|
|
|
if (ENFN->image_content_hint_set)
|
2015-10-05 22:29:57 -07:00
|
|
|
ENFN->image_content_hint_set(ENDT, o->engine_data, o->content_hint);
|
2014-10-22 02:34:51 -07:00
|
|
|
if (ENFN->image_stride_get)
|
|
|
|
ENFN->image_stride_get(ENDT, o->engine_data, &stride);
|
2010-08-19 00:32:44 -07:00
|
|
|
else
|
2014-10-22 02:34:51 -07:00
|
|
|
stride = o->cur->image.w * 4;
|
2013-01-27 16:28:53 -08:00
|
|
|
|
|
|
|
if (o->cur->image.stride != stride)
|
|
|
|
{
|
2013-03-12 05:58:19 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
|
2013-01-27 16:28:53 -08:00
|
|
|
state_write->image.stride = stride;
|
2013-03-12 05:58:19 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
|
2013-01-27 16:28:53 -08:00
|
|
|
}
|
2010-08-18 22:18:17 -07:00
|
|
|
}
|
2010-03-06 20:19:17 -08:00
|
|
|
}
|
|
|
|
|
2016-03-10 20:59:14 -08:00
|
|
|
EOLIAN static Efl_Image_Content_Hint
|
|
|
|
_evas_image_efl_image_content_hint_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
2014-03-12 07:28:40 -07:00
|
|
|
return o->content_hint;
|
2012-10-08 18:58:41 -07:00
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2016-03-02 03:46:11 -08:00
|
|
|
_evas_image_efl_image_load_load_region_support_get(Eo *eo_obj, Evas_Image_Data *o)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
2014-06-02 06:47:59 -07:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2011-12-13 08:58:20 -08:00
|
|
|
|
2016-03-02 03:46:11 -08:00
|
|
|
return ENFN->image_can_region_get(ENDT, o->engine_data);
|
2012-10-08 18:58:41 -07:00
|
|
|
}
|
2011-08-10 23:04:08 -07:00
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
/* animated feature */
|
|
|
|
EOLIAN static Eina_Bool
|
2016-03-02 01:12:29 -08:00
|
|
|
_evas_image_efl_image_animated_animated_get(Eo *eo_obj, Evas_Image_Data *o)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
2014-03-12 07:28:40 -07:00
|
|
|
Eina_Bool animated;
|
2014-06-02 06:47:59 -07:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2012-10-08 18:58:41 -07:00
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
animated =
|
2014-10-22 02:34:51 -07:00
|
|
|
ENFN->image_animated_get ?
|
|
|
|
ENFN->image_animated_get(ENDT, o->engine_data) :
|
2012-10-08 18:58:41 -07:00
|
|
|
EINA_FALSE;
|
2011-08-10 23:04:08 -07:00
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
return animated;
|
2012-10-08 18:58:41 -07:00
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static int
|
2016-03-02 01:12:29 -08:00
|
|
|
_evas_image_efl_image_animated_animated_frame_count_get(Eo *eo_obj, Evas_Image_Data *o)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
2014-03-12 07:28:40 -07:00
|
|
|
int frame_count;
|
|
|
|
frame_count = -1;
|
2012-10-08 18:58:41 -07:00
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
if (!evas_object_image_animated_get(eo_obj)) return frame_count;
|
2014-06-02 06:47:59 -07:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2011-08-10 23:04:08 -07:00
|
|
|
|
2014-10-22 02:34:51 -07:00
|
|
|
if (ENFN->image_animated_frame_count_get)
|
|
|
|
frame_count = ENFN->image_animated_frame_count_get(ENDT, o->engine_data);
|
2011-08-10 23:04:08 -07:00
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
return frame_count;
|
2012-10-08 18:58:41 -07:00
|
|
|
}
|
|
|
|
|
2016-03-02 01:12:29 -08:00
|
|
|
EOLIAN static Efl_Image_Animated_Loop_Hint
|
|
|
|
_evas_image_efl_image_animated_animated_loop_type_get(Eo *eo_obj, Evas_Image_Data *o)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
2014-06-02 06:47:59 -07:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2016-03-02 01:12:29 -08:00
|
|
|
Efl_Image_Animated_Loop_Hint hint = EFL_IMAGE_ANIMATED_LOOP_HINT_NONE;
|
2011-08-10 23:04:08 -07:00
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
if (!evas_object_image_animated_get(eo_obj)) return hint;
|
2011-08-10 23:04:08 -07:00
|
|
|
|
2014-10-22 02:34:51 -07:00
|
|
|
if (ENFN->image_animated_loop_type_get)
|
2016-03-02 01:12:29 -08:00
|
|
|
hint = (Efl_Image_Animated_Loop_Hint) ENFN->image_animated_loop_type_get(ENDT, o->engine_data);
|
2011-08-10 23:04:08 -07:00
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
return hint;
|
2012-10-08 18:58:41 -07:00
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static int
|
2016-03-02 01:12:29 -08:00
|
|
|
_evas_image_efl_image_animated_animated_loop_count_get(Eo *eo_obj, Evas_Image_Data *o)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
2014-06-02 06:47:59 -07:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2011-08-10 23:04:08 -07:00
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
int loop_count;
|
|
|
|
loop_count = -1;
|
|
|
|
if (!evas_object_image_animated_get(eo_obj)) return loop_count;
|
2011-08-10 23:04:08 -07:00
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
loop_count =
|
2014-10-22 02:34:51 -07:00
|
|
|
ENFN->image_animated_loop_count_get ?
|
|
|
|
ENFN->image_animated_loop_count_get(ENDT, o->engine_data) :
|
2012-10-08 18:58:41 -07:00
|
|
|
-1;
|
2011-08-10 23:04:08 -07:00
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
return loop_count;
|
2012-10-08 18:58:41 -07:00
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static double
|
2016-03-02 01:12:29 -08:00
|
|
|
_evas_image_efl_image_animated_animated_frame_duration_get(Eo *eo_obj, Evas_Image_Data *o, int start_frame, int frame_num)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
2014-06-02 06:47:59 -07:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2016-03-02 01:12:29 -08:00
|
|
|
double frame_duration = -1;
|
2012-10-08 18:58:41 -07:00
|
|
|
int frame_count = 0;
|
2011-08-10 23:04:08 -07:00
|
|
|
|
2014-10-22 02:34:51 -07:00
|
|
|
if (!ENFN->image_animated_frame_count_get) return frame_duration;
|
2011-08-10 23:04:08 -07:00
|
|
|
|
2014-10-22 02:34:51 -07:00
|
|
|
frame_count = ENFN->image_animated_frame_count_get(ENDT, o->engine_data);
|
2011-08-10 23:04:08 -07:00
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
if ((start_frame + frame_num) > frame_count) return frame_duration;
|
2014-10-22 02:34:51 -07:00
|
|
|
if (ENFN->image_animated_frame_duration_get)
|
|
|
|
frame_duration = ENFN->image_animated_frame_duration_get(ENDT, o->engine_data, start_frame, frame_num);
|
2011-08-10 23:04:08 -07:00
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
return frame_duration;
|
2012-10-08 18:58:41 -07:00
|
|
|
}
|
|
|
|
|
2016-03-02 01:12:29 -08:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_evas_image_efl_image_animated_animated_frame_set(Eo *eo_obj, Evas_Image_Data *o, int frame_index)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
2014-06-02 06:47:59 -07:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2012-10-08 18:58:41 -07:00
|
|
|
int frame_count = 0;
|
2011-08-10 23:04:08 -07:00
|
|
|
|
2016-03-02 01:12:29 -08:00
|
|
|
if (!o->cur->u.file) return EINA_FALSE;
|
|
|
|
if (o->cur->frame == frame_index) return EINA_TRUE;
|
2011-08-10 23:04:08 -07:00
|
|
|
|
2016-03-02 01:12:29 -08:00
|
|
|
if (!evas_object_image_animated_get(eo_obj)) return EINA_FALSE;
|
2015-02-10 03:44:38 -08:00
|
|
|
evas_object_async_block(obj);
|
2012-10-08 18:58:41 -07:00
|
|
|
frame_count = evas_object_image_animated_frame_count_get(eo_obj);
|
2011-08-10 23:04:08 -07:00
|
|
|
|
|
|
|
/* limit the size of frame to FRAME_MAX */
|
|
|
|
if ((frame_count > FRAME_MAX) || (frame_count < 0) || (frame_index > frame_count))
|
2016-03-02 01:12:29 -08:00
|
|
|
return EINA_FALSE;
|
2011-08-10 23:04:08 -07:00
|
|
|
|
2016-03-02 01:12:29 -08:00
|
|
|
if (!ENFN->image_animated_frame_set) return EINA_FALSE;
|
2014-10-22 02:34:51 -07:00
|
|
|
ENFN->image_animated_frame_set(ENDT, o->engine_data, frame_index);
|
|
|
|
// if (!ENFN->image_animated_frame_set(ENDT, o->engine_data, frame_index)) return;
|
2011-08-10 23:04:08 -07:00
|
|
|
|
2013-01-27 16:28:53 -08:00
|
|
|
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);
|
|
|
|
|
2013-03-12 05:58:19 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
|
2013-01-27 16:28:53 -08:00
|
|
|
state_write->frame = frame_index;
|
2013-03-12 05:58:19 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
|
2011-08-10 23:04:08 -07:00
|
|
|
|
2012-09-04 01:56:46 -07:00
|
|
|
o->changed = EINA_TRUE;
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_change(eo_obj, obj);
|
2011-08-10 23:04:08 -07:00
|
|
|
|
2016-03-02 01:12:29 -08:00
|
|
|
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;
|
2011-08-10 23:04:08 -07:00
|
|
|
}
|
|
|
|
|
2014-03-11 23:53:00 -07:00
|
|
|
EOLIAN void
|
2014-06-26 14:29:46 -07:00
|
|
|
_evas_canvas_image_cache_flush(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2015-02-10 03:44:38 -08:00
|
|
|
evas_canvas_async_block(e);
|
2013-01-16 14:32:39 -08:00
|
|
|
evas_render_rendering_wait(e);
|
2005-05-21 19:49:50 -07:00
|
|
|
e->engine.func->image_cache_flush(e->engine.data.output);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2014-03-11 23:53:00 -07:00
|
|
|
EOLIAN void
|
2014-06-26 14:29:46 -07:00
|
|
|
_evas_canvas_image_cache_reload(Eo *eo_e, Evas_Public_Data *e)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
Evas_Layer *layer;
|
2002-11-08 00:02:15 -08:00
|
|
|
|
2015-02-10 03:44:38 -08:00
|
|
|
evas_canvas_async_block(e);
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_image_cache_flush(eo_e);
|
2008-10-21 05:19:57 -07:00
|
|
|
EINA_INLIST_FOREACH(e->layers, layer)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
Evas_Object_Protected_Data *obj;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
EINA_INLIST_FOREACH(layer->objects, obj)
|
|
|
|
{
|
|
|
|
if (eo_isa(obj->object, MY_CLASS))
|
2012-09-04 01:42:38 -07:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_image_unload(obj->object, 1);
|
|
|
|
evas_object_inform_call_image_unloaded(obj->object);
|
2012-09-04 01:42:38 -07:00
|
|
|
}
|
2012-10-08 18:58:41 -07:00
|
|
|
}
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_image_cache_flush(eo_e);
|
2008-10-21 05:19:57 -07:00
|
|
|
EINA_INLIST_FOREACH(e->layers, layer)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
Evas_Object_Protected_Data *obj;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
EINA_INLIST_FOREACH(layer->objects, obj)
|
|
|
|
{
|
|
|
|
if (eo_isa(obj->object, MY_CLASS))
|
2012-09-04 01:42:38 -07:00
|
|
|
{
|
2014-03-12 07:28:40 -07:00
|
|
|
Evas_Image_Data *o = eo_data_scope_get(obj->object, MY_CLASS);
|
2013-07-11 00:03:01 -07:00
|
|
|
evas_object_image_load(obj->object, obj, o);
|
2012-09-04 01:56:46 -07:00
|
|
|
o->changed = EINA_TRUE;
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_change(obj->object, obj);
|
2012-09-04 01:42:38 -07:00
|
|
|
}
|
2012-10-08 18:58:41 -07:00
|
|
|
}
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_image_cache_flush(eo_e);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2014-03-11 23:53:00 -07:00
|
|
|
EOLIAN void
|
2014-06-26 14:29:46 -07:00
|
|
|
_evas_canvas_image_cache_set(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e, int size)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
2002-11-08 00:02:15 -08:00
|
|
|
if (size < 0) size = 0;
|
2015-02-10 03:44:38 -08:00
|
|
|
evas_canvas_async_block(e);
|
2013-01-16 14:32:39 -08:00
|
|
|
evas_render_rendering_wait(e);
|
2002-11-08 00:02:15 -08:00
|
|
|
e->engine.func->image_cache_set(e->engine.data.output, size);
|
|
|
|
}
|
|
|
|
|
2014-03-11 23:53:00 -07:00
|
|
|
EOLIAN int
|
2014-06-26 14:29:46 -07:00
|
|
|
_evas_canvas_image_cache_get(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2014-03-11 23:53:00 -07:00
|
|
|
return e->engine.func->image_cache_get(e->engine.data.output);
|
2012-10-08 18:58:41 -07:00
|
|
|
}
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2014-03-11 23:53:00 -07:00
|
|
|
EOLIAN Eina_Bool
|
2014-06-26 14:29:46 -07:00
|
|
|
_evas_canvas_image_max_size_get(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e, int *maxw, int *maxh)
|
2011-10-21 01:17:14 -07:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
int w = 0, h = 0;
|
2012-09-04 01:42:38 -07:00
|
|
|
|
2011-10-21 01:17:14 -07:00
|
|
|
if (maxw) *maxw = 0xffff;
|
|
|
|
if (maxh) *maxh = 0xffff;
|
2014-03-11 23:53:00 -07:00
|
|
|
if (!e->engine.func->image_max_size_get) return EINA_FALSE;
|
2011-10-21 01:17:14 -07:00
|
|
|
e->engine.func->image_max_size_get(e->engine.data.output, &w, &h);
|
|
|
|
if (maxw) *maxw = w;
|
|
|
|
if (maxh) *maxh = h;
|
2014-03-11 23:53:00 -07:00
|
|
|
return EINA_TRUE;
|
2011-10-21 01:17:14 -07:00
|
|
|
}
|
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
static void
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_image_unload(Evas_Object *eo_obj, Eina_Bool dirty)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2014-03-12 07:28:40 -07:00
|
|
|
Evas_Image_Data *o;
|
2012-09-04 21:20:42 -07:00
|
|
|
Eina_Bool resize_call = EINA_FALSE;
|
2012-09-04 01:42:38 -07:00
|
|
|
|
2013-05-02 00:47:16 -07:00
|
|
|
o = eo_data_scope_get(eo_obj, MY_CLASS);
|
2013-07-11 00:03:01 -07:00
|
|
|
if ((!o->cur->u.file) ||
|
2004-09-21 21:54:39 -07:00
|
|
|
(o->pixels_checked_out > 0)) return;
|
2012-10-08 18:58:41 -07:00
|
|
|
|
2014-06-02 06:47:59 -07:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2015-02-10 03:44:38 -08:00
|
|
|
evas_object_async_block(obj);
|
2009-05-10 15:42:09 -07:00
|
|
|
if (dirty)
|
|
|
|
{
|
|
|
|
if (o->engine_data)
|
2014-10-22 02:34:51 -07:00
|
|
|
o->engine_data = ENFN->image_dirty_region(ENDT, o->engine_data,
|
|
|
|
0, 0,
|
|
|
|
o->cur->image.w, o->cur->image.h);
|
2009-05-10 15:42:09 -07:00
|
|
|
}
|
2002-11-08 00:02:15 -08:00
|
|
|
if (o->engine_data)
|
2010-12-24 08:04:27 -08:00
|
|
|
{
|
2011-05-02 20:20:02 -07:00
|
|
|
if (o->preloading)
|
|
|
|
{
|
2012-09-04 01:56:46 -07:00
|
|
|
o->preloading = EINA_FALSE;
|
2014-10-22 02:34:51 -07:00
|
|
|
ENFN->image_data_preload_cancel(ENDT, o->engine_data, eo_obj);
|
2011-05-02 20:20:02 -07:00
|
|
|
}
|
2014-10-22 02:34:51 -07:00
|
|
|
ENFN->image_free(ENDT, o->engine_data);
|
2010-12-24 08:04:27 -08:00
|
|
|
}
|
2005-05-21 19:49:50 -07:00
|
|
|
o->engine_data = NULL;
|
2002-11-08 00:02:15 -08:00
|
|
|
o->load_error = EVAS_LOAD_ERROR_NONE;
|
2013-01-27 16:28:53 -08:00
|
|
|
|
2013-03-12 05:58:19 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
|
2013-01-27 16:28:53 -08:00
|
|
|
{
|
|
|
|
state_write->has_alpha = EINA_TRUE;
|
|
|
|
state_write->cspace = EVAS_COLORSPACE_ARGB8888;
|
|
|
|
if ((state_write->image.w != 0) || (state_write->image.h != 0)) resize_call = EINA_TRUE;
|
|
|
|
state_write->image.w = 0;
|
|
|
|
state_write->image.h = 0;
|
|
|
|
state_write->image.stride = 0;
|
|
|
|
}
|
2013-03-12 05:58:19 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
|
2012-10-08 18:58:41 -07:00
|
|
|
if (resize_call) evas_object_inform_call_image_resize(eo_obj);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-03-12 07:28:40 -07:00
|
|
|
evas_object_image_load(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Evas_Image_Data *o)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2006-08-18 07:45:26 -07:00
|
|
|
Evas_Image_Load_Opts lo;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2004-09-22 18:58:50 -07:00
|
|
|
if (o->engine_data) return;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2013-01-23 17:50:57 -08:00
|
|
|
lo.scale_down_by = o->load_opts->scale_down_by;
|
|
|
|
lo.dpi = o->load_opts->dpi;
|
|
|
|
lo.w = o->load_opts->w;
|
|
|
|
lo.h = o->load_opts->h;
|
|
|
|
lo.region.x = o->load_opts->region.x;
|
|
|
|
lo.region.y = o->load_opts->region.y;
|
|
|
|
lo.region.w = o->load_opts->region.w;
|
|
|
|
lo.region.h = o->load_opts->region.h;
|
|
|
|
lo.scale_load.src_x = o->load_opts->scale_load.src_x;
|
|
|
|
lo.scale_load.src_y = o->load_opts->scale_load.src_y;
|
|
|
|
lo.scale_load.src_w = o->load_opts->scale_load.src_w;
|
|
|
|
lo.scale_load.src_h = o->load_opts->scale_load.src_h;
|
|
|
|
lo.scale_load.dst_w = o->load_opts->scale_load.dst_w;
|
|
|
|
lo.scale_load.dst_h = o->load_opts->scale_load.dst_h;
|
|
|
|
lo.scale_load.smooth = o->load_opts->scale_load.smooth;
|
|
|
|
lo.scale_load.scale_hint = o->load_opts->scale_load.scale_hint;
|
|
|
|
lo.orientation = o->load_opts->orientation;
|
2013-05-20 03:23:36 -07:00
|
|
|
lo.degree = 0;
|
2013-07-11 00:03:01 -07:00
|
|
|
if (o->cur->mmaped_source)
|
2014-10-22 02:34:51 -07:00
|
|
|
o->engine_data = ENFN->image_mmap
|
|
|
|
(ENDT,
|
2013-07-11 00:03:01 -07:00
|
|
|
o->cur->u.f,
|
|
|
|
o->cur->key,
|
|
|
|
&o->load_error,
|
|
|
|
&lo);
|
|
|
|
else
|
2014-10-22 02:34:51 -07:00
|
|
|
o->engine_data = ENFN->image_load
|
|
|
|
(ENDT,
|
2013-07-11 00:03:01 -07:00
|
|
|
o->cur->u.file,
|
|
|
|
o->cur->key,
|
|
|
|
&o->load_error,
|
|
|
|
&lo);
|
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
if (o->engine_data)
|
|
|
|
{
|
2012-09-04 01:42:38 -07:00
|
|
|
int w, h;
|
|
|
|
int stride = 0;
|
2012-09-04 21:20:42 -07:00
|
|
|
Eina_Bool resize_call = EINA_FALSE;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2014-10-22 02:34:51 -07:00
|
|
|
ENFN->image_size_get(ENDT, o->engine_data, &w, &h);
|
|
|
|
if (ENFN->image_stride_get)
|
|
|
|
ENFN->image_stride_get(ENDT, o->engine_data, &stride);
|
2012-09-04 01:42:38 -07:00
|
|
|
else
|
|
|
|
stride = w * 4;
|
2013-01-27 16:28:53 -08:00
|
|
|
|
2013-03-12 05:58:19 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
|
2013-01-27 16:28:53 -08:00
|
|
|
{
|
2014-10-22 02:34:51 -07:00
|
|
|
state_write->has_alpha = ENFN->image_alpha_get(ENDT, o->engine_data);
|
|
|
|
state_write->cspace = ENFN->image_colorspace_get(ENDT, o->engine_data);
|
2013-01-27 16:28:53 -08:00
|
|
|
if ((state_write->image.w != w) || (state_write->image.h != h))
|
|
|
|
resize_call = EINA_TRUE;
|
|
|
|
state_write->image.w = w;
|
|
|
|
state_write->image.h = h;
|
|
|
|
state_write->image.stride = stride;
|
|
|
|
}
|
2013-03-12 05:58:19 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
|
2012-10-08 18:58:41 -07:00
|
|
|
if (resize_call) evas_object_inform_call_image_resize(eo_obj);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-09-04 01:42:38 -07:00
|
|
|
o->load_error = EVAS_LOAD_ERROR_GENERIC;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-11-04 01:19:35 -08:00
|
|
|
static Evas_Coord
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_image_figure_x_fill(Evas_Object *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj, Evas_Coord start, Evas_Coord size, Evas_Coord *size_ret)
|
2008-11-04 01:19:35 -08:00
|
|
|
{
|
|
|
|
Evas_Coord w;
|
|
|
|
|
|
|
|
w = ((size * obj->layer->evas->output.w) /
|
2012-09-04 01:42:38 -07:00
|
|
|
(Evas_Coord)obj->layer->evas->viewport.w);
|
2008-11-04 01:19:35 -08:00
|
|
|
if (size <= 0) size = 1;
|
|
|
|
if (start > 0)
|
|
|
|
{
|
2012-09-04 01:42:38 -07:00
|
|
|
while (start - size > 0) start -= size;
|
2008-11-04 01:19:35 -08:00
|
|
|
}
|
|
|
|
else if (start < 0)
|
|
|
|
{
|
2012-09-04 01:42:38 -07:00
|
|
|
while (start < 0) start += size;
|
2008-11-04 01:19:35 -08:00
|
|
|
}
|
|
|
|
start = ((start * obj->layer->evas->output.w) /
|
2012-09-04 01:42:38 -07:00
|
|
|
(Evas_Coord)obj->layer->evas->viewport.w);
|
2008-11-04 01:19:35 -08:00
|
|
|
*size_ret = w;
|
|
|
|
return start;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Evas_Coord
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_image_figure_y_fill(Evas_Object *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj, Evas_Coord start, Evas_Coord size, Evas_Coord *size_ret)
|
2008-11-04 01:19:35 -08:00
|
|
|
{
|
|
|
|
Evas_Coord h;
|
|
|
|
|
|
|
|
h = ((size * obj->layer->evas->output.h) /
|
2012-09-04 01:42:38 -07:00
|
|
|
(Evas_Coord)obj->layer->evas->viewport.h);
|
2008-11-04 01:19:35 -08:00
|
|
|
if (size <= 0) size = 1;
|
|
|
|
if (start > 0)
|
|
|
|
{
|
2012-09-04 01:42:38 -07:00
|
|
|
while (start - size > 0) start -= size;
|
2008-11-04 01:19:35 -08:00
|
|
|
}
|
|
|
|
else if (start < 0)
|
|
|
|
{
|
2012-09-04 01:42:38 -07:00
|
|
|
while (start < 0) start += size;
|
2008-11-04 01:19:35 -08:00
|
|
|
}
|
|
|
|
start = ((start * obj->layer->evas->output.h) /
|
2012-09-04 01:42:38 -07:00
|
|
|
(Evas_Coord)obj->layer->evas->viewport.h);
|
2008-11-04 01:19:35 -08:00
|
|
|
*size_ret = h;
|
|
|
|
return start;
|
|
|
|
}
|
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
static void
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_image_init(Evas_Object *eo_obj)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2014-06-02 06:47:59 -07:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2002-11-08 00:02:15 -08:00
|
|
|
/* set up methods (compulsory) */
|
|
|
|
obj->func = &object_func;
|
2013-07-08 17:46:15 -07:00
|
|
|
obj->private_data = eo_data_ref(eo_obj, MY_CLASS);
|
2002-11-08 00:02:15 -08:00
|
|
|
obj->type = o_type;
|
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static void
|
2014-03-18 07:01:24 -07:00
|
|
|
_evas_image_eo_base_destructor(Eo *eo_obj, Evas_Image_Data *_pd EINA_UNUSED)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2014-06-02 06:47:59 -07:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2013-01-23 17:50:57 -08:00
|
|
|
|
2013-01-27 00:34:22 -08:00
|
|
|
evas_object_image_video_surface_set(eo_obj, NULL);
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_image_free(eo_obj, obj);
|
2016-03-01 10:06:28 -08:00
|
|
|
eo_destructor(eo_super(eo_obj, MY_CLASS));
|
2013-01-27 16:28:53 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_evas_object_image_free(Evas_Object *obj)
|
|
|
|
{
|
2014-03-12 07:28:40 -07:00
|
|
|
Evas_Image_Data *o;
|
2013-01-27 16:28:53 -08:00
|
|
|
|
2013-06-20 04:28:18 -07:00
|
|
|
if (!eo_isa(obj, MY_CLASS)) return;
|
2013-01-27 16:28:53 -08:00
|
|
|
|
2013-05-02 00:47:16 -07:00
|
|
|
o = eo_data_scope_get(obj, MY_CLASS);
|
2013-01-27 16:28:53 -08:00
|
|
|
|
2013-11-03 19:47:48 -08:00
|
|
|
// eina_cow_free reset the pointer to the default read only state
|
|
|
|
eina_cow_free(evas_object_image_load_opts_cow, (const Eina_Cow_Data**) &o->load_opts);
|
|
|
|
eina_cow_free(evas_object_image_pixels_cow, (const Eina_Cow_Data**) &o->pixels);
|
|
|
|
eina_cow_free(evas_object_image_state_cow, (const Eina_Cow_Data**) &o->cur);
|
|
|
|
eina_cow_free(evas_object_image_state_cow, (const Eina_Cow_Data**) &o->prev);
|
2012-10-08 18:58:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
evas_object_image_free(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj)
|
|
|
|
{
|
2014-03-12 07:28:40 -07:00
|
|
|
Evas_Image_Data *o = eo_data_scope_get(eo_obj, MY_CLASS);
|
2009-06-23 06:57:27 -07:00
|
|
|
Eina_Rectangle *r;
|
2002-11-08 00:02:15 -08:00
|
|
|
|
|
|
|
/* free obj */
|
2013-08-11 20:12:13 -07:00
|
|
|
if (!o->cur->mmaped_source)
|
|
|
|
{
|
|
|
|
if (o->cur->u.file) eina_stringshare_del(o->cur->u.file);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (o->cur->u.f) eina_file_close(o->cur->u.f);
|
|
|
|
}
|
2013-01-27 16:28:53 -08:00
|
|
|
if (o->cur->key) eina_stringshare_del(o->cur->key);
|
2016-03-07 21:11:07 -08:00
|
|
|
if (o->cur->source) _evas_image_proxy_unset(eo_obj, obj, o);
|
|
|
|
if (o->cur->scene) _evas_image_3d_unset(eo_obj, obj, o);
|
2013-02-19 02:37:57 -08:00
|
|
|
if (obj->layer && obj->layer->evas)
|
2009-09-27 20:51:21 -07:00
|
|
|
{
|
2013-02-19 02:37:57 -08:00
|
|
|
if (o->engine_data)
|
|
|
|
{
|
|
|
|
if (o->preloading)
|
|
|
|
{
|
|
|
|
o->preloading = EINA_FALSE;
|
2014-10-22 02:34:51 -07:00
|
|
|
ENFN->image_data_preload_cancel(ENDT, o->engine_data, eo_obj);
|
2013-02-19 02:37:57 -08:00
|
|
|
}
|
2014-10-22 02:34:51 -07:00
|
|
|
ENFN->image_free(ENDT, o->engine_data);
|
2013-02-19 02:37:57 -08:00
|
|
|
}
|
|
|
|
if (o->video_surface)
|
|
|
|
{
|
|
|
|
o->video_surface = EINA_FALSE;
|
|
|
|
obj->layer->evas->video_objects = eina_list_remove(obj->layer->evas->video_objects, eo_obj);
|
|
|
|
}
|
2011-10-02 20:28:52 -07:00
|
|
|
}
|
2005-10-03 06:14:07 -07:00
|
|
|
o->engine_data = NULL;
|
2013-01-25 07:19:32 -08:00
|
|
|
if (o->pixels->pixel_updates)
|
2013-01-25 04:15:38 -08:00
|
|
|
{
|
2013-01-25 07:19:32 -08:00
|
|
|
EINA_COW_PIXEL_WRITE_BEGIN(o, pixi_write)
|
|
|
|
{
|
|
|
|
EINA_LIST_FREE(pixi_write->pixel_updates, r)
|
|
|
|
eina_rectangle_free(r);
|
|
|
|
}
|
|
|
|
EINA_COW_PIXEL_WRITE_END(o, pixi_write);
|
2013-01-25 04:15:38 -08:00
|
|
|
}
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2013-01-11 11:54:12 -08:00
|
|
|
static void
|
|
|
|
_draw_image(Evas_Object_Protected_Data *obj,
|
|
|
|
void *data, void *context, void *surface, void *image,
|
|
|
|
int src_x, int src_y, int src_w, int src_h, int dst_x,
|
|
|
|
int dst_y, int dst_w, int dst_h, int smooth,
|
|
|
|
Eina_Bool do_async)
|
|
|
|
{
|
|
|
|
Eina_Bool async_unref;
|
|
|
|
|
2014-10-22 02:34:51 -07:00
|
|
|
async_unref = ENFN->image_draw(data, context, surface,
|
|
|
|
image, src_x, src_y,
|
|
|
|
src_w, src_h, dst_x,
|
|
|
|
dst_y, dst_w, dst_h,
|
|
|
|
smooth, do_async);
|
2013-01-11 11:54:12 -08:00
|
|
|
if (do_async && async_unref)
|
|
|
|
{
|
|
|
|
#ifdef EVAS_CSERVE2
|
|
|
|
if (evas_cserve2_use_get())
|
|
|
|
evas_cache2_image_ref((Image_Entry *)image);
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
evas_cache_image_ref((Image_Entry *)image);
|
|
|
|
|
|
|
|
evas_unref_queue_image_put(obj->layer->evas, image);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-01-11 11:56:17 -08:00
|
|
|
void
|
|
|
|
evas_draw_image_map_async_check(Evas_Object_Protected_Data *obj,
|
|
|
|
void *data, void *context, void *surface,
|
|
|
|
void *image, RGBA_Map *m, int smooth, int level,
|
|
|
|
Eina_Bool do_async)
|
|
|
|
{
|
|
|
|
Eina_Bool async_unref;
|
2014-11-25 19:22:55 -08:00
|
|
|
obj->layer->evas->engine.func->context_anti_alias_set(data, context,
|
|
|
|
obj->cur->anti_alias);
|
2014-10-22 02:34:51 -07:00
|
|
|
async_unref = ENFN->image_map_draw(data, context,
|
|
|
|
surface, image, m,
|
|
|
|
smooth, level,
|
|
|
|
do_async);
|
2013-01-11 11:56:17 -08:00
|
|
|
if (do_async && async_unref)
|
|
|
|
{
|
|
|
|
#ifdef EVAS_CSERVE2
|
|
|
|
if (evas_cserve2_use_get())
|
|
|
|
evas_cache2_image_ref((Image_Entry *)image);
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
evas_cache_image_ref((Image_Entry *)image);
|
|
|
|
|
|
|
|
evas_unref_queue_image_put(obj->layer->evas, image);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-15 03:11:06 -07:00
|
|
|
static void *
|
2014-03-12 07:28:40 -07:00
|
|
|
evas_process_dirty_pixels(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Evas_Image_Data *o,
|
2015-04-14 04:41:56 -07:00
|
|
|
void *output, void *surface, void *pixels)
|
2013-07-15 03:11:06 -07:00
|
|
|
{
|
2015-02-24 02:05:39 -08:00
|
|
|
Eina_Bool direct_override = EINA_FALSE, direct_force_off = EINA_FALSE;
|
2013-07-15 03:11:06 -07:00
|
|
|
|
|
|
|
if (o->dirty_pixels)
|
|
|
|
{
|
|
|
|
if (o->pixels->func.get_pixels)
|
|
|
|
{
|
2013-08-07 02:40:42 -07:00
|
|
|
Evas_Coord x, y, w, h;
|
|
|
|
|
2014-10-22 02:34:51 -07:00
|
|
|
if (ENFN->image_native_get)
|
2013-07-15 03:11:06 -07:00
|
|
|
{
|
|
|
|
Evas_Native_Surface *ns;
|
2015-03-02 23:38:52 -08:00
|
|
|
|
2014-10-22 02:34:51 -07:00
|
|
|
ns = ENFN->image_native_get(ENDT, o->engine_data);
|
2015-03-02 23:38:52 -08:00
|
|
|
if (ns)
|
2013-07-15 03:11:06 -07:00
|
|
|
{
|
2014-12-09 04:36:45 -08:00
|
|
|
Eina_Bool direct_renderable = EINA_FALSE;
|
|
|
|
|
2013-07-15 03:11:06 -07:00
|
|
|
// Check if we can do direct rendering...
|
2014-10-22 02:34:51 -07:00
|
|
|
if (ENFN->gl_direct_override_get)
|
|
|
|
ENFN->gl_direct_override_get(output, &direct_override, &direct_force_off);
|
2014-12-09 04:36:45 -08:00
|
|
|
if (ENFN->gl_surface_direct_renderable_get)
|
2015-04-14 04:41:56 -07:00
|
|
|
direct_renderable = ENFN->gl_surface_direct_renderable_get(output, ns, &direct_override, surface);
|
2014-12-09 04:36:45 -08:00
|
|
|
|
|
|
|
if ( ((direct_override) ||
|
|
|
|
((direct_renderable) &&
|
|
|
|
(obj->cur->geometry.w == o->cur->image.w) &&
|
2013-07-15 03:11:06 -07:00
|
|
|
(obj->cur->geometry.h == o->cur->image.h) &&
|
|
|
|
(obj->cur->color.r == 255) &&
|
|
|
|
(obj->cur->color.g == 255) &&
|
|
|
|
(obj->cur->color.b == 255) &&
|
|
|
|
(obj->cur->color.a == 255) &&
|
2015-04-14 04:02:01 -07:00
|
|
|
(obj->cur->cache.clip.r == 255) &&
|
|
|
|
(obj->cur->cache.clip.g == 255) &&
|
|
|
|
(obj->cur->cache.clip.b == 255) &&
|
|
|
|
(obj->cur->cache.clip.a == 255) &&
|
2014-12-09 04:36:45 -08:00
|
|
|
(!obj->map->cur.map))
|
|
|
|
) && (!direct_force_off) )
|
2013-07-15 03:11:06 -07:00
|
|
|
{
|
2014-10-22 02:34:51 -07:00
|
|
|
if (ENFN->gl_get_pixels_set)
|
2014-12-09 04:36:45 -08:00
|
|
|
ENFN->gl_get_pixels_set(output, o->pixels->func.get_pixels, o->pixels->func.get_pixels_data, eo_obj);
|
2015-03-02 23:38:52 -08:00
|
|
|
if (ENFN->gl_image_direct_set)
|
|
|
|
ENFN->gl_image_direct_set(output, o->engine_data, EINA_TRUE);
|
2013-07-15 03:11:06 -07:00
|
|
|
o->direct_render = EINA_TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
o->direct_render = EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( (ns) &&
|
|
|
|
(ns->type == EVAS_NATIVE_SURFACE_X11))
|
|
|
|
{
|
2014-10-22 02:34:51 -07:00
|
|
|
if (ENFN->context_flush)
|
|
|
|
ENFN->context_flush(output);
|
2013-07-15 03:11:06 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-08-07 02:40:42 -07:00
|
|
|
x = obj->cur->geometry.x;
|
|
|
|
y = obj->cur->geometry.y;
|
|
|
|
w = obj->cur->geometry.w;
|
2014-04-14 03:03:47 -07:00
|
|
|
h = obj->cur->geometry.h;
|
2013-08-07 02:40:42 -07:00
|
|
|
|
2013-07-15 03:11:06 -07:00
|
|
|
if (!o->direct_render)
|
2015-03-03 03:08:16 -08:00
|
|
|
{
|
|
|
|
if (ENFN->gl_get_pixels_pre)
|
|
|
|
ENFN->gl_get_pixels_pre(output);
|
|
|
|
o->pixels->func.get_pixels(o->pixels->func.get_pixels_data, eo_obj);
|
|
|
|
if (ENFN->gl_get_pixels_post)
|
|
|
|
ENFN->gl_get_pixels_post(output);
|
|
|
|
}
|
2013-07-15 03:11:06 -07:00
|
|
|
|
2013-08-07 02:40:42 -07:00
|
|
|
if (!(obj->cur->geometry.x == x &&
|
|
|
|
obj->cur->geometry.y == y &&
|
|
|
|
obj->cur->geometry.w == w &&
|
|
|
|
obj->cur->geometry.h == h))
|
2014-03-12 07:28:40 -07:00
|
|
|
CRI("Evas_Image_Data geometry did change during pixels get callback !");
|
2013-08-07 02:40:42 -07:00
|
|
|
|
2014-10-22 02:34:51 -07:00
|
|
|
o->engine_data = ENFN->image_dirty_region
|
|
|
|
(ENDT, o->engine_data,
|
2013-07-15 03:11:06 -07:00
|
|
|
0, 0, o->cur->image.w, o->cur->image.h);
|
|
|
|
if (o->engine_data != pixels)
|
|
|
|
pixels = o->engine_data;
|
|
|
|
}
|
|
|
|
o->dirty_pixels = EINA_FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Check if the it's not dirty but it has direct rendering
|
2015-03-02 23:38:52 -08:00
|
|
|
if (o->direct_render && ENFN->image_native_get)
|
2013-07-15 03:11:06 -07:00
|
|
|
{
|
2015-03-02 23:38:52 -08:00
|
|
|
Evas_Native_Surface *ns;
|
|
|
|
ns = ENFN->image_native_get(output, o->engine_data);
|
|
|
|
if (ENFN->gl_direct_override_get)
|
|
|
|
ENFN->gl_direct_override_get(output, &direct_override, &direct_force_off);
|
|
|
|
if (ENFN->gl_surface_direct_renderable_get)
|
2015-04-14 04:41:56 -07:00
|
|
|
ENFN->gl_surface_direct_renderable_get(output, ns, &direct_override, surface);
|
2015-03-02 23:38:52 -08:00
|
|
|
|
|
|
|
if (direct_override && !direct_force_off)
|
|
|
|
{
|
|
|
|
// always use direct rendering
|
2015-07-19 23:24:04 -07:00
|
|
|
if (ENFN->gl_get_pixels_set)
|
|
|
|
ENFN->gl_get_pixels_set(output, o->pixels->func.get_pixels, o->pixels->func.get_pixels_data, eo_obj);
|
|
|
|
if (ENFN->gl_image_direct_set)
|
|
|
|
ENFN->gl_image_direct_set(output, o->engine_data, EINA_TRUE);
|
2015-03-02 23:38:52 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Auto-fallback to FBO rendering (for perf & power consumption)
|
2015-03-03 03:08:16 -08:00
|
|
|
if (ENFN->gl_get_pixels_pre)
|
|
|
|
ENFN->gl_get_pixels_pre(output);
|
2015-03-02 23:38:52 -08:00
|
|
|
o->pixels->func.get_pixels(o->pixels->func.get_pixels_data, obj->object);
|
2015-03-03 03:08:16 -08:00
|
|
|
if (ENFN->gl_get_pixels_post)
|
|
|
|
ENFN->gl_get_pixels_post(output);
|
2015-03-02 23:38:52 -08:00
|
|
|
o->direct_render = EINA_FALSE;
|
|
|
|
}
|
2013-07-15 03:11:06 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return pixels;
|
|
|
|
}
|
|
|
|
|
2016-01-12 22:19:07 -08:00
|
|
|
EOLIAN static void
|
2016-03-01 21:41:32 -08:00
|
|
|
_evas_image_evas_filter_filter_dirty(Eo *eo_obj, Evas_Image_Data *o)
|
2015-06-18 05:45:21 -07:00
|
|
|
{
|
2016-03-01 21:41:32 -08:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
|
|
|
|
2015-06-18 05:45:21 -07:00
|
|
|
o->changed = 1;
|
2016-03-01 21:41:32 -08:00
|
|
|
evas_object_change(eo_obj, obj);
|
2015-06-18 05:45:21 -07:00
|
|
|
}
|
|
|
|
|
2016-01-12 22:19:07 -08:00
|
|
|
EOLIAN static Eina_Bool
|
2016-02-28 22:23:18 -08:00
|
|
|
_evas_image_evas_filter_filter_input_alpha(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o EINA_UNUSED)
|
2014-03-21 01:03:33 -07:00
|
|
|
{
|
2015-06-18 05:45:21 -07:00
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2016-03-01 23:38:57 -08:00
|
|
|
EOLIAN static void
|
2016-03-03 22:57:36 -08:00
|
|
|
_evas_image_efl_gfx_filter_filter_program_set(Eo *obj, Evas_Image_Data *pd,
|
2016-03-01 23:38:57 -08:00
|
|
|
const char *code, const char *name)
|
|
|
|
{
|
|
|
|
pd->has_filter = (code != NULL);
|
|
|
|
efl_gfx_filter_program_set(eo_super(obj, MY_CLASS), code, name);
|
|
|
|
}
|
|
|
|
|
2016-01-12 22:19:07 -08:00
|
|
|
EOLIAN static Eina_Bool
|
2016-02-28 22:23:18 -08:00
|
|
|
_evas_image_evas_filter_filter_input_render(Eo *eo_obj, Evas_Image_Data *o,
|
|
|
|
void *_filter, void *context,
|
|
|
|
int l, int r EINA_UNUSED, int t, int b EINA_UNUSED,
|
|
|
|
Eina_Bool do_async)
|
2015-06-18 05:45:21 -07:00
|
|
|
{
|
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
|
|
|
Evas_Filter_Context *filter = _filter;
|
|
|
|
void *surface, *output;
|
|
|
|
Eina_Bool input_stolen;
|
|
|
|
int W, H;
|
|
|
|
|
|
|
|
W = obj->cur->geometry.w;
|
|
|
|
H = obj->cur->geometry.h;
|
|
|
|
output = ENDT;
|
2014-03-21 01:03:33 -07:00
|
|
|
|
2015-06-18 05:45:21 -07:00
|
|
|
if (ENFN->gl_surface_read_pixels)
|
|
|
|
{
|
|
|
|
surface = ENFN->image_map_surface_new(output, W, H, EINA_TRUE);
|
|
|
|
input_stolen = EINA_FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
surface = evas_filter_buffer_backing_steal(filter, EVAS_FILTER_BUFFER_INPUT_ID);
|
|
|
|
input_stolen = EINA_TRUE;
|
|
|
|
}
|
|
|
|
if (!o->filled)
|
|
|
|
{
|
|
|
|
l = 0;
|
|
|
|
t = 0;
|
2015-10-01 03:59:22 -07:00
|
|
|
r = 0;
|
|
|
|
b = 0;
|
2015-06-18 05:45:21 -07:00
|
|
|
}
|
2014-03-21 01:03:33 -07:00
|
|
|
|
2015-06-18 05:45:21 -07:00
|
|
|
if (!surface)
|
2014-03-21 01:03:33 -07:00
|
|
|
{
|
2015-06-18 05:45:21 -07:00
|
|
|
ERR("Failed to allocate surface for filter input!");
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2014-03-21 01:03:33 -07:00
|
|
|
|
2015-06-18 05:45:21 -07:00
|
|
|
ENFN->context_color_set(output, context, 0, 0, 0, 0);
|
|
|
|
ENFN->context_render_op_set(output, context, EVAS_RENDER_COPY);
|
|
|
|
ENFN->rectangle_draw(output, context, surface, 0, 0, W, H, EINA_FALSE);
|
|
|
|
ENFN->context_color_set(output, context, 255, 255, 255, 255);
|
|
|
|
ENFN->context_render_op_set(output, context, EVAS_RENDER_BLEND);
|
2014-03-21 01:03:33 -07:00
|
|
|
|
2015-06-18 05:45:21 -07:00
|
|
|
_evas_image_render(eo_obj, obj, output, context, surface,
|
2015-10-01 03:59:22 -07:00
|
|
|
l - obj->cur->geometry.x, t - obj->cur->geometry.y,
|
|
|
|
l, t, r, b, do_async);
|
2015-06-18 05:45:21 -07:00
|
|
|
|
|
|
|
if (!input_stolen)
|
|
|
|
{
|
|
|
|
evas_filter_image_draw(filter, context, EVAS_FILTER_BUFFER_INPUT_ID, surface, do_async);
|
2015-07-01 20:04:02 -07:00
|
|
|
ENFN->image_free(output, surface);
|
2014-03-21 01:03:33 -07:00
|
|
|
}
|
2015-06-18 05:45:21 -07:00
|
|
|
else
|
|
|
|
evas_filter_buffer_backing_release(filter, surface);
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
2014-03-21 01:03:33 -07:00
|
|
|
}
|
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
static void
|
2013-07-08 17:46:15 -07:00
|
|
|
evas_object_image_render(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, void *type_private_data,
|
|
|
|
void *output, void *context, void *surface, int x, int y, Eina_Bool do_async)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2014-03-12 07:28:40 -07:00
|
|
|
Evas_Image_Data *o = type_private_data;
|
2002-11-08 00:02:15 -08:00
|
|
|
|
2013-01-27 16:28:53 -08:00
|
|
|
if ((o->cur->fill.w < 1) || (o->cur->fill.h < 1))
|
2008-12-09 14:46:57 -08:00
|
|
|
return; /* no error message, already printed in pre_render */
|
|
|
|
|
2011-02-06 20:18:37 -08:00
|
|
|
/* Proxy sanity */
|
|
|
|
if (o->proxyrendering)
|
|
|
|
{
|
2016-03-07 21:11:07 -08:00
|
|
|
_evas_image_proxy_error(eo_obj, context, output, surface, x, y, EINA_FALSE);
|
2011-02-06 20:18:37 -08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-02-02 22:38:50 -08:00
|
|
|
/* Mask sanity */
|
|
|
|
if (obj->mask->is_mask && (surface != obj->mask->surface))
|
|
|
|
{
|
|
|
|
ERR("Drawing a mask to another surface? Something's wrong...");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-10-02 20:28:52 -07:00
|
|
|
/* We are displaying the overlay */
|
|
|
|
if (o->video_visible)
|
|
|
|
{
|
|
|
|
/* Create a transparent rectangle */
|
2014-10-22 02:34:51 -07:00
|
|
|
ENFN->context_color_set(output, context, 0, 0, 0, 0);
|
|
|
|
ENFN->context_multiplier_unset(output, context);
|
|
|
|
ENFN->context_render_op_set(output, context, EVAS_RENDER_COPY);
|
|
|
|
ENFN->rectangle_draw(output, context, surface,
|
|
|
|
obj->cur->geometry.x + x, obj->cur->geometry.y + y,
|
|
|
|
obj->cur->geometry.w, obj->cur->geometry.h,
|
|
|
|
do_async);
|
2011-10-02 20:28:52 -07:00
|
|
|
|
2012-12-18 08:28:55 -08:00
|
|
|
return;
|
2011-10-02 20:28:52 -07:00
|
|
|
}
|
2011-02-06 20:18:37 -08:00
|
|
|
|
2014-10-22 02:34:51 -07:00
|
|
|
ENFN->context_color_set(output, context, 255, 255, 255, 255);
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2013-03-12 05:58:19 -07:00
|
|
|
if ((obj->cur->cache.clip.r == 255) &&
|
|
|
|
(obj->cur->cache.clip.g == 255) &&
|
|
|
|
(obj->cur->cache.clip.b == 255) &&
|
|
|
|
(obj->cur->cache.clip.a == 255))
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2014-10-22 02:34:51 -07:00
|
|
|
ENFN->context_multiplier_unset(output, context);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
else
|
2014-10-22 02:34:51 -07:00
|
|
|
ENFN->context_multiplier_set(output, context,
|
|
|
|
obj->cur->cache.clip.r,
|
|
|
|
obj->cur->cache.clip.g,
|
|
|
|
obj->cur->cache.clip.b,
|
|
|
|
obj->cur->cache.clip.a);
|
2006-05-02 00:28:49 -07:00
|
|
|
|
2014-10-22 02:34:51 -07:00
|
|
|
ENFN->context_render_op_set(output, context, obj->cur->render_op);
|
2011-02-06 20:18:37 -08:00
|
|
|
|
2013-07-15 03:11:06 -07:00
|
|
|
// Clear out the pixel get stuff..
|
2014-10-22 02:34:51 -07:00
|
|
|
if (ENFN->gl_get_pixels_set)
|
2015-03-02 23:38:52 -08:00
|
|
|
ENFN->gl_get_pixels_set(output, NULL, NULL, NULL);
|
|
|
|
if (ENFN->gl_image_direct_set)
|
|
|
|
ENFN->gl_image_direct_set(output, o->engine_data, EINA_FALSE);
|
2013-07-15 03:11:06 -07:00
|
|
|
|
2015-06-18 05:45:21 -07:00
|
|
|
/* Render filter */
|
|
|
|
if (o->has_filter)
|
|
|
|
{
|
|
|
|
if (evas_filter_object_render(eo_obj, obj, output, context, surface, x, y, do_async, EINA_FALSE))
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-10-01 03:59:22 -07:00
|
|
|
_evas_image_render(eo_obj, obj, output, context, surface, x, y, 0, 0, 0, 0, do_async);
|
2015-06-18 05:45:21 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_evas_image_render(Eo *eo_obj, Evas_Object_Protected_Data *obj,
|
2015-10-01 03:59:22 -07:00
|
|
|
void *output, void *context, void *surface, int x, int y,
|
|
|
|
int l, int t, int r, int b, Eina_Bool do_async)
|
2015-06-18 05:45:21 -07:00
|
|
|
{
|
2015-10-07 19:19:50 -07:00
|
|
|
Evas_Image_Data *o = obj->private_data, *oi = NULL;
|
2015-10-13 06:13:48 -07:00
|
|
|
int imagew, imageh, uvw, uvh, cw, ch;
|
2015-06-18 05:45:21 -07:00
|
|
|
void *pixels;
|
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
Evas_Object_Protected_Data *source =
|
2013-01-27 16:28:53 -08:00
|
|
|
(o->cur->source ?
|
2014-06-02 06:47:59 -07:00
|
|
|
eo_data_scope_get(o->cur->source, EVAS_OBJECT_CLASS):
|
2012-10-08 18:58:41 -07:00
|
|
|
NULL);
|
2015-10-07 19:19:50 -07:00
|
|
|
if (source && (source->type == o_type))
|
|
|
|
oi = eo_data_scope_get(o->cur->source, MY_CLASS);
|
2013-12-26 23:56:30 -08:00
|
|
|
|
|
|
|
if (o->cur->scene)
|
|
|
|
{
|
2016-03-07 21:11:07 -08:00
|
|
|
_evas_image_3d_render(obj->layer->evas->evas, eo_obj, obj, o, o->cur->scene);
|
2013-12-26 23:56:30 -08:00
|
|
|
pixels = obj->data_3d->surface;
|
|
|
|
imagew = obj->data_3d->w;
|
|
|
|
imageh = obj->data_3d->h;
|
|
|
|
uvw = imagew;
|
|
|
|
uvh = imageh;
|
|
|
|
}
|
2015-05-09 11:02:13 -07:00
|
|
|
else if (obj->cur->snapshot)
|
|
|
|
{
|
|
|
|
pixels = o->engine_data;
|
2015-10-07 04:03:37 -07:00
|
|
|
imagew = o->cur->image.w;
|
|
|
|
imageh = o->cur->image.h;
|
2015-05-09 11:02:13 -07:00
|
|
|
uvw = imagew;
|
|
|
|
uvh = imageh;
|
|
|
|
}
|
2015-10-13 19:19:48 -07:00
|
|
|
else if (!o->cur->source || !source)
|
2011-02-06 20:18:37 -08:00
|
|
|
{
|
2015-04-14 04:41:56 -07:00
|
|
|
pixels = evas_process_dirty_pixels(eo_obj, obj, o, output, surface, o->engine_data);
|
2013-07-15 03:11:06 -07:00
|
|
|
/* pixels = o->engine_data; */
|
2013-01-27 16:28:53 -08:00
|
|
|
imagew = o->cur->image.w;
|
|
|
|
imageh = o->cur->image.h;
|
2011-05-18 22:52:47 -07:00
|
|
|
uvw = imagew;
|
|
|
|
uvh = imageh;
|
2011-02-06 20:18:37 -08:00
|
|
|
}
|
2013-01-16 23:21:06 -08:00
|
|
|
else if (source->proxy->surface && !source->proxy->redraw)
|
2011-02-06 20:18:37 -08:00
|
|
|
{
|
2013-01-16 23:21:06 -08:00
|
|
|
pixels = source->proxy->surface;
|
|
|
|
imagew = source->proxy->w;
|
|
|
|
imageh = source->proxy->h;
|
2011-05-18 22:52:47 -07:00
|
|
|
uvw = imagew;
|
|
|
|
uvh = imageh;
|
2011-02-06 20:18:37 -08:00
|
|
|
}
|
2015-10-07 19:19:50 -07:00
|
|
|
else if (oi && oi->engine_data)
|
2011-02-06 20:18:37 -08:00
|
|
|
{
|
|
|
|
pixels = oi->engine_data;
|
2015-10-07 19:19:50 -07:00
|
|
|
if (oi->has_filter)
|
|
|
|
{
|
2015-10-13 19:19:48 -07:00
|
|
|
void *output_buffer = NULL;
|
2016-03-01 10:06:28 -08:00
|
|
|
output_buffer = evas_filter_output_buffer_get(source->object);
|
2015-10-07 19:19:50 -07:00
|
|
|
if (output_buffer)
|
|
|
|
pixels = output_buffer;
|
|
|
|
}
|
2013-01-27 16:28:53 -08:00
|
|
|
imagew = oi->cur->image.w;
|
|
|
|
imageh = oi->cur->image.h;
|
2013-03-12 05:58:19 -07:00
|
|
|
uvw = source->cur->geometry.w;
|
|
|
|
uvh = source->cur->geometry.h;
|
2015-10-13 06:13:48 -07:00
|
|
|
/* check source_clip since we skip proxy_subrender here */
|
|
|
|
if (o->proxy_src_clip)
|
|
|
|
{
|
|
|
|
ENFN->context_clip_clip(ENDT, context,
|
|
|
|
source->cur->cache.clip.x + x,
|
|
|
|
source->cur->cache.clip.y + y,
|
|
|
|
source->cur->cache.clip.w,
|
|
|
|
source->cur->cache.clip.h);
|
|
|
|
}
|
2011-02-06 20:18:37 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-09-04 01:56:46 -07:00
|
|
|
o->proxyrendering = EINA_TRUE;
|
2014-10-22 23:27:40 -07:00
|
|
|
evas_render_proxy_subrender(obj->layer->evas->evas, o->cur->source,
|
|
|
|
eo_obj, obj, EINA_FALSE);
|
2013-01-16 23:21:06 -08:00
|
|
|
pixels = source->proxy->surface;
|
|
|
|
imagew = source->proxy->w;
|
|
|
|
imageh = source->proxy->h;
|
2011-05-18 22:52:47 -07:00
|
|
|
uvw = imagew;
|
|
|
|
uvh = imageh;
|
2012-09-04 01:56:46 -07:00
|
|
|
o->proxyrendering = EINA_FALSE;
|
2011-02-06 20:18:37 -08:00
|
|
|
}
|
|
|
|
|
2015-10-23 00:29:40 -07:00
|
|
|
if (ENFN->context_clip_get(ENDT, context, NULL, NULL, &cw, &ch) && (!cw || !ch))
|
|
|
|
return;
|
2015-10-13 06:13:48 -07:00
|
|
|
|
2011-02-06 20:18:37 -08:00
|
|
|
if (pixels)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2012-09-04 01:42:38 -07:00
|
|
|
Evas_Coord idw, idh, idx, idy;
|
|
|
|
int ix, iy, iw, ih;
|
2013-06-17 01:53:33 -07:00
|
|
|
|
2013-01-21 19:56:00 -08:00
|
|
|
if ((obj->map->cur.map) && (obj->map->cur.map->count > 3) && (obj->map->cur.usemap))
|
2009-10-20 09:03:57 -07:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_map_update(eo_obj, x, y, imagew, imageh, uvw, uvh);
|
2011-02-06 15:52:17 -08:00
|
|
|
|
2013-01-11 11:56:17 -08:00
|
|
|
evas_draw_image_map_async_check(
|
2013-01-21 19:56:00 -08:00
|
|
|
obj, output, context, surface, pixels, obj->map->spans,
|
2013-01-27 16:28:53 -08:00
|
|
|
o->cur->smooth_scale | obj->map->cur.map->smooth, 0, do_async);
|
2009-10-20 09:03:57 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-06-18 05:45:21 -07:00
|
|
|
int offx, offy;
|
|
|
|
|
2014-10-22 02:34:51 -07:00
|
|
|
ENFN->image_scale_hint_set(output, pixels, o->scale_hint);
|
2011-02-12 16:27:03 -08:00
|
|
|
/* This is technically a bug here: If the value is recreated
|
|
|
|
* (which is returned)it may be a new object, however exactly 0
|
|
|
|
* of all the evas engines do this. */
|
2014-10-22 02:34:51 -07:00
|
|
|
ENFN->image_border_set(output, pixels,
|
|
|
|
o->cur->border.l, o->cur->border.r,
|
|
|
|
o->cur->border.t, o->cur->border.b);
|
2013-01-27 16:28:53 -08:00
|
|
|
idx = evas_object_image_figure_x_fill(eo_obj, obj, o->cur->fill.x, o->cur->fill.w, &idw);
|
|
|
|
idy = evas_object_image_figure_y_fill(eo_obj, obj, o->cur->fill.y, o->cur->fill.h, &idh);
|
2009-10-20 09:03:57 -07:00
|
|
|
if (idw < 1) idw = 1;
|
|
|
|
if (idh < 1) idh = 1;
|
|
|
|
if (idx > 0) idx -= idw;
|
|
|
|
if (idy > 0) idy -= idh;
|
2014-03-17 00:10:03 -07:00
|
|
|
|
|
|
|
offx = obj->cur->geometry.x + x;
|
|
|
|
offy = obj->cur->geometry.y + y;
|
|
|
|
|
2013-03-12 05:58:19 -07:00
|
|
|
while ((int)idx < obj->cur->geometry.w)
|
2009-10-20 09:03:57 -07:00
|
|
|
{
|
|
|
|
Evas_Coord ydy;
|
|
|
|
int dobreak_w = 0;
|
2012-09-04 01:42:38 -07:00
|
|
|
|
2009-10-20 09:03:57 -07:00
|
|
|
ydy = idy;
|
|
|
|
ix = idx;
|
2013-03-12 05:58:19 -07:00
|
|
|
if ((o->cur->fill.w == obj->cur->geometry.w) &&
|
2013-01-27 16:28:53 -08:00
|
|
|
(o->cur->fill.x == 0))
|
2009-10-20 09:03:57 -07:00
|
|
|
{
|
|
|
|
dobreak_w = 1;
|
2013-03-12 05:58:19 -07:00
|
|
|
iw = obj->cur->geometry.w;
|
2009-10-20 09:03:57 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
iw = ((int)(idx + idw)) - ix;
|
2014-03-17 00:10:03 -07:00
|
|
|
|
2014-03-19 19:10:43 -07:00
|
|
|
// Filter stuff
|
|
|
|
if (o->filled)
|
2014-03-20 02:24:38 -07:00
|
|
|
{
|
|
|
|
iw -= l + r;
|
|
|
|
if (iw <= 0) break;
|
|
|
|
}
|
2014-03-17 00:10:03 -07:00
|
|
|
|
2013-03-12 05:58:19 -07:00
|
|
|
while ((int)idy < obj->cur->geometry.h)
|
2009-10-20 09:03:57 -07:00
|
|
|
{
|
|
|
|
int dobreak_h = 0;
|
2012-09-04 01:42:38 -07:00
|
|
|
|
2009-10-20 09:03:57 -07:00
|
|
|
iy = idy;
|
2013-03-12 05:58:19 -07:00
|
|
|
if ((o->cur->fill.h == obj->cur->geometry.h) &&
|
2013-01-27 16:28:53 -08:00
|
|
|
(o->cur->fill.y == 0))
|
2009-10-20 09:03:57 -07:00
|
|
|
{
|
2013-03-12 05:58:19 -07:00
|
|
|
ih = obj->cur->geometry.h;
|
2009-10-20 09:03:57 -07:00
|
|
|
dobreak_h = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ih = ((int)(idy + idh)) - iy;
|
2014-03-19 19:10:43 -07:00
|
|
|
|
|
|
|
// Filter stuff
|
|
|
|
if (o->filled)
|
2014-03-20 02:24:38 -07:00
|
|
|
{
|
|
|
|
ih -= t + b;
|
|
|
|
if (ih <= 0) break;
|
|
|
|
}
|
2014-03-19 19:10:43 -07:00
|
|
|
|
2013-01-27 16:28:53 -08:00
|
|
|
if ((o->cur->border.l == 0) &&
|
|
|
|
(o->cur->border.r == 0) &&
|
|
|
|
(o->cur->border.t == 0) &&
|
|
|
|
(o->cur->border.b == 0) &&
|
|
|
|
(o->cur->border.fill != 0))
|
2012-11-27 10:23:25 -08:00
|
|
|
{
|
2013-09-23 01:51:06 -07:00
|
|
|
_draw_image
|
|
|
|
(obj, output, context, surface, pixels,
|
|
|
|
0, 0,
|
|
|
|
imagew, imageh,
|
2014-03-17 00:10:03 -07:00
|
|
|
offx + ix,
|
|
|
|
offy + iy,
|
2013-09-23 01:51:06 -07:00
|
|
|
iw, ih,
|
|
|
|
o->cur->smooth_scale,
|
|
|
|
do_async);
|
2012-11-27 10:23:25 -08:00
|
|
|
}
|
2009-10-20 09:03:57 -07:00
|
|
|
else
|
|
|
|
{
|
|
|
|
int inx, iny, inw, inh, outx, outy, outw, outh;
|
2010-02-20 22:21:15 -08:00
|
|
|
int bl, br, bt, bb, bsl, bsr, bst, bsb;
|
2009-10-20 09:03:57 -07:00
|
|
|
int imw, imh, ox, oy;
|
2012-09-04 01:42:38 -07:00
|
|
|
|
2014-03-17 00:10:03 -07:00
|
|
|
ox = offx + ix;
|
|
|
|
oy = offy + iy;
|
2011-02-06 20:18:37 -08:00
|
|
|
imw = imagew;
|
|
|
|
imh = imageh;
|
2013-01-27 16:28:53 -08:00
|
|
|
bl = o->cur->border.l;
|
|
|
|
br = o->cur->border.r;
|
|
|
|
bt = o->cur->border.t;
|
|
|
|
bb = o->cur->border.b;
|
2013-08-10 00:26:30 -07:00
|
|
|
// fix impossible border settings if img pixels not enough
|
|
|
|
if ((bl + br) > imw)
|
2009-02-14 18:53:24 -08:00
|
|
|
{
|
2013-08-10 00:26:30 -07:00
|
|
|
if ((bl + br) > 0)
|
|
|
|
{
|
|
|
|
bl = (bl * imw) / (bl + br);
|
|
|
|
br = imw - bl;
|
|
|
|
}
|
2009-10-20 09:03:57 -07:00
|
|
|
}
|
2013-08-10 00:26:30 -07:00
|
|
|
if ((bt + bb) > imh)
|
2009-10-20 09:03:57 -07:00
|
|
|
{
|
2013-08-10 00:26:30 -07:00
|
|
|
if ((bt + bb) > 0)
|
|
|
|
{
|
|
|
|
bt = (bt * imh) / (bt + bb);
|
|
|
|
bb = imh - bt;
|
|
|
|
}
|
2009-10-20 09:03:57 -07:00
|
|
|
}
|
2013-01-27 16:28:53 -08:00
|
|
|
if (o->cur->border.scale != 1.0)
|
2010-02-20 22:21:15 -08:00
|
|
|
{
|
2013-01-27 16:28:53 -08:00
|
|
|
bsl = ((double)bl * o->cur->border.scale);
|
|
|
|
bsr = ((double)br * o->cur->border.scale);
|
|
|
|
bst = ((double)bt * o->cur->border.scale);
|
|
|
|
bsb = ((double)bb * o->cur->border.scale);
|
2010-02-20 22:21:15 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
bsl = bl; bsr = br; bst = bt; bsb = bb;
|
|
|
|
}
|
2013-08-10 00:26:30 -07:00
|
|
|
// adjust output border rendering if it doesnt fit
|
|
|
|
if ((bsl + bsr) > iw)
|
|
|
|
{
|
|
|
|
int b0 = bsl, b1 = bsr;
|
|
|
|
|
|
|
|
if ((bsl + bsr) > 0)
|
|
|
|
{
|
|
|
|
bsl = (bsl * iw) / (bsl + bsr);
|
|
|
|
bsr = iw - bsl;
|
|
|
|
}
|
|
|
|
if (b0 > 0) bl = (bl * bsl) / b0;
|
|
|
|
else bl = 0;
|
|
|
|
if (b1 > 0) br = (br * bsr) / b1;
|
|
|
|
else br = 0;
|
|
|
|
}
|
|
|
|
if ((bst + bsb) > ih)
|
|
|
|
{
|
|
|
|
int b0 = bst, b1 = bsb;
|
|
|
|
|
|
|
|
if ((bst + bsb) > 0)
|
|
|
|
{
|
|
|
|
bst = (bst * ih) / (bst + bsb);
|
|
|
|
bsb = ih - bst;
|
|
|
|
}
|
|
|
|
if (b0 > 0) bt = (bt * bst) / b0;
|
|
|
|
else bt = 0;
|
|
|
|
if (b1 > 0) bb = (bb * bsb) / b1;
|
|
|
|
else bb = 0;
|
|
|
|
}
|
2014-03-19 19:13:32 -07:00
|
|
|
// #--.
|
|
|
|
// | |
|
|
|
|
// '--'
|
2009-10-20 09:03:57 -07:00
|
|
|
inx = 0; iny = 0;
|
|
|
|
inw = bl; inh = bt;
|
|
|
|
outx = ox; outy = oy;
|
2010-02-20 22:21:15 -08:00
|
|
|
outw = bsl; outh = bst;
|
2013-01-27 16:28:53 -08:00
|
|
|
_draw_image(obj, output, context, surface, pixels, inx, iny, inw, inh, outx, outy, outw, outh, o->cur->smooth_scale, do_async);
|
2014-03-19 19:13:32 -07:00
|
|
|
// .##.
|
|
|
|
// | |
|
|
|
|
// '--'
|
2009-10-20 09:03:57 -07:00
|
|
|
inx = bl; iny = 0;
|
|
|
|
inw = imw - bl - br; inh = bt;
|
2010-02-20 22:21:15 -08:00
|
|
|
outx = ox + bsl; outy = oy;
|
|
|
|
outw = iw - bsl - bsr; outh = bst;
|
2013-01-27 16:28:53 -08:00
|
|
|
_draw_image(obj, output, context, surface, pixels, inx, iny, inw, inh, outx, outy, outw, outh, o->cur->smooth_scale, do_async);
|
2014-03-19 19:13:32 -07:00
|
|
|
// .--#
|
|
|
|
// | |
|
|
|
|
// '--'
|
2009-10-20 09:03:57 -07:00
|
|
|
inx = imw - br; iny = 0;
|
|
|
|
inw = br; inh = bt;
|
2010-02-20 22:21:15 -08:00
|
|
|
outx = ox + iw - bsr; outy = oy;
|
|
|
|
outw = bsr; outh = bst;
|
2013-01-27 16:28:53 -08:00
|
|
|
_draw_image(obj, output, context, surface, pixels, inx, iny, inw, inh, outx, outy, outw, outh, o->cur->smooth_scale, do_async);
|
2014-03-19 19:13:32 -07:00
|
|
|
// .--.
|
|
|
|
// # |
|
|
|
|
// '--'
|
2009-10-20 09:03:57 -07:00
|
|
|
inx = 0; iny = bt;
|
|
|
|
inw = bl; inh = imh - bt - bb;
|
2010-02-20 22:21:15 -08:00
|
|
|
outx = ox; outy = oy + bst;
|
|
|
|
outw = bsl; outh = ih - bst - bsb;
|
2013-01-27 16:28:53 -08:00
|
|
|
_draw_image(obj, output, context, surface, pixels, inx, iny, inw, inh, outx, outy, outw, outh, o->cur->smooth_scale, do_async);
|
2010-02-20 22:21:15 -08:00
|
|
|
// .--.
|
|
|
|
// |##|
|
2014-03-19 19:13:32 -07:00
|
|
|
// '--'
|
2013-01-27 16:28:53 -08:00
|
|
|
if (o->cur->border.fill > EVAS_BORDER_FILL_NONE)
|
2009-10-20 09:03:57 -07:00
|
|
|
{
|
|
|
|
inx = bl; iny = bt;
|
|
|
|
inw = imw - bl - br; inh = imh - bt - bb;
|
2010-02-20 22:21:15 -08:00
|
|
|
outx = ox + bsl; outy = oy + bst;
|
|
|
|
outw = iw - bsl - bsr; outh = ih - bst - bsb;
|
2013-01-27 16:28:53 -08:00
|
|
|
if ((o->cur->border.fill == EVAS_BORDER_FILL_SOLID) &&
|
2013-03-12 05:58:19 -07:00
|
|
|
(obj->cur->cache.clip.a == 255) &&
|
2015-01-23 00:02:40 -08:00
|
|
|
(!obj->clip.mask) &&
|
2013-03-12 05:58:19 -07:00
|
|
|
(obj->cur->render_op == EVAS_RENDER_BLEND))
|
2009-10-20 09:03:57 -07:00
|
|
|
{
|
2014-10-22 02:34:51 -07:00
|
|
|
ENFN->context_render_op_set(output, context, EVAS_RENDER_COPY);
|
2013-01-27 16:28:53 -08:00
|
|
|
_draw_image(obj, output, context, surface, pixels, inx, iny, inw, inh, outx, outy, outw, outh, o->cur->smooth_scale, do_async);
|
2014-10-22 02:34:51 -07:00
|
|
|
ENFN->context_render_op_set(output, context, obj->cur->render_op);
|
2009-10-20 09:03:57 -07:00
|
|
|
}
|
|
|
|
else
|
2013-01-27 16:28:53 -08:00
|
|
|
_draw_image(obj, output, context, surface, pixels, inx, iny, inw, inh, outx, outy, outw, outh, o->cur->smooth_scale, do_async);
|
2009-10-20 09:03:57 -07:00
|
|
|
}
|
2014-03-19 19:13:32 -07:00
|
|
|
// .--.
|
|
|
|
// | #
|
|
|
|
// '--'
|
2009-10-20 09:03:57 -07:00
|
|
|
inx = imw - br; iny = bt;
|
|
|
|
inw = br; inh = imh - bt - bb;
|
2010-02-20 22:21:15 -08:00
|
|
|
outx = ox + iw - bsr; outy = oy + bst;
|
|
|
|
outw = bsr; outh = ih - bst - bsb;
|
2013-01-27 16:28:53 -08:00
|
|
|
_draw_image(obj, output, context, surface, pixels, inx, iny, inw, inh, outx, outy, outw, outh, o->cur->smooth_scale, do_async);
|
2014-03-19 19:13:32 -07:00
|
|
|
// .--.
|
|
|
|
// | |
|
|
|
|
// #--'
|
2009-10-20 09:03:57 -07:00
|
|
|
inx = 0; iny = imh - bb;
|
|
|
|
inw = bl; inh = bb;
|
2010-02-20 22:21:15 -08:00
|
|
|
outx = ox; outy = oy + ih - bsb;
|
|
|
|
outw = bsl; outh = bsb;
|
2013-01-27 16:28:53 -08:00
|
|
|
_draw_image(obj, output, context, surface, pixels, inx, iny, inw, inh, outx, outy, outw, outh, o->cur->smooth_scale, do_async);
|
2014-03-19 19:13:32 -07:00
|
|
|
// .--.
|
|
|
|
// | |
|
|
|
|
// '##'
|
2009-10-20 09:03:57 -07:00
|
|
|
inx = bl; iny = imh - bb;
|
|
|
|
inw = imw - bl - br; inh = bb;
|
2010-02-20 22:21:15 -08:00
|
|
|
outx = ox + bsl; outy = oy + ih - bsb;
|
|
|
|
outw = iw - bsl - bsr; outh = bsb;
|
2013-01-27 16:28:53 -08:00
|
|
|
_draw_image(obj, output, context, surface, pixels, inx, iny, inw, inh, outx, outy, outw, outh, o->cur->smooth_scale, do_async);
|
2014-03-19 19:13:32 -07:00
|
|
|
// .--.
|
|
|
|
// | |
|
|
|
|
// '--#
|
2009-10-20 09:03:57 -07:00
|
|
|
inx = imw - br; iny = imh - bb;
|
|
|
|
inw = br; inh = bb;
|
2010-02-20 22:21:15 -08:00
|
|
|
outx = ox + iw - bsr; outy = oy + ih - bsb;
|
|
|
|
outw = bsr; outh = bsb;
|
2013-01-27 16:28:53 -08:00
|
|
|
_draw_image(obj, output, context, surface, pixels, inx, iny, inw, inh, outx, outy, outw, outh, o->cur->smooth_scale, do_async);
|
2009-10-20 09:03:57 -07:00
|
|
|
}
|
|
|
|
idy += idh;
|
|
|
|
if (dobreak_h) break;
|
|
|
|
}
|
|
|
|
idx += idw;
|
|
|
|
idy = ydy;
|
|
|
|
if (dobreak_w) break;
|
|
|
|
}
|
2012-01-20 04:29:14 -08:00
|
|
|
}
|
2013-06-17 02:22:15 -07:00
|
|
|
}
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-07-08 17:46:15 -07:00
|
|
|
evas_object_image_render_pre(Evas_Object *eo_obj,
|
|
|
|
Evas_Object_Protected_Data *obj,
|
|
|
|
void *type_private_data)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2014-03-12 07:28:40 -07:00
|
|
|
Evas_Image_Data *o = type_private_data;
|
2011-05-21 15:28:13 -07:00
|
|
|
int is_v = 0, was_v = 0;
|
2002-11-08 00:02:15 -08:00
|
|
|
|
|
|
|
/* dont pre-render the obj twice! */
|
|
|
|
if (obj->pre_render_done) return;
|
2013-01-02 21:38:03 -08:00
|
|
|
obj->pre_render_done = EINA_TRUE;
|
2002-11-08 00:02:15 -08:00
|
|
|
/* pre-render phase. this does anything an object needs to do just before */
|
|
|
|
/* rendering. this could mean loading the image data, retrieving it from */
|
|
|
|
/* elsewhere, decoding video etc. */
|
|
|
|
/* then when this is done the object needs to figure if it changed and */
|
2004-02-16 11:22:48 -08:00
|
|
|
/* if so what and where and add the appropriate redraw rectangles */
|
2012-10-08 18:58:41 -07:00
|
|
|
Evas_Public_Data *e = obj->layer->evas;
|
2008-12-09 14:46:57 -08:00
|
|
|
|
2015-02-11 19:10:04 -08:00
|
|
|
if ((o->cur->fill.w < 1) || (o->cur->fill.h < 1)) return;
|
2008-12-09 14:46:57 -08:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
/* if someone is clipping this obj - go calculate the clipper */
|
2013-03-12 05:58:19 -07:00
|
|
|
if (obj->cur->clipper)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2013-03-12 05:58:19 -07:00
|
|
|
if (obj->cur->cache.clip.dirty)
|
2013-04-06 22:00:10 -07:00
|
|
|
evas_object_clip_recalc(obj->cur->clipper);
|
|
|
|
obj->cur->clipper->func->render_pre(obj->cur->clipper->object,
|
2013-07-08 17:46:15 -07:00
|
|
|
obj->cur->clipper,
|
|
|
|
obj->cur->clipper->private_data);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
2011-02-06 20:18:37 -08:00
|
|
|
/* Proxy: Do it early */
|
2013-01-27 16:28:53 -08:00
|
|
|
if (o->cur->source)
|
2011-02-06 20:18:37 -08:00
|
|
|
{
|
2014-06-02 06:47:59 -07:00
|
|
|
Evas_Object_Protected_Data *source = eo_data_scope_get(o->cur->source, EVAS_OBJECT_CLASS);
|
2013-01-16 23:21:06 -08:00
|
|
|
if (source->proxy->redraw || source->changed)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
|
|
|
/* XXX: Do I need to sort out the map here? */
|
|
|
|
evas_object_render_pre_prev_cur_add(&e->clip_changes, eo_obj, obj);
|
|
|
|
goto done;
|
|
|
|
}
|
2011-02-06 20:18:37 -08:00
|
|
|
}
|
2013-12-26 23:56:30 -08:00
|
|
|
else if (o->cur->scene)
|
|
|
|
{
|
2015-06-17 07:31:14 -07:00
|
|
|
Evas_Canvas3D_Scene *scene = o->cur->scene;
|
2014-04-25 10:28:38 -07:00
|
|
|
Eina_Bool dirty;
|
|
|
|
|
2016-03-01 10:06:28 -08:00
|
|
|
dirty = evas_canvas3d_object_dirty_get(scene, EVAS_CANVAS3D_STATE_ANY);
|
2014-04-25 10:28:38 -07:00
|
|
|
if (dirty)
|
2013-12-26 23:56:30 -08:00
|
|
|
{
|
|
|
|
evas_object_render_pre_prev_cur_add(&e->clip_changes, eo_obj, obj);
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
}
|
2011-02-06 20:18:37 -08:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
/* now figure what changed and add draw rects */
|
|
|
|
/* if it just became visible or invisible */
|
2012-10-08 18:58:41 -07:00
|
|
|
is_v = evas_object_is_visible(eo_obj, obj);
|
|
|
|
was_v = evas_object_was_visible(eo_obj, obj);
|
2002-11-08 00:02:15 -08:00
|
|
|
if (is_v != was_v)
|
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_render_pre_visible_change(&e->clip_changes, eo_obj, is_v, was_v);
|
2013-01-25 04:15:38 -08:00
|
|
|
if (!o->pixels->pixel_updates) goto done;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
2012-10-25 08:24:27 -07:00
|
|
|
if (obj->changed_map || obj->changed_src_visible)
|
2009-11-03 07:41:36 -08:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_render_pre_prev_cur_add(&e->clip_changes, eo_obj, obj);
|
2009-11-03 07:41:36 -08:00
|
|
|
goto done;
|
|
|
|
}
|
2004-02-16 11:22:48 -08:00
|
|
|
/* it's not visible - we accounted for it appearing or not so just abort */
|
2002-11-08 00:02:15 -08:00
|
|
|
if (!is_v) goto done;
|
|
|
|
/* clipper changed this is in addition to anything else for obj */
|
2013-04-13 13:36:28 -07:00
|
|
|
if (was_v)
|
2013-04-13 13:18:31 -07:00
|
|
|
evas_object_render_pre_clipper_change(&e->clip_changes, eo_obj);
|
2004-02-16 11:22:48 -08:00
|
|
|
/* if we restacked (layer or just within a layer) and don't clip anyone */
|
2002-11-08 00:02:15 -08:00
|
|
|
if (obj->restack)
|
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_render_pre_prev_cur_add(&e->clip_changes, eo_obj, obj);
|
2013-01-25 04:15:38 -08:00
|
|
|
if (!o->pixels->pixel_updates) goto done;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
/* if it changed color */
|
2013-03-12 05:58:19 -07:00
|
|
|
if ((obj->cur->color.r != obj->prev->color.r) ||
|
|
|
|
(obj->cur->color.g != obj->prev->color.g) ||
|
|
|
|
(obj->cur->color.b != obj->prev->color.b) ||
|
|
|
|
(obj->cur->color.a != obj->prev->color.a))
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_render_pre_prev_cur_add(&e->clip_changes, eo_obj, obj);
|
2013-01-25 04:15:38 -08:00
|
|
|
if (!o->pixels->pixel_updates) goto done;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
2006-05-02 00:28:49 -07:00
|
|
|
/* if it changed render op */
|
2013-03-12 05:58:19 -07:00
|
|
|
if (obj->cur->render_op != obj->prev->render_op)
|
2006-05-02 00:28:49 -07:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_render_pre_prev_cur_add(&e->clip_changes, eo_obj, obj);
|
2013-01-25 04:15:38 -08:00
|
|
|
if (!o->pixels->pixel_updates) goto done;
|
2006-05-02 00:28:49 -07:00
|
|
|
}
|
2006-09-30 03:18:37 -07:00
|
|
|
/* if it changed anti_alias */
|
2013-03-12 05:58:19 -07:00
|
|
|
if (obj->cur->anti_alias != obj->prev->anti_alias)
|
2006-09-30 03:18:37 -07:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_render_pre_prev_cur_add(&e->clip_changes, eo_obj, obj);
|
2013-01-25 04:15:38 -08:00
|
|
|
if (!o->pixels->pixel_updates) goto done;
|
2006-09-30 03:18:37 -07:00
|
|
|
}
|
2002-11-08 00:02:15 -08:00
|
|
|
if (o->changed)
|
|
|
|
{
|
2013-07-11 00:03:01 -07:00
|
|
|
if (((o->cur->u.file) && (!o->prev->u.file)) ||
|
|
|
|
((!o->cur->u.file) && (o->prev->u.file)) ||
|
2013-01-27 16:28:53 -08:00
|
|
|
((o->cur->key) && (!o->prev->key)) ||
|
|
|
|
((!o->cur->key) && (o->prev->key))
|
2012-09-04 01:42:38 -07:00
|
|
|
)
|
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_render_pre_prev_cur_add(&e->clip_changes, eo_obj, obj);
|
2013-01-25 04:15:38 -08:00
|
|
|
if (!o->pixels->pixel_updates) goto done;
|
2012-09-04 01:42:38 -07:00
|
|
|
}
|
2013-01-27 16:28:53 -08:00
|
|
|
if ((o->cur->image.w != o->prev->image.w) ||
|
|
|
|
(o->cur->image.h != o->prev->image.h) ||
|
|
|
|
(o->cur->has_alpha != o->prev->has_alpha) ||
|
|
|
|
(o->cur->cspace != o->prev->cspace) ||
|
|
|
|
(o->cur->smooth_scale != o->prev->smooth_scale))
|
2012-09-04 01:42:38 -07:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_render_pre_prev_cur_add(&e->clip_changes, eo_obj, obj);
|
2013-01-25 04:15:38 -08:00
|
|
|
if (!o->pixels->pixel_updates) goto done;
|
2012-09-04 01:42:38 -07:00
|
|
|
}
|
2013-01-27 16:28:53 -08:00
|
|
|
if ((o->cur->border.l != o->prev->border.l) ||
|
|
|
|
(o->cur->border.r != o->prev->border.r) ||
|
|
|
|
(o->cur->border.t != o->prev->border.t) ||
|
|
|
|
(o->cur->border.b != o->prev->border.b) ||
|
|
|
|
(o->cur->border.fill != o->prev->border.fill) ||
|
|
|
|
(o->cur->border.scale != o->prev->border.scale))
|
2012-09-04 01:42:38 -07:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_render_pre_prev_cur_add(&e->clip_changes, eo_obj, obj);
|
2013-01-25 04:15:38 -08:00
|
|
|
if (!o->pixels->pixel_updates) goto done;
|
2012-09-04 01:42:38 -07:00
|
|
|
}
|
2015-10-02 00:51:43 -07:00
|
|
|
if (o->dirty_pixels && ENFN->image_native_get)
|
|
|
|
{
|
|
|
|
/* Evas GL surfaces have historically required only the dirty
|
|
|
|
* pixel to trigger a redraw (call to pixels_get). Other kinds
|
|
|
|
* of surfaces must add data update regions. */
|
|
|
|
Evas_Native_Surface *ns;
|
|
|
|
ns = ENFN->image_native_get(ENDT, o->engine_data);
|
|
|
|
if (ns && (ns->type == EVAS_NATIVE_SURFACE_EVASGL))
|
|
|
|
{
|
|
|
|
evas_object_render_pre_prev_cur_add(&e->clip_changes, eo_obj, obj);
|
|
|
|
if (!o->pixels->pixel_updates) goto done;
|
|
|
|
}
|
|
|
|
}
|
2013-01-27 16:28:53 -08:00
|
|
|
if (o->cur->frame != o->prev->frame)
|
2012-09-04 01:42:38 -07:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_render_pre_prev_cur_add(&e->clip_changes, eo_obj, obj);
|
2013-01-25 04:15:38 -08:00
|
|
|
if (!o->pixels->pixel_updates) goto done;
|
2012-09-04 01:42:38 -07:00
|
|
|
}
|
evas: add image orient set/get API in software backend for now.
Summary:
Added API's to rotate(0, 90, 180, 270), flip(horizontal, vertical, transpose, transverse)
evas image object. Also added example to demonstrate this.
Signed-off-by: kabeer khan <kabeer.khan@samsung.com>
Reviewers: raster, stephenmhouston, cedric
Subscribers: stephenmhouston, cedric
Differential Revision: https://phab.enlightenment.org/D1950
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-02-11 08:30:49 -08:00
|
|
|
if (o->cur->orient != o->prev->orient)
|
|
|
|
{
|
|
|
|
evas_object_render_pre_prev_cur_add(&e->clip_changes, eo_obj, obj);
|
|
|
|
if (!o->pixels->pixel_updates) goto done;
|
|
|
|
}
|
2012-09-04 01:42:38 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
2013-03-12 05:58:19 -07:00
|
|
|
if (((obj->cur->geometry.x != obj->prev->geometry.x) ||
|
|
|
|
(obj->cur->geometry.y != obj->prev->geometry.y) ||
|
|
|
|
(obj->cur->geometry.w != obj->prev->geometry.w) ||
|
|
|
|
(obj->cur->geometry.h != obj->prev->geometry.h))
|
2012-09-04 01:42:38 -07:00
|
|
|
)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_render_pre_prev_cur_add(&e->clip_changes, eo_obj, obj);
|
2013-01-25 04:15:38 -08:00
|
|
|
if (!o->pixels->pixel_updates) goto done;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
if (o->changed)
|
|
|
|
{
|
2013-01-27 16:28:53 -08:00
|
|
|
if ((o->cur->fill.x != o->prev->fill.x) ||
|
|
|
|
(o->cur->fill.y != o->prev->fill.y) ||
|
|
|
|
(o->cur->fill.w != o->prev->fill.w) ||
|
|
|
|
(o->cur->fill.h != o->prev->fill.h))
|
2012-09-04 01:42:38 -07:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_render_pre_prev_cur_add(&e->clip_changes, eo_obj, obj);
|
2013-01-25 04:15:38 -08:00
|
|
|
if (!o->pixels->pixel_updates) goto done;
|
2012-09-04 01:42:38 -07:00
|
|
|
}
|
2013-01-25 04:15:38 -08:00
|
|
|
if (o->pixels->pixel_updates)
|
2011-04-14 03:47:40 -07:00
|
|
|
{
|
2013-01-27 16:28:53 -08:00
|
|
|
if ((o->cur->border.l == 0) &&
|
|
|
|
(o->cur->border.r == 0) &&
|
|
|
|
(o->cur->border.t == 0) &&
|
|
|
|
(o->cur->border.b == 0) &&
|
|
|
|
(o->cur->image.w > 0) &&
|
|
|
|
(o->cur->image.h > 0) &&
|
2013-01-21 19:56:00 -08:00
|
|
|
(!((obj->map->cur.map) && (obj->map->cur.usemap))))
|
2011-04-14 03:47:40 -07:00
|
|
|
{
|
|
|
|
Eina_Rectangle *rr;
|
2012-09-04 01:42:38 -07:00
|
|
|
|
2013-01-25 04:15:38 -08:00
|
|
|
EINA_COW_PIXEL_WRITE_BEGIN(o, pixi_write)
|
2011-04-14 03:47:40 -07:00
|
|
|
{
|
2014-03-26 23:47:00 -07:00
|
|
|
EINA_LIST_FREE(pixi_write->pixel_updates, rr)
|
2013-01-25 04:15:38 -08:00
|
|
|
{
|
|
|
|
Evas_Coord idw, idh, idx, idy;
|
|
|
|
int x, y, w, h;
|
2014-03-26 23:47:00 -07:00
|
|
|
e->engine.func->image_dirty_region(e->engine.data.output, o->engine_data, rr->x, rr->y, rr->w, rr->h);
|
2012-09-04 01:42:38 -07:00
|
|
|
|
2013-01-27 16:28:53 -08:00
|
|
|
idx = evas_object_image_figure_x_fill(eo_obj, obj, o->cur->fill.x, o->cur->fill.w, &idw);
|
|
|
|
idy = evas_object_image_figure_y_fill(eo_obj, obj, o->cur->fill.y, o->cur->fill.h, &idh);
|
2012-09-04 01:42:38 -07:00
|
|
|
|
2013-01-25 04:15:38 -08:00
|
|
|
if (idw < 1) idw = 1;
|
|
|
|
if (idh < 1) idh = 1;
|
|
|
|
if (idx > 0) idx -= idw;
|
|
|
|
if (idy > 0) idy -= idh;
|
2013-03-12 05:58:19 -07:00
|
|
|
while (idx < obj->cur->geometry.w)
|
2011-04-14 03:47:40 -07:00
|
|
|
{
|
2013-01-25 04:15:38 -08:00
|
|
|
Evas_Coord ydy;
|
|
|
|
|
|
|
|
ydy = idy;
|
|
|
|
x = idx;
|
|
|
|
w = ((int)(idx + idw)) - x;
|
2013-03-12 05:58:19 -07:00
|
|
|
while (idy < obj->cur->geometry.h)
|
2013-01-25 04:15:38 -08:00
|
|
|
{
|
|
|
|
Eina_Rectangle r;
|
|
|
|
|
|
|
|
y = idy;
|
|
|
|
h = ((int)(idy + idh)) - y;
|
|
|
|
|
2013-01-27 16:28:53 -08:00
|
|
|
r.x = (rr->x * w) / o->cur->image.w;
|
|
|
|
r.y = (rr->y * h) / o->cur->image.h;
|
|
|
|
r.w = ((rr->w * w) + (o->cur->image.w * 2) - 1) / o->cur->image.w;
|
|
|
|
r.h = ((rr->h * h) + (o->cur->image.h * 2) - 1) / o->cur->image.h;
|
2013-03-12 05:58:19 -07:00
|
|
|
r.x += obj->cur->geometry.x + x;
|
|
|
|
r.y += obj->cur->geometry.y + y;
|
2013-01-25 04:15:38 -08:00
|
|
|
RECTS_CLIP_TO_RECT(r.x, r.y, r.w, r.h,
|
2013-03-12 05:58:19 -07:00
|
|
|
obj->cur->cache.clip.x, obj->cur->cache.clip.y,
|
|
|
|
obj->cur->cache.clip.w, obj->cur->cache.clip.h);
|
2013-01-25 04:15:38 -08:00
|
|
|
evas_add_rect(&e->clip_changes, r.x, r.y, r.w, r.h);
|
|
|
|
idy += h;
|
|
|
|
}
|
|
|
|
idx += idw;
|
|
|
|
idy = ydy;
|
2011-04-14 03:47:40 -07:00
|
|
|
}
|
2015-09-08 16:08:45 -07:00
|
|
|
eina_rectangle_free(rr);
|
2011-04-14 03:47:40 -07:00
|
|
|
}
|
|
|
|
}
|
2013-01-25 04:15:38 -08:00
|
|
|
EINA_COW_PIXEL_WRITE_END(o, pixi_write);
|
2011-04-14 03:47:40 -07:00
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-03-26 23:47:00 -07:00
|
|
|
Eina_Rectangle *r;
|
|
|
|
|
|
|
|
EINA_COW_PIXEL_WRITE_BEGIN(o, pixi_write)
|
|
|
|
{
|
|
|
|
EINA_LIST_FREE(pixi_write->pixel_updates, r)
|
|
|
|
eina_rectangle_free(r);
|
|
|
|
}
|
|
|
|
EINA_COW_PIXEL_WRITE_END(o, pixi_write);
|
|
|
|
e->engine.func->image_dirty_region(e->engine.data.output, o->engine_data, 0, 0, o->cur->image.w, o->cur->image.h);
|
|
|
|
|
2014-02-17 06:05:36 -08:00
|
|
|
evas_object_render_pre_prev_cur_add(&e->clip_changes, eo_obj,
|
|
|
|
obj);
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
}
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
/* it obviously didn't change - add a NO obscure - this "unupdates" this */
|
|
|
|
/* area so if there were updates for it they get wiped. don't do it if we */
|
2004-02-16 11:22:48 -08:00
|
|
|
/* aren't fully opaque and we are visible */
|
2012-10-08 18:58:41 -07:00
|
|
|
if (evas_object_is_visible(eo_obj, obj) &&
|
|
|
|
evas_object_is_opaque(eo_obj, obj))
|
2009-11-06 21:01:43 -08:00
|
|
|
{
|
2011-11-10 21:56:40 -08:00
|
|
|
Evas_Coord x, y, w, h;
|
2012-09-04 01:42:38 -07:00
|
|
|
|
2013-03-12 05:58:19 -07:00
|
|
|
x = obj->cur->cache.clip.x;
|
|
|
|
y = obj->cur->cache.clip.y;
|
|
|
|
w = obj->cur->cache.clip.w;
|
|
|
|
h = obj->cur->cache.clip.h;
|
|
|
|
if (obj->cur->clipper)
|
2011-11-10 21:56:40 -08:00
|
|
|
{
|
|
|
|
RECTS_CLIP_TO_RECT(x, y, w, h,
|
2013-03-12 05:58:19 -07:00
|
|
|
obj->cur->clipper->cur->cache.clip.x,
|
|
|
|
obj->cur->clipper->cur->cache.clip.y,
|
|
|
|
obj->cur->clipper->cur->cache.clip.w,
|
|
|
|
obj->cur->clipper->cur->cache.clip.h);
|
2011-11-10 21:56:40 -08:00
|
|
|
}
|
|
|
|
e->engine.func->output_redraws_rect_del(e->engine.data.output,
|
2013-04-26 11:01:44 -07:00
|
|
|
x + e->framespace.x,
|
|
|
|
y + e->framespace.y,
|
|
|
|
w, h);
|
2009-11-06 21:01:43 -08:00
|
|
|
}
|
2002-11-08 00:02:15 -08:00
|
|
|
done:
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_render_pre_effect_updates(&e->clip_changes, eo_obj, is_v, was_v);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-07-08 17:46:15 -07:00
|
|
|
evas_object_image_render_post(Evas_Object *eo_obj,
|
|
|
|
Evas_Object_Protected_Data *obj EINA_UNUSED,
|
|
|
|
void *type_private_data)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2014-03-12 07:28:40 -07:00
|
|
|
Evas_Image_Data *o = type_private_data;
|
2009-06-23 06:57:27 -07:00
|
|
|
Eina_Rectangle *r;
|
2002-11-08 00:02:15 -08:00
|
|
|
|
|
|
|
/* this moves the current data to the previous state parts of the object */
|
|
|
|
/* in whatever way is safest for the object. also if we don't need object */
|
|
|
|
/* data anymore we can free it if the object deems this is a good idea */
|
|
|
|
/* remove those pesky changes */
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_clip_changes_clean(eo_obj);
|
2013-01-25 04:15:38 -08:00
|
|
|
|
2013-01-25 14:21:37 -08:00
|
|
|
if (o->pixels->pixel_updates)
|
2013-01-25 04:15:38 -08:00
|
|
|
{
|
2013-01-25 14:21:37 -08:00
|
|
|
EINA_COW_PIXEL_WRITE_BEGIN(o, pixi_write)
|
|
|
|
{
|
|
|
|
EINA_LIST_FREE(pixi_write->pixel_updates, r)
|
|
|
|
eina_rectangle_free(r);
|
|
|
|
}
|
|
|
|
EINA_COW_PIXEL_WRITE_END(o, pixi_write);
|
2013-01-25 04:15:38 -08:00
|
|
|
}
|
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
/* move cur to prev safely for object data */
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_cur_prev(eo_obj);
|
2013-01-27 16:28:53 -08:00
|
|
|
eina_cow_memcpy(evas_object_image_state_cow, (const Eina_Cow_Data **) &o->prev, o->cur);
|
2002-11-08 00:02:15 -08:00
|
|
|
/* FIXME: copy strings across */
|
|
|
|
}
|
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
static unsigned int evas_object_image_id_get(Evas_Object *eo_obj)
|
2008-08-30 19:04:31 -07:00
|
|
|
{
|
2014-03-12 07:28:40 -07:00
|
|
|
Evas_Image_Data *o = eo_data_scope_get(eo_obj, MY_CLASS);
|
2008-08-30 19:04:31 -07:00
|
|
|
if (!o) return 0;
|
|
|
|
return MAGIC_OBJ_IMAGE;
|
|
|
|
}
|
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
static unsigned int evas_object_image_visual_id_get(Evas_Object *eo_obj)
|
2008-08-25 22:45:04 -07:00
|
|
|
{
|
2014-03-12 07:28:40 -07:00
|
|
|
Evas_Image_Data *o = eo_data_scope_get(eo_obj, MY_CLASS);
|
2008-08-25 22:45:04 -07:00
|
|
|
if (!o) return 0;
|
|
|
|
return MAGIC_OBJ_IMAGE;
|
|
|
|
}
|
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
static void *evas_object_image_engine_data_get(Evas_Object *eo_obj)
|
2008-08-25 22:45:04 -07:00
|
|
|
{
|
2014-03-12 07:28:40 -07:00
|
|
|
Evas_Image_Data *o = eo_data_scope_get(eo_obj, MY_CLASS);
|
2008-08-25 22:45:04 -07:00
|
|
|
if (!o) return NULL;
|
|
|
|
return o->engine_data;
|
|
|
|
}
|
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
static int
|
2013-07-08 17:46:15 -07:00
|
|
|
evas_object_image_is_opaque(Evas_Object *eo_obj EINA_UNUSED,
|
|
|
|
Evas_Object_Protected_Data *obj,
|
|
|
|
void *type_private_data)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
/* this returns 1 if the internal object data implies that the object is */
|
2004-02-16 11:22:48 -08:00
|
|
|
/* currently fully opaque over the entire rectangle it occupies */
|
2011-10-21 10:14:03 -07:00
|
|
|
/* disable caching due tyo maps screwing with this
|
2012-10-09 00:49:07 -07:00
|
|
|
o->cur.opaque_valid = 0;*/
|
2014-03-12 07:28:40 -07:00
|
|
|
Evas_Image_Data *o = type_private_data;
|
2013-03-12 05:58:19 -07:00
|
|
|
|
|
|
|
if (o->cur->opaque_valid)
|
2010-08-09 19:35:07 -07:00
|
|
|
{
|
2013-03-12 05:58:19 -07:00
|
|
|
if (!o->cur->opaque) return 0;
|
2010-08-09 19:35:07 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-03-12 05:58:19 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
|
|
|
|
{
|
|
|
|
state_write->opaque = 0;
|
|
|
|
state_write->opaque_valid = 1;
|
|
|
|
}
|
|
|
|
EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
|
2012-10-09 00:49:07 -07:00
|
|
|
|
2013-01-27 16:28:53 -08:00
|
|
|
if ((o->cur->fill.w < 1) || (o->cur->fill.h < 1))
|
2013-03-12 05:58:19 -07:00
|
|
|
return o->cur->opaque;
|
2013-01-27 16:28:53 -08:00
|
|
|
if (((o->cur->border.l != 0) ||
|
|
|
|
(o->cur->border.r != 0) ||
|
|
|
|
(o->cur->border.t != 0) ||
|
|
|
|
(o->cur->border.b != 0)) &&
|
|
|
|
(!o->cur->border.fill))
|
2013-03-12 05:58:19 -07:00
|
|
|
return o->cur->opaque;
|
2012-10-09 00:49:07 -07:00
|
|
|
if (!o->engine_data)
|
2013-03-12 05:58:19 -07:00
|
|
|
return o->cur->opaque;
|
2012-10-09 00:49:07 -07:00
|
|
|
|
|
|
|
// FIXME: use proxy
|
2013-01-27 16:28:53 -08:00
|
|
|
if (o->cur->source)
|
2012-10-09 00:49:07 -07:00
|
|
|
{
|
2014-06-02 06:47:59 -07:00
|
|
|
Evas_Object_Protected_Data *cur_source = eo_data_scope_get(o->cur->source, EVAS_OBJECT_CLASS);
|
2013-03-12 05:58:19 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
|
|
|
|
{
|
|
|
|
state_write->opaque = evas_object_is_opaque(o->cur->source, cur_source);
|
|
|
|
}
|
|
|
|
EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
|
|
|
|
return o->cur->opaque; /* FIXME: Should go poke at the object */
|
2012-10-09 00:49:07 -07:00
|
|
|
}
|
2013-01-27 16:28:53 -08:00
|
|
|
if (o->cur->has_alpha)
|
2013-03-12 05:58:19 -07:00
|
|
|
return o->cur->opaque;
|
2012-10-09 00:49:07 -07:00
|
|
|
|
2013-03-12 05:58:19 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
|
|
|
|
{
|
|
|
|
state_write->opaque = 1;
|
|
|
|
}
|
|
|
|
EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
|
2011-10-21 10:14:03 -07:00
|
|
|
}
|
2012-10-09 00:49:07 -07:00
|
|
|
|
2013-01-21 19:56:00 -08:00
|
|
|
if ((obj->map->cur.map) && (obj->map->cur.usemap))
|
2011-10-21 10:14:03 -07:00
|
|
|
{
|
2013-01-21 19:56:00 -08:00
|
|
|
Evas_Map *m = obj->map->cur.map;
|
2012-09-04 01:42:38 -07:00
|
|
|
|
2011-10-21 10:14:03 -07:00
|
|
|
if ((m->points[0].a == 255) &&
|
|
|
|
(m->points[1].a == 255) &&
|
|
|
|
(m->points[2].a == 255) &&
|
|
|
|
(m->points[3].a == 255))
|
|
|
|
{
|
|
|
|
if (
|
|
|
|
((m->points[0].x == m->points[3].x) &&
|
|
|
|
(m->points[1].x == m->points[2].x) &&
|
|
|
|
(m->points[0].y == m->points[1].y) &&
|
|
|
|
(m->points[2].y == m->points[3].y))
|
|
|
|
||
|
|
|
|
((m->points[0].x == m->points[1].x) &&
|
|
|
|
(m->points[2].x == m->points[3].x) &&
|
|
|
|
(m->points[0].y == m->points[3].y) &&
|
|
|
|
(m->points[1].y == m->points[2].y))
|
|
|
|
)
|
2011-10-26 06:33:25 -07:00
|
|
|
{
|
2013-03-12 05:58:19 -07:00
|
|
|
if ((m->points[0].x == obj->cur->geometry.x) &&
|
|
|
|
(m->points[0].y == obj->cur->geometry.y) &&
|
|
|
|
(m->points[2].x == (obj->cur->geometry.x + obj->cur->geometry.w)) &&
|
|
|
|
(m->points[2].y == (obj->cur->geometry.y + obj->cur->geometry.h)))
|
|
|
|
return o->cur->opaque;
|
2011-10-26 06:33:25 -07:00
|
|
|
}
|
2011-10-21 10:14:03 -07:00
|
|
|
}
|
2013-03-12 05:58:19 -07:00
|
|
|
|
|
|
|
EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
|
|
|
|
{
|
|
|
|
state_write->opaque = 0;
|
|
|
|
}
|
|
|
|
EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
|
|
|
|
|
|
|
|
return o->cur->opaque;
|
2012-10-09 00:49:07 -07:00
|
|
|
}
|
2013-03-12 05:58:19 -07:00
|
|
|
if (obj->cur->render_op == EVAS_RENDER_COPY)
|
2012-10-09 00:49:07 -07:00
|
|
|
{
|
2013-03-12 05:58:19 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
|
|
|
|
{
|
|
|
|
state_write->opaque = 1;
|
|
|
|
}
|
|
|
|
EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
|
|
|
|
|
|
|
|
return o->cur->opaque;
|
2011-10-21 10:14:03 -07:00
|
|
|
}
|
2013-03-12 05:58:19 -07:00
|
|
|
return o->cur->opaque;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2013-07-08 17:46:15 -07:00
|
|
|
evas_object_image_was_opaque(Evas_Object *eo_obj EINA_UNUSED,
|
|
|
|
Evas_Object_Protected_Data *obj,
|
|
|
|
void *type_private_data)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2014-03-12 07:28:40 -07:00
|
|
|
Evas_Image_Data *o = type_private_data;
|
2013-03-12 05:58:19 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
/* this returns 1 if the internal object data implies that the object was */
|
2004-02-16 11:22:48 -08:00
|
|
|
/* previously fully opaque over the entire rectangle it occupies */
|
2013-03-12 05:58:19 -07:00
|
|
|
if (o->prev->opaque_valid)
|
2010-08-09 19:35:07 -07:00
|
|
|
{
|
2013-03-12 05:58:19 -07:00
|
|
|
if (!o->prev->opaque) return 0;
|
2010-08-09 19:35:07 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-03-12 05:58:19 -07:00
|
|
|
EINA_COW_WRITE_BEGIN(evas_object_image_state_cow, o->prev, Evas_Object_Image_State, state_write)
|
|
|
|
{
|
|
|
|
state_write->opaque = 0;
|
|
|
|
state_write->opaque_valid = 1;
|
|
|
|
}
|
|
|
|
EINA_COW_WRITE_END(evas_object_image_state_cow, o->prev, state_write);
|
2012-10-09 00:49:07 -07:00
|
|
|
|
2013-01-27 16:28:53 -08:00
|
|
|
if ((o->prev->fill.w < 1) || (o->prev->fill.h < 1))
|
2013-03-12 05:58:19 -07:00
|
|
|
return o->prev->opaque;
|
2013-01-27 16:28:53 -08:00
|
|
|
if (((o->prev->border.l != 0) ||
|
|
|
|
(o->prev->border.r != 0) ||
|
|
|
|
(o->prev->border.t != 0) ||
|
|
|
|
(o->prev->border.b != 0)) &&
|
|
|
|
(!o->prev->border.fill))
|
2013-03-12 05:58:19 -07:00
|
|
|
return o->prev->opaque;
|
2012-10-09 00:49:07 -07:00
|
|
|
if (!o->engine_data)
|
2013-03-12 05:58:19 -07:00
|
|
|
return o->prev->opaque;
|
2012-10-09 00:49:07 -07:00
|
|
|
|
|
|
|
// FIXME: use proxy
|
2013-01-27 16:28:53 -08:00
|
|
|
if (o->prev->source)
|
2013-03-12 05:58:19 -07:00
|
|
|
return o->prev->opaque; /* FIXME: Should go poke at the object */
|
2013-01-27 16:28:53 -08:00
|
|
|
if (o->prev->has_alpha)
|
2013-03-12 05:58:19 -07:00
|
|
|
return o->prev->opaque;
|
2012-10-09 00:49:07 -07:00
|
|
|
|
2013-03-12 05:58:19 -07:00
|
|
|
EINA_COW_WRITE_BEGIN(evas_object_image_state_cow, o->prev, Evas_Object_Image_State, state_write)
|
|
|
|
{
|
|
|
|
state_write->opaque = 1;
|
|
|
|
}
|
|
|
|
EINA_COW_WRITE_END(evas_object_image_state_cow, o->prev, state_write);
|
2012-10-09 00:49:07 -07:00
|
|
|
}
|
2013-01-21 19:56:00 -08:00
|
|
|
if (obj->map->prev.usemap)
|
2012-10-09 00:49:07 -07:00
|
|
|
{
|
2013-01-21 19:56:00 -08:00
|
|
|
Evas_Map *m = obj->map->prev.map;
|
2012-10-09 00:49:07 -07:00
|
|
|
|
|
|
|
if ((m->points[0].a == 255) &&
|
|
|
|
(m->points[1].a == 255) &&
|
|
|
|
(m->points[2].a == 255) &&
|
|
|
|
(m->points[3].a == 255))
|
|
|
|
{
|
|
|
|
if (
|
|
|
|
((m->points[0].x == m->points[3].x) &&
|
|
|
|
(m->points[1].x == m->points[2].x) &&
|
|
|
|
(m->points[0].y == m->points[1].y) &&
|
|
|
|
(m->points[2].y == m->points[3].y))
|
|
|
|
||
|
|
|
|
((m->points[0].x == m->points[1].x) &&
|
|
|
|
(m->points[2].x == m->points[3].x) &&
|
|
|
|
(m->points[0].y == m->points[3].y) &&
|
|
|
|
(m->points[1].y == m->points[2].y))
|
|
|
|
)
|
|
|
|
{
|
2013-03-12 05:58:19 -07:00
|
|
|
if ((m->points[0].x == obj->prev->geometry.x) &&
|
|
|
|
(m->points[0].y == obj->prev->geometry.y) &&
|
|
|
|
(m->points[2].x == (obj->prev->geometry.x + obj->prev->geometry.w)) &&
|
|
|
|
(m->points[2].y == (obj->prev->geometry.y + obj->prev->geometry.h)))
|
|
|
|
return o->prev->opaque;
|
2012-10-09 00:49:07 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-12 05:58:19 -07:00
|
|
|
EINA_COW_WRITE_BEGIN(evas_object_image_state_cow, o->prev, Evas_Object_Image_State, state_write)
|
|
|
|
{
|
|
|
|
state_write->opaque = 0;
|
|
|
|
}
|
|
|
|
EINA_COW_WRITE_END(evas_object_image_state_cow, o->prev, state_write);
|
|
|
|
|
|
|
|
return o->prev->opaque;
|
2012-10-09 00:49:07 -07:00
|
|
|
}
|
2013-03-12 05:58:19 -07:00
|
|
|
if (obj->prev->render_op == EVAS_RENDER_COPY)
|
2012-10-09 00:49:07 -07:00
|
|
|
{
|
2013-03-12 05:58:19 -07:00
|
|
|
EINA_COW_WRITE_BEGIN(evas_object_image_state_cow, o->prev, Evas_Object_Image_State, state_write)
|
|
|
|
{
|
|
|
|
state_write->opaque = 1;
|
|
|
|
}
|
|
|
|
EINA_COW_WRITE_END(evas_object_image_state_cow, o->prev, state_write);
|
|
|
|
|
|
|
|
return o->prev->opaque;
|
2012-10-09 00:49:07 -07:00
|
|
|
}
|
2013-03-12 05:58:19 -07:00
|
|
|
if (obj->prev->render_op != EVAS_RENDER_BLEND)
|
2012-10-09 00:49:07 -07:00
|
|
|
{
|
2013-03-12 05:58:19 -07:00
|
|
|
EINA_COW_WRITE_BEGIN(evas_object_image_state_cow, o->prev, Evas_Object_Image_State, state_write)
|
|
|
|
{
|
|
|
|
state_write->opaque = 0;
|
|
|
|
}
|
|
|
|
EINA_COW_WRITE_END(evas_object_image_state_cow, o->prev, state_write);
|
|
|
|
|
|
|
|
return o->prev->opaque;
|
2012-10-09 00:49:07 -07:00
|
|
|
}
|
2013-03-12 05:58:19 -07:00
|
|
|
return o->prev->opaque;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
2007-07-23 07:22:57 -07:00
|
|
|
|
|
|
|
static int
|
2013-07-08 17:46:15 -07:00
|
|
|
evas_object_image_is_inside(Evas_Object *eo_obj,
|
|
|
|
Evas_Object_Protected_Data *obj,
|
|
|
|
void *type_private_data,
|
|
|
|
Evas_Coord px, Evas_Coord py)
|
2007-07-23 07:22:57 -07:00
|
|
|
{
|
2014-03-12 07:28:40 -07:00
|
|
|
Evas_Image_Data *o = type_private_data;
|
2012-12-19 14:41:12 -08:00
|
|
|
int imagew, imageh, uvw, uvh;
|
|
|
|
void *pixels;
|
2014-10-22 02:34:51 -07:00
|
|
|
Evas_Func *eng = ENFN;
|
2012-12-19 14:41:12 -08:00
|
|
|
int is_inside = 0;
|
|
|
|
|
|
|
|
/* the following code is similar to evas_object_image_render(), but doesn't
|
|
|
|
* draw, just get the pixels so we can check the transparency.
|
|
|
|
*/
|
|
|
|
Evas_Object_Protected_Data *source =
|
2013-01-27 16:28:53 -08:00
|
|
|
(o->cur->source ?
|
2014-06-02 06:47:59 -07:00
|
|
|
eo_data_scope_get(o->cur->source, EVAS_OBJECT_CLASS):
|
2012-12-19 14:41:12 -08:00
|
|
|
NULL);
|
2014-04-16 01:55:34 -07:00
|
|
|
|
2014-01-07 00:39:23 -08:00
|
|
|
if (o->cur->scene)
|
|
|
|
{
|
2016-03-07 21:11:07 -08:00
|
|
|
_evas_image_3d_render(obj->layer->evas->evas, eo_obj, obj, o, o->cur->scene);
|
2014-01-07 00:39:23 -08:00
|
|
|
pixels = obj->data_3d->surface;
|
|
|
|
imagew = obj->data_3d->w;
|
|
|
|
imageh = obj->data_3d->h;
|
|
|
|
uvw = imagew;
|
|
|
|
uvh = imageh;
|
|
|
|
}
|
|
|
|
else if (!o->cur->source)
|
2012-12-19 14:41:12 -08:00
|
|
|
{
|
|
|
|
pixels = o->engine_data;
|
2013-01-27 16:28:53 -08:00
|
|
|
imagew = o->cur->image.w;
|
|
|
|
imageh = o->cur->image.h;
|
2012-12-19 14:41:12 -08:00
|
|
|
uvw = imagew;
|
|
|
|
uvh = imageh;
|
|
|
|
}
|
2013-01-16 23:21:06 -08:00
|
|
|
else if (source->proxy->surface && !source->proxy->redraw)
|
2009-06-03 07:16:55 -07:00
|
|
|
{
|
2013-01-16 23:21:06 -08:00
|
|
|
pixels = source->proxy->surface;
|
|
|
|
imagew = source->proxy->w;
|
|
|
|
imageh = source->proxy->h;
|
2012-12-19 14:41:12 -08:00
|
|
|
uvw = imagew;
|
|
|
|
uvh = imageh;
|
|
|
|
}
|
|
|
|
else if (source->type == o_type &&
|
2014-03-12 07:28:40 -07:00
|
|
|
((Evas_Image_Data *)eo_data_scope_get(o->cur->source, MY_CLASS))->engine_data)
|
2012-12-19 14:41:12 -08:00
|
|
|
{
|
2014-03-12 07:28:40 -07:00
|
|
|
Evas_Image_Data *oi;
|
2013-05-02 00:47:16 -07:00
|
|
|
oi = eo_data_scope_get(o->cur->source, MY_CLASS);
|
2012-12-19 14:41:12 -08:00
|
|
|
pixels = oi->engine_data;
|
2013-01-27 16:28:53 -08:00
|
|
|
imagew = oi->cur->image.w;
|
|
|
|
imageh = oi->cur->image.h;
|
2013-03-12 05:58:19 -07:00
|
|
|
uvw = source->cur->geometry.w;
|
|
|
|
uvh = source->cur->geometry.h;
|
2009-06-03 07:16:55 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-12-19 14:41:12 -08:00
|
|
|
o->proxyrendering = EINA_TRUE;
|
2014-10-22 23:27:40 -07:00
|
|
|
evas_render_proxy_subrender(obj->layer->evas->evas, o->cur->source,
|
|
|
|
eo_obj, obj, EINA_FALSE);
|
2013-01-16 23:21:06 -08:00
|
|
|
pixels = source->proxy->surface;
|
|
|
|
imagew = source->proxy->w;
|
|
|
|
imageh = source->proxy->h;
|
2012-12-19 14:41:12 -08:00
|
|
|
uvw = imagew;
|
|
|
|
uvh = imageh;
|
|
|
|
o->proxyrendering = EINA_FALSE;
|
|
|
|
}
|
2012-09-04 01:42:38 -07:00
|
|
|
|
2012-12-19 14:41:12 -08:00
|
|
|
if (pixels)
|
|
|
|
{
|
|
|
|
Evas_Coord idw, idh, idx, idy;
|
|
|
|
int ix, iy, iw, ih;
|
|
|
|
|
2013-01-25 04:15:38 -08:00
|
|
|
/* TODO: not handling o->dirty_pixels && o->pixels->func.get_pixels,
|
2012-12-19 14:41:12 -08:00
|
|
|
* should we handle it now or believe they were done in the last render?
|
|
|
|
*/
|
|
|
|
if (o->dirty_pixels)
|
2010-02-20 22:21:15 -08:00
|
|
|
{
|
2013-01-25 04:15:38 -08:00
|
|
|
if (o->pixels->func.get_pixels)
|
2012-12-19 14:41:12 -08:00
|
|
|
{
|
|
|
|
ERR("dirty_pixels && get_pixels not supported");
|
|
|
|
}
|
2010-02-20 22:21:15 -08:00
|
|
|
}
|
2012-12-19 14:41:12 -08:00
|
|
|
|
|
|
|
/* TODO: not handling map, need to apply map to point */
|
2013-01-21 19:56:00 -08:00
|
|
|
if ((obj->map->cur.map) && (obj->map->cur.map->count > 3) && (obj->map->cur.usemap))
|
2010-02-20 22:21:15 -08:00
|
|
|
{
|
2012-12-19 14:41:12 -08:00
|
|
|
evas_object_map_update(eo_obj, 0, 0, imagew, imageh, uvw, uvh);
|
|
|
|
|
|
|
|
ERR("map not supported");
|
2010-02-20 22:21:15 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-01-27 16:28:53 -08:00
|
|
|
idx = evas_object_image_figure_x_fill(eo_obj, obj, o->cur->fill.x, o->cur->fill.w, &idw);
|
|
|
|
idy = evas_object_image_figure_y_fill(eo_obj, obj, o->cur->fill.y, o->cur->fill.h, &idh);
|
2012-12-19 14:41:12 -08:00
|
|
|
if (idw < 1) idw = 1;
|
|
|
|
if (idh < 1) idh = 1;
|
|
|
|
if (idx > 0) idx -= idw;
|
|
|
|
if (idy > 0) idy -= idh;
|
2013-03-12 05:58:19 -07:00
|
|
|
while ((int)idx < obj->cur->geometry.w)
|
2012-12-19 14:41:12 -08:00
|
|
|
{
|
|
|
|
Evas_Coord ydy;
|
|
|
|
int dobreak_w = 0;
|
|
|
|
ydy = idy;
|
|
|
|
ix = idx;
|
2013-03-12 05:58:19 -07:00
|
|
|
if ((o->cur->fill.w == obj->cur->geometry.w) &&
|
2013-01-27 16:28:53 -08:00
|
|
|
(o->cur->fill.x == 0))
|
2012-12-19 14:41:12 -08:00
|
|
|
{
|
|
|
|
dobreak_w = 1;
|
2013-03-12 05:58:19 -07:00
|
|
|
iw = obj->cur->geometry.w;
|
2012-12-19 14:41:12 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
iw = ((int)(idx + idw)) - ix;
|
2013-03-12 05:58:19 -07:00
|
|
|
while ((int)idy < obj->cur->geometry.h)
|
2012-12-19 14:41:12 -08:00
|
|
|
{
|
|
|
|
int dobreak_h = 0;
|
2012-09-04 01:42:38 -07:00
|
|
|
|
2012-12-19 14:41:12 -08:00
|
|
|
iy = idy;
|
2013-03-12 05:58:19 -07:00
|
|
|
if ((o->cur->fill.h == obj->cur->geometry.h) &&
|
2013-01-27 16:28:53 -08:00
|
|
|
(o->cur->fill.y == 0))
|
2012-12-19 14:41:12 -08:00
|
|
|
{
|
2013-03-12 05:58:19 -07:00
|
|
|
ih = obj->cur->geometry.h;
|
2012-12-19 14:41:12 -08:00
|
|
|
dobreak_h = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ih = ((int)(idy + idh)) - iy;
|
2013-01-27 16:28:53 -08:00
|
|
|
if ((o->cur->border.l == 0) &&
|
|
|
|
(o->cur->border.r == 0) &&
|
|
|
|
(o->cur->border.t == 0) &&
|
|
|
|
(o->cur->border.b == 0) &&
|
|
|
|
(o->cur->border.fill != 0))
|
2012-12-19 14:41:12 -08:00
|
|
|
{
|
|
|
|
/* NOTE: render handles cserve2 here,
|
|
|
|
* we don't need to
|
|
|
|
*/
|
|
|
|
{
|
|
|
|
DATA8 alpha = 0;
|
2013-02-17 09:53:25 -08:00
|
|
|
|
|
|
|
if (eng->pixel_alpha_get(pixels, px, py, &alpha,
|
|
|
|
0, 0,
|
|
|
|
imagew, imageh,
|
2013-03-12 05:58:19 -07:00
|
|
|
obj->cur->geometry.x + ix,
|
|
|
|
obj->cur->geometry.y + iy,
|
2013-02-17 09:53:25 -08:00
|
|
|
iw, ih))
|
2012-12-19 14:41:12 -08:00
|
|
|
{
|
|
|
|
is_inside = alpha > 0;
|
|
|
|
dobreak_h = 1;
|
|
|
|
dobreak_w = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int inx, iny, inw, inh, outx, outy, outw, outh;
|
|
|
|
int bl, br, bt, bb, bsl, bsr, bst, bsb;
|
|
|
|
int imw, imh, ox, oy;
|
|
|
|
DATA8 alpha = 0;
|
2012-07-03 00:30:05 -07:00
|
|
|
|
2013-03-12 05:58:19 -07:00
|
|
|
ox = obj->cur->geometry.x + ix;
|
|
|
|
oy = obj->cur->geometry.y + iy;
|
2012-12-19 14:41:12 -08:00
|
|
|
imw = imagew;
|
|
|
|
imh = imageh;
|
2013-01-27 16:28:53 -08:00
|
|
|
bl = o->cur->border.l;
|
|
|
|
br = o->cur->border.r;
|
|
|
|
bt = o->cur->border.t;
|
|
|
|
bb = o->cur->border.b;
|
2012-12-19 14:41:12 -08:00
|
|
|
if ((bl + br) > iw)
|
|
|
|
{
|
|
|
|
bl = iw / 2;
|
|
|
|
br = iw - bl;
|
|
|
|
}
|
|
|
|
if ((bl + br) > imw)
|
|
|
|
{
|
|
|
|
bl = imw / 2;
|
|
|
|
br = imw - bl;
|
|
|
|
}
|
|
|
|
if ((bt + bb) > ih)
|
|
|
|
{
|
|
|
|
bt = ih / 2;
|
|
|
|
bb = ih - bt;
|
|
|
|
}
|
|
|
|
if ((bt + bb) > imh)
|
|
|
|
{
|
|
|
|
bt = imh / 2;
|
|
|
|
bb = imh - bt;
|
|
|
|
}
|
2013-01-27 16:28:53 -08:00
|
|
|
if (o->cur->border.scale != 1.0)
|
2012-12-19 14:41:12 -08:00
|
|
|
{
|
2013-01-27 16:28:53 -08:00
|
|
|
bsl = ((double)bl * o->cur->border.scale);
|
|
|
|
bsr = ((double)br * o->cur->border.scale);
|
|
|
|
bst = ((double)bt * o->cur->border.scale);
|
|
|
|
bsb = ((double)bb * o->cur->border.scale);
|
2012-12-19 14:41:12 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
bsl = bl; bsr = br; bst = bt; bsb = bb;
|
|
|
|
}
|
|
|
|
// #--
|
|
|
|
// |
|
|
|
|
inx = 0; iny = 0;
|
|
|
|
inw = bl; inh = bt;
|
|
|
|
outx = ox; outy = oy;
|
|
|
|
outw = bsl; outh = bst;
|
2013-02-17 09:53:25 -08:00
|
|
|
if (eng->pixel_alpha_get(pixels, px, py, &alpha,
|
|
|
|
inx, iny, inw, inh,
|
|
|
|
outx, outy, outw, outh))
|
2012-12-19 14:41:12 -08:00
|
|
|
{
|
|
|
|
is_inside = alpha > 0;
|
|
|
|
dobreak_h = 1;
|
|
|
|
dobreak_w = 1;
|
|
|
|
break;
|
|
|
|
}
|
2007-07-23 07:22:57 -07:00
|
|
|
|
2012-12-19 14:41:12 -08:00
|
|
|
// .##
|
|
|
|
// |
|
|
|
|
inx = bl; iny = 0;
|
|
|
|
inw = imw - bl - br; inh = bt;
|
|
|
|
outx = ox + bsl; outy = oy;
|
|
|
|
outw = iw - bsl - bsr; outh = bst;
|
2013-02-17 09:53:25 -08:00
|
|
|
if (eng->pixel_alpha_get(pixels, px, py, &alpha,
|
|
|
|
inx, iny, inw, inh,
|
|
|
|
outx, outy, outw, outh))
|
2012-12-19 14:41:12 -08:00
|
|
|
{
|
|
|
|
is_inside = alpha > 0;
|
|
|
|
dobreak_h = 1;
|
|
|
|
dobreak_w = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
// --#
|
|
|
|
// |
|
|
|
|
inx = imw - br; iny = 0;
|
|
|
|
inw = br; inh = bt;
|
|
|
|
outx = ox + iw - bsr; outy = oy;
|
|
|
|
outw = bsr; outh = bst;
|
2013-02-17 09:53:25 -08:00
|
|
|
if (eng->pixel_alpha_get(pixels, px, py, &alpha,
|
|
|
|
inx, iny, inw, inh,
|
|
|
|
outx, outy, outw, outh))
|
2012-12-19 14:41:12 -08:00
|
|
|
{
|
|
|
|
is_inside = alpha > 0;
|
|
|
|
dobreak_h = 1;
|
|
|
|
dobreak_w = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
// .--
|
2013-02-17 09:53:25 -08:00
|
|
|
// #
|
2012-12-19 14:41:12 -08:00
|
|
|
inx = 0; iny = bt;
|
|
|
|
inw = bl; inh = imh - bt - bb;
|
|
|
|
outx = ox; outy = oy + bst;
|
|
|
|
outw = bsl; outh = ih - bst - bsb;
|
2013-02-17 09:53:25 -08:00
|
|
|
if (eng->pixel_alpha_get(pixels, px, py, &alpha,
|
|
|
|
inx, iny, inw, inh,
|
|
|
|
outx, outy, outw, outh))
|
2012-12-19 14:41:12 -08:00
|
|
|
{
|
|
|
|
is_inside = alpha > 0;
|
|
|
|
dobreak_h = 1;
|
|
|
|
dobreak_w = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
// .--.
|
|
|
|
// |##|
|
2013-01-27 16:28:53 -08:00
|
|
|
if (o->cur->border.fill > EVAS_BORDER_FILL_NONE)
|
2012-12-19 14:41:12 -08:00
|
|
|
{
|
|
|
|
inx = bl; iny = bt;
|
|
|
|
inw = imw - bl - br; inh = imh - bt - bb;
|
|
|
|
outx = ox + bsl; outy = oy + bst;
|
|
|
|
outw = iw - bsl - bsr; outh = ih - bst - bsb;
|
2013-02-17 09:53:25 -08:00
|
|
|
if (eng->pixel_alpha_get(pixels, px, py, &alpha,
|
|
|
|
inx, iny, inw, inh,
|
|
|
|
outx, outy, outw, outh))
|
2012-12-19 14:41:12 -08:00
|
|
|
{
|
|
|
|
is_inside = alpha > 0;
|
|
|
|
dobreak_h = 1;
|
|
|
|
dobreak_w = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// --.
|
|
|
|
// #
|
|
|
|
inx = imw - br; iny = bt;
|
|
|
|
inw = br; inh = imh - bt - bb;
|
|
|
|
outx = ox + iw - bsr; outy = oy + bst;
|
|
|
|
outw = bsr; outh = ih - bst - bsb;
|
2013-02-17 09:53:25 -08:00
|
|
|
if (eng->pixel_alpha_get(pixels, px, py, &alpha,
|
|
|
|
inx, iny, inw, inh,
|
|
|
|
outx, outy, outw, outh))
|
2012-12-19 14:41:12 -08:00
|
|
|
{
|
|
|
|
is_inside = alpha > 0;
|
|
|
|
dobreak_h = 1;
|
|
|
|
dobreak_w = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
// |
|
|
|
|
// #--
|
|
|
|
inx = 0; iny = imh - bb;
|
|
|
|
inw = bl; inh = bb;
|
|
|
|
outx = ox; outy = oy + ih - bsb;
|
|
|
|
outw = bsl; outh = bsb;
|
2013-02-17 09:53:25 -08:00
|
|
|
if (eng->pixel_alpha_get(pixels, px, py, &alpha,
|
|
|
|
inx, iny, inw, inh,
|
|
|
|
outx, outy, outw, outh))
|
2012-12-19 14:41:12 -08:00
|
|
|
{
|
|
|
|
is_inside = alpha > 0;
|
|
|
|
dobreak_h = 1;
|
|
|
|
dobreak_w = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
// |
|
2014-04-14 03:03:47 -07:00
|
|
|
// .##
|
2012-12-19 14:41:12 -08:00
|
|
|
inx = bl; iny = imh - bb;
|
|
|
|
inw = imw - bl - br; inh = bb;
|
|
|
|
outx = ox + bsl; outy = oy + ih - bsb;
|
|
|
|
outw = iw - bsl - bsr; outh = bsb;
|
2013-02-17 09:53:25 -08:00
|
|
|
if (eng->pixel_alpha_get(pixels, px, py, &alpha,
|
|
|
|
inx, iny, inw, inh,
|
|
|
|
outx, outy, outw, outh))
|
2012-12-19 14:41:12 -08:00
|
|
|
{
|
|
|
|
is_inside = alpha > 0;
|
|
|
|
dobreak_h = 1;
|
|
|
|
dobreak_w = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
// |
|
|
|
|
// --#
|
|
|
|
inx = imw - br; iny = imh - bb;
|
|
|
|
inw = br; inh = bb;
|
|
|
|
outx = ox + iw - bsr; outy = oy + ih - bsb;
|
|
|
|
outw = bsr; outh = bsb;
|
2013-02-17 09:53:25 -08:00
|
|
|
if (eng->pixel_alpha_get(pixels, px, py, &alpha,
|
|
|
|
inx, iny, inw, inh,
|
|
|
|
outx, outy, outw, outh))
|
2012-12-19 14:41:12 -08:00
|
|
|
{
|
|
|
|
is_inside = alpha > 0;
|
|
|
|
dobreak_h = 1;
|
|
|
|
dobreak_w = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
idy += idh;
|
|
|
|
if (dobreak_h) break;
|
|
|
|
}
|
|
|
|
idx += idw;
|
|
|
|
idy = ydy;
|
|
|
|
if (dobreak_w) break;
|
|
|
|
}
|
|
|
|
}
|
2007-07-23 07:22:57 -07:00
|
|
|
}
|
|
|
|
|
2012-12-19 14:41:12 -08:00
|
|
|
return is_inside;
|
2007-07-23 07:22:57 -07:00
|
|
|
}
|
2008-05-18 20:13:16 -07:00
|
|
|
|
2009-02-16 20:53:03 -08:00
|
|
|
static int
|
2013-07-08 17:46:15 -07:00
|
|
|
evas_object_image_has_opaque_rect(Evas_Object *eo_obj EINA_UNUSED,
|
|
|
|
Evas_Object_Protected_Data *obj,
|
|
|
|
void *type_private_data)
|
2009-02-16 20:53:03 -08:00
|
|
|
{
|
2014-03-12 07:28:40 -07:00
|
|
|
Evas_Image_Data *o = type_private_data;
|
2009-09-03 22:13:19 -07:00
|
|
|
|
2013-01-21 19:56:00 -08:00
|
|
|
if ((obj->map->cur.map) && (obj->map->cur.usemap)) return 0;
|
2013-01-27 16:28:53 -08:00
|
|
|
if (((o->cur->border.l | o->cur->border.r | o->cur->border.t | o->cur->border.b) != 0) &&
|
|
|
|
(o->cur->border.fill == EVAS_BORDER_FILL_SOLID) &&
|
2013-03-12 05:58:19 -07:00
|
|
|
(obj->cur->render_op == EVAS_RENDER_BLEND) &&
|
|
|
|
(obj->cur->cache.clip.a == 255) &&
|
2013-01-27 16:28:53 -08:00
|
|
|
(o->cur->fill.x == 0) &&
|
|
|
|
(o->cur->fill.y == 0) &&
|
2013-03-12 05:58:19 -07:00
|
|
|
(o->cur->fill.w == obj->cur->geometry.w) &&
|
|
|
|
(o->cur->fill.h == obj->cur->geometry.h)
|
2009-02-16 20:53:03 -08:00
|
|
|
) return 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2013-07-08 17:46:15 -07:00
|
|
|
evas_object_image_get_opaque_rect(Evas_Object *eo_obj EINA_UNUSED,
|
|
|
|
Evas_Object_Protected_Data *obj,
|
|
|
|
void *type_private_data,
|
|
|
|
Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
|
2009-02-16 20:53:03 -08:00
|
|
|
{
|
2014-03-12 07:28:40 -07:00
|
|
|
Evas_Image_Data *o = type_private_data;
|
2009-09-03 22:13:19 -07:00
|
|
|
|
2013-01-27 16:28:53 -08:00
|
|
|
if (o->cur->border.scale == 1.0)
|
2010-02-20 22:21:15 -08:00
|
|
|
{
|
2013-03-12 05:58:19 -07:00
|
|
|
*x = obj->cur->geometry.x + o->cur->border.l;
|
|
|
|
*y = obj->cur->geometry.y + o->cur->border.t;
|
|
|
|
*w = obj->cur->geometry.w - (o->cur->border.l + o->cur->border.r);
|
2010-02-20 22:21:15 -08:00
|
|
|
if (*w < 0) *w = 0;
|
2013-03-12 05:58:19 -07:00
|
|
|
*h = obj->cur->geometry.h - (o->cur->border.t + o->cur->border.b);
|
2010-02-20 22:21:15 -08:00
|
|
|
if (*h < 0) *h = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-03-12 05:58:19 -07:00
|
|
|
*x = obj->cur->geometry.x + (o->cur->border.l * o->cur->border.scale);
|
|
|
|
*y = obj->cur->geometry.y + (o->cur->border.t * o->cur->border.scale);
|
|
|
|
*w = obj->cur->geometry.w - ((o->cur->border.l * o->cur->border.scale) + (o->cur->border.r * o->cur->border.scale));
|
2010-02-20 22:21:15 -08:00
|
|
|
if (*w < 0) *w = 0;
|
2013-03-12 05:58:19 -07:00
|
|
|
*h = obj->cur->geometry.h - ((o->cur->border.t * o->cur->border.scale) + (o->cur->border.b * o->cur->border.scale));
|
2010-02-20 22:21:15 -08:00
|
|
|
if (*h < 0) *h = 0;
|
|
|
|
}
|
2009-02-17 09:36:29 -08:00
|
|
|
return 1;
|
2009-02-16 20:53:03 -08:00
|
|
|
}
|
|
|
|
|
2009-10-28 01:59:01 -07:00
|
|
|
static int
|
2012-11-04 03:51:42 -08:00
|
|
|
evas_object_image_can_map(Evas_Object *obj EINA_UNUSED)
|
2009-10-28 01:59:01 -07:00
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2008-05-18 20:13:16 -07:00
|
|
|
static void *
|
2014-03-12 07:28:40 -07:00
|
|
|
evas_object_image_data_convert_internal(Evas_Image_Data *o, void *data, Evas_Colorspace to_cspace)
|
2008-05-18 20:13:16 -07:00
|
|
|
{
|
|
|
|
void *out = NULL;
|
|
|
|
|
|
|
|
if (!data)
|
|
|
|
return NULL;
|
|
|
|
|
2013-01-27 16:28:53 -08:00
|
|
|
switch (o->cur->cspace)
|
2008-05-18 20:13:16 -07:00
|
|
|
{
|
2012-09-04 01:42:38 -07:00
|
|
|
case EVAS_COLORSPACE_ARGB8888:
|
|
|
|
out = evas_common_convert_argb8888_to(data,
|
2013-01-27 16:28:53 -08:00
|
|
|
o->cur->image.w,
|
|
|
|
o->cur->image.h,
|
|
|
|
o->cur->image.stride >> 2,
|
|
|
|
o->cur->has_alpha,
|
2012-09-04 01:42:38 -07:00
|
|
|
to_cspace);
|
|
|
|
break;
|
|
|
|
case EVAS_COLORSPACE_RGB565_A5P:
|
|
|
|
out = evas_common_convert_rgb565_a5p_to(data,
|
2013-01-27 16:28:53 -08:00
|
|
|
o->cur->image.w,
|
|
|
|
o->cur->image.h,
|
|
|
|
o->cur->image.stride >> 1,
|
|
|
|
o->cur->has_alpha,
|
2012-09-04 01:42:38 -07:00
|
|
|
to_cspace);
|
|
|
|
break;
|
|
|
|
case EVAS_COLORSPACE_YCBCR422601_PL:
|
|
|
|
out = evas_common_convert_yuv_422_601_to(data,
|
2013-01-27 16:28:53 -08:00
|
|
|
o->cur->image.w,
|
|
|
|
o->cur->image.h,
|
2011-08-23 09:06:41 -07:00
|
|
|
to_cspace);
|
|
|
|
break;
|
|
|
|
case EVAS_COLORSPACE_YCBCR422P601_PL:
|
|
|
|
out = evas_common_convert_yuv_422P_601_to(data,
|
2013-01-27 16:28:53 -08:00
|
|
|
o->cur->image.w,
|
|
|
|
o->cur->image.h,
|
2011-08-23 09:06:41 -07:00
|
|
|
to_cspace);
|
|
|
|
break;
|
2011-08-29 13:56:48 -07:00
|
|
|
case EVAS_COLORSPACE_YCBCR420NV12601_PL:
|
|
|
|
out = evas_common_convert_yuv_420_601_to(data,
|
2013-01-27 16:28:53 -08:00
|
|
|
o->cur->image.w,
|
|
|
|
o->cur->image.h,
|
2011-08-29 13:56:48 -07:00
|
|
|
to_cspace);
|
|
|
|
break;
|
|
|
|
case EVAS_COLORSPACE_YCBCR420TM12601_PL:
|
|
|
|
out = evas_common_convert_yuv_420T_601_to(data,
|
2013-01-27 16:28:53 -08:00
|
|
|
o->cur->image.w,
|
|
|
|
o->cur->image.h,
|
2012-09-04 01:42:38 -07:00
|
|
|
to_cspace);
|
2011-08-29 13:56:48 -07:00
|
|
|
break;
|
2015-12-29 05:01:16 -08:00
|
|
|
case EVAS_COLORSPACE_AGRY88:
|
|
|
|
out = evas_common_convert_agry88_to(data,
|
|
|
|
o->cur->image.w,
|
|
|
|
o->cur->image.h,
|
|
|
|
o->cur->image.stride,
|
|
|
|
o->cur->has_alpha,
|
|
|
|
to_cspace);
|
|
|
|
break;
|
|
|
|
case EVAS_COLORSPACE_GRY8:
|
|
|
|
out = evas_common_convert_gry8_to(data,
|
|
|
|
o->cur->image.w,
|
|
|
|
o->cur->image.h,
|
|
|
|
o->cur->image.stride,
|
|
|
|
o->cur->has_alpha,
|
|
|
|
to_cspace);
|
|
|
|
break;
|
2012-09-04 01:42:38 -07:00
|
|
|
default:
|
2013-01-27 16:28:53 -08:00
|
|
|
WRN("unknow colorspace: %i\n", o->cur->cspace);
|
2012-09-04 01:42:38 -07:00
|
|
|
break;
|
2008-05-18 20:13:16 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return out;
|
|
|
|
}
|
2008-12-12 14:36:47 -08:00
|
|
|
|
|
|
|
static void
|
2012-11-04 03:51:42 -08:00
|
|
|
evas_object_image_filled_resize_listener(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void *einfo EINA_UNUSED)
|
2008-12-12 14:36:47 -08:00
|
|
|
{
|
|
|
|
Evas_Coord w, h;
|
2009-02-24 00:31:31 -08:00
|
|
|
|
2008-12-12 14:36:47 -08:00
|
|
|
evas_object_geometry_get(obj, NULL, NULL, &w, &h);
|
2015-02-11 19:10:04 -08:00
|
|
|
if (w < 1) w = 1;
|
|
|
|
if (h < 1) h = 1;
|
2008-12-12 14:36:47 -08:00
|
|
|
evas_object_image_fill_set(obj, 0, 0, w, h);
|
|
|
|
}
|
2011-02-06 15:52:17 -08:00
|
|
|
|
2011-05-02 20:20:02 -07:00
|
|
|
Eina_Bool
|
2012-10-08 18:58:41 -07:00
|
|
|
_evas_object_image_preloading_get(const Evas_Object *eo_obj)
|
2011-05-02 20:20:02 -07:00
|
|
|
{
|
2014-03-12 07:28:40 -07:00
|
|
|
Evas_Image_Data *o = eo_data_scope_get(eo_obj, MY_CLASS);
|
2011-05-02 20:20:02 -07:00
|
|
|
return o->preloading;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-10-08 18:58:41 -07:00
|
|
|
_evas_object_image_preloading_set(Evas_Object *eo_obj, Eina_Bool preloading)
|
2011-05-02 20:20:02 -07:00
|
|
|
{
|
2014-03-12 07:28:40 -07:00
|
|
|
Evas_Image_Data *o = eo_data_scope_get(eo_obj, MY_CLASS);
|
2011-05-02 20:20:02 -07:00
|
|
|
o->preloading = preloading;
|
|
|
|
}
|
|
|
|
|
2011-05-19 04:19:22 -07:00
|
|
|
void
|
2012-10-08 18:58:41 -07:00
|
|
|
_evas_object_image_preloading_check(Evas_Object *eo_obj)
|
2011-05-19 04:19:22 -07:00
|
|
|
{
|
2014-06-02 06:47:59 -07:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2014-03-12 07:28:40 -07:00
|
|
|
Evas_Image_Data *o = eo_data_scope_get(eo_obj, MY_CLASS);
|
2014-10-22 02:34:51 -07:00
|
|
|
if (ENFN->image_load_error_get)
|
|
|
|
o->load_error = ENFN->image_load_error_get(ENDT, o->engine_data);
|
2011-05-19 04:19:22 -07:00
|
|
|
}
|
|
|
|
|
2011-10-02 20:28:52 -07:00
|
|
|
Evas_Object *
|
2012-10-08 18:58:41 -07:00
|
|
|
_evas_object_image_video_parent_get(Evas_Object *eo_obj)
|
2011-10-02 20:28:52 -07:00
|
|
|
{
|
2014-03-12 07:28:40 -07:00
|
|
|
Evas_Image_Data *o = eo_data_scope_get(eo_obj, MY_CLASS);
|
2013-01-25 04:15:38 -08:00
|
|
|
return o->video_surface ? o->pixels->video.parent : NULL;
|
2011-10-02 20:28:52 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-10-08 18:58:41 -07:00
|
|
|
_evas_object_image_video_overlay_show(Evas_Object *eo_obj)
|
2011-10-02 20:28:52 -07:00
|
|
|
{
|
2014-06-02 06:47:59 -07:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2014-03-12 07:28:40 -07:00
|
|
|
Evas_Image_Data *o = eo_data_scope_get(eo_obj, MY_CLASS);
|
2011-10-02 20:28:52 -07:00
|
|
|
|
2013-03-12 05:58:19 -07:00
|
|
|
if (obj->cur->cache.clip.x != obj->prev->cache.clip.x ||
|
|
|
|
obj->cur->cache.clip.y != obj->prev->cache.clip.y ||
|
2011-10-04 02:34:01 -07:00
|
|
|
o->created || !o->video_visible)
|
2013-10-01 11:35:09 -07:00
|
|
|
o->delayed.video_move = EINA_TRUE;
|
|
|
|
|
2013-03-12 05:58:19 -07:00
|
|
|
if (obj->cur->cache.clip.w != obj->prev->cache.clip.w ||
|
|
|
|
obj->cur->cache.clip.h != obj->prev->cache.clip.h ||
|
2011-10-04 02:34:01 -07:00
|
|
|
o->created || !o->video_visible)
|
2013-10-01 11:35:09 -07:00
|
|
|
o->delayed.video_resize = EINA_TRUE;
|
|
|
|
|
2011-10-04 02:34:01 -07:00
|
|
|
if (!o->video_visible || o->created)
|
2011-10-13 02:23:42 -07:00
|
|
|
{
|
2013-10-01 11:35:09 -07:00
|
|
|
o->delayed.video_show = EINA_TRUE;
|
|
|
|
o->delayed.video_hide = EINA_FALSE;
|
2011-10-13 02:23:42 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Cancel dirty on the image */
|
|
|
|
Eina_Rectangle *r;
|
|
|
|
|
2012-09-04 01:56:46 -07:00
|
|
|
o->dirty_pixels = EINA_FALSE;
|
2013-01-25 04:15:38 -08:00
|
|
|
|
|
|
|
EINA_COW_PIXEL_WRITE_BEGIN(o, pixi_write)
|
|
|
|
{
|
|
|
|
EINA_LIST_FREE(pixi_write->pixel_updates, r)
|
|
|
|
eina_rectangle_free(r);
|
|
|
|
}
|
|
|
|
EINA_COW_PIXEL_WRITE_END(o, pixi_write);
|
2011-10-13 02:23:42 -07:00
|
|
|
}
|
2011-10-02 20:28:52 -07:00
|
|
|
o->video_visible = EINA_TRUE;
|
|
|
|
o->created = EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-10-08 18:58:41 -07:00
|
|
|
_evas_object_image_video_overlay_hide(Evas_Object *eo_obj)
|
2011-10-02 20:28:52 -07:00
|
|
|
{
|
2014-06-02 06:47:59 -07:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2014-03-12 07:28:40 -07:00
|
|
|
Evas_Image_Data *o = eo_data_scope_get(eo_obj, MY_CLASS);
|
2011-10-02 20:28:52 -07:00
|
|
|
|
|
|
|
if (o->video_visible || o->created)
|
2013-10-01 11:35:09 -07:00
|
|
|
{
|
|
|
|
o->delayed.video_hide = EINA_TRUE;
|
|
|
|
o->delayed.video_show = EINA_FALSE;
|
|
|
|
}
|
2012-10-08 18:58:41 -07:00
|
|
|
if (evas_object_is_visible(eo_obj, obj))
|
2013-01-25 04:15:38 -08:00
|
|
|
o->pixels->video.update_pixels(o->pixels->video.data, eo_obj, &o->pixels->video);
|
2011-10-02 20:28:52 -07:00
|
|
|
o->video_visible = EINA_FALSE;
|
|
|
|
o->created = EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2013-10-01 11:35:09 -07:00
|
|
|
void
|
|
|
|
_evas_object_image_video_overlay_do(Evas_Object *eo_obj)
|
|
|
|
{
|
2014-06-02 06:47:59 -07:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2014-03-12 07:28:40 -07:00
|
|
|
Evas_Image_Data *o = eo_data_scope_get(eo_obj, MY_CLASS);
|
2013-10-01 11:35:09 -07:00
|
|
|
Evas_Public_Data *e = obj->layer->evas;
|
|
|
|
|
|
|
|
if (o->delayed.video_move)
|
|
|
|
o->pixels->video.move(o->pixels->video.data, eo_obj, &o->pixels->video,
|
|
|
|
obj->cur->cache.clip.x + e->framespace.x,
|
|
|
|
obj->cur->cache.clip.y + e->framespace.y);
|
|
|
|
|
|
|
|
if (o->delayed.video_resize)
|
|
|
|
o->pixels->video.resize(o->pixels->video.data, eo_obj,
|
|
|
|
&o->pixels->video,
|
|
|
|
obj->cur->cache.clip.w,
|
|
|
|
obj->cur->cache.clip.h);
|
|
|
|
|
|
|
|
if (o->delayed.video_show)
|
|
|
|
o->pixels->video.show(o->pixels->video.data, eo_obj, &o->pixels->video);
|
|
|
|
else if (o->delayed.video_hide)
|
|
|
|
o->pixels->video.hide(o->pixels->video.data, eo_obj, &o->pixels->video);
|
|
|
|
|
|
|
|
o->delayed.video_move = EINA_FALSE;
|
|
|
|
o->delayed.video_resize = EINA_FALSE;
|
|
|
|
o->delayed.video_show = EINA_FALSE;
|
|
|
|
o->delayed.video_hide = EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2015-05-09 11:02:13 -07:00
|
|
|
void *
|
|
|
|
_evas_object_image_surface_get(Evas_Object *eo, Evas_Object_Protected_Data *obj)
|
|
|
|
{
|
|
|
|
Evas_Image_Data *pd = eo_data_scope_get(eo, EVAS_IMAGE_CLASS);
|
|
|
|
|
|
|
|
if (pd->engine_data &&
|
2015-10-07 04:03:37 -07:00
|
|
|
(pd->cur->image.w == obj->cur->geometry.w) &&
|
|
|
|
(pd->cur->image.h == obj->cur->geometry.h))
|
2015-05-09 11:02:13 -07:00
|
|
|
return pd->engine_data;
|
|
|
|
|
|
|
|
if (pd->engine_data)
|
|
|
|
ENFN->image_free(ENDT, pd->engine_data);
|
|
|
|
|
|
|
|
// FIXME: alpha forced to 1 for now, need to figure out Evas alpha here
|
2015-10-07 04:03:37 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_BEGIN(pd, state_write)
|
2015-05-09 11:02:13 -07:00
|
|
|
{
|
|
|
|
pd->engine_data = ENFN->image_map_surface_new(ENDT,
|
|
|
|
obj->cur->geometry.w,
|
|
|
|
obj->cur->geometry.h,
|
|
|
|
1);
|
2015-10-07 04:03:37 -07:00
|
|
|
state_write->image.w = obj->cur->geometry.w;
|
|
|
|
state_write->image.h = obj->cur->geometry.h;
|
2015-05-09 11:02:13 -07:00
|
|
|
}
|
2015-10-07 04:03:37 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_END(pd, state_write);
|
2015-05-09 11:02:13 -07:00
|
|
|
|
|
|
|
return pd->engine_data;
|
|
|
|
}
|
|
|
|
|
2016-03-03 23:51:37 -08:00
|
|
|
EOLIAN static void *
|
|
|
|
_evas_image_efl_gfx_buffer_buffer_get(Eo *eo_obj, Evas_Image_Data *o,
|
2016-03-10 23:04:15 -08:00
|
|
|
Eina_Bool to_write,
|
2016-03-03 23:51:37 -08:00
|
|
|
int *width, int *height, int *stride_out,
|
2016-03-10 23:04:15 -08:00
|
|
|
Efl_Gfx_Colorspace *cspace)
|
2016-03-03 23:51:37 -08:00
|
|
|
{
|
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2016-03-10 23:04:15 -08:00
|
|
|
int stride = 0;
|
2016-03-03 23:51:37 -08:00
|
|
|
void *data;
|
|
|
|
|
|
|
|
// use the old api - same behaviour with more return info
|
|
|
|
data = evas_object_image_data_get(eo_obj, to_write);
|
|
|
|
if (!data) goto end;
|
|
|
|
|
|
|
|
// FIXME: length needs to be properly checked with the engine
|
|
|
|
// as we just ignore l,r,t,b here
|
|
|
|
ENFN->image_stride_get(ENDT, o->engine_data, &stride);
|
2016-03-10 23:04:15 -08:00
|
|
|
if (!stride)
|
|
|
|
stride = _evas_common_rgba_image_surface_size(o->cur->image.w, 1, o->cur->cspace, NULL, NULL, NULL, NULL);
|
2016-03-03 23:51:37 -08:00
|
|
|
|
|
|
|
end:
|
|
|
|
if (width) *width = o->cur->image.w;
|
|
|
|
if (height) *height = o->cur->image.h;
|
|
|
|
if (cspace) *cspace = (Efl_Gfx_Colorspace) o->cur->cspace;
|
|
|
|
if (stride_out) *stride_out = stride;
|
|
|
|
return data;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_evas_image_buffer_set_common(Eo *obj, Evas_Image_Data *o, void *pixels,
|
|
|
|
int width, int height, int stride,
|
2016-03-10 23:04:15 -08:00
|
|
|
Efl_Gfx_Colorspace cspace, Eina_Bool copy)
|
2016-03-03 23:51:37 -08:00
|
|
|
{
|
|
|
|
Evas_Colorspace cs = (Evas_Colorspace) cspace;
|
|
|
|
int stride_min;
|
|
|
|
|
|
|
|
stride_min = _evas_common_rgba_image_surface_size(width, 1, cs, NULL, NULL, NULL, NULL);
|
|
|
|
if (!stride) stride = stride_min;
|
|
|
|
if (stride < stride_min)
|
|
|
|
{
|
|
|
|
ERR("Image stride is too small: given %d needs %d", stride, stride_min);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
if (stride > stride_min) // FIXME/TODO
|
|
|
|
{
|
|
|
|
ERR("Image stride support is not implemented: given %d needs %d", stride, stride_min);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cs != o->cur->cspace)
|
|
|
|
evas_object_image_colorspace_set(obj, cs);
|
|
|
|
|
|
|
|
if ((width != o->cur->image.w) || (height != o->cur->image.h))
|
|
|
|
evas_object_image_size_set(obj, width, height);
|
|
|
|
|
|
|
|
if (!pixels)
|
|
|
|
evas_object_image_data_set(obj, NULL);
|
|
|
|
else if (!copy)
|
|
|
|
evas_object_image_data_set(obj, pixels);
|
|
|
|
else
|
|
|
|
evas_object_image_data_copy_set(obj, pixels);
|
|
|
|
|
|
|
|
return o->engine_data ? EINA_TRUE : EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_evas_image_efl_gfx_buffer_buffer_set(Eo *obj, Evas_Image_Data *o, void *pixels,
|
|
|
|
int width, int height, int stride,
|
2016-03-10 23:04:15 -08:00
|
|
|
Efl_Gfx_Colorspace cspace)
|
2016-03-03 23:51:37 -08:00
|
|
|
{
|
2016-03-10 23:04:15 -08:00
|
|
|
return _evas_image_buffer_set_common(obj, o, pixels, width, height, stride, cspace, EINA_FALSE);
|
2016-03-03 23:51:37 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_evas_image_efl_gfx_buffer_buffer_copy_set(Eo *obj, Evas_Image_Data *o, const void *pixels,
|
|
|
|
int width, int height, int stride,
|
2016-03-10 23:04:15 -08:00
|
|
|
Efl_Gfx_Colorspace cspace)
|
2016-03-03 23:51:37 -08:00
|
|
|
{
|
2016-03-10 23:04:15 -08:00
|
|
|
return _evas_image_buffer_set_common(obj, o, (void *) pixels, width, height, stride, cspace, EINA_TRUE);
|
2016-03-03 23:51:37 -08:00
|
|
|
}
|
|
|
|
|
2016-03-03 22:57:36 -08:00
|
|
|
/* Legacy deprecated functions */
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
evas_object_image_data_set(Eo *eo_obj, void *data)
|
|
|
|
{
|
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
|
|
|
Evas_Image_Data *o = eo_data_scope_get(eo_obj, MY_CLASS);
|
|
|
|
void *p_data;
|
|
|
|
Eina_Bool resize_call = EINA_FALSE;
|
|
|
|
|
|
|
|
|
|
|
|
evas_object_async_block(obj);
|
|
|
|
evas_render_rendering_wait(obj->layer->evas);
|
|
|
|
|
2016-03-07 21:11:07 -08:00
|
|
|
_evas_image_cleanup(eo_obj, obj, o);
|
2016-03-03 22:57:36 -08:00
|
|
|
p_data = o->engine_data;
|
|
|
|
if (data)
|
|
|
|
{
|
|
|
|
if (o->engine_data)
|
|
|
|
{
|
|
|
|
o->engine_data = ENFN->image_data_put(ENDT, o->engine_data, data);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
o->engine_data = ENFN->image_new_from_data(ENDT,
|
|
|
|
o->cur->image.w,
|
|
|
|
o->cur->image.h,
|
|
|
|
data,
|
|
|
|
o->cur->has_alpha,
|
|
|
|
o->cur->cspace);
|
|
|
|
}
|
|
|
|
if (o->engine_data)
|
|
|
|
{
|
|
|
|
int stride = 0;
|
|
|
|
|
|
|
|
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 = o->cur->image.w * 4;
|
|
|
|
|
|
|
|
if (o->cur->image.stride != stride)
|
|
|
|
{
|
|
|
|
EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
|
|
|
|
state_write->image.stride = stride;
|
|
|
|
EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
o->written = EINA_TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (o->engine_data)
|
|
|
|
ENFN->image_free(ENDT, o->engine_data);
|
|
|
|
o->load_error = EVAS_LOAD_ERROR_NONE;
|
|
|
|
if ((o->cur->image.w != 0) || (o->cur->image.h != 0))
|
|
|
|
resize_call = EINA_TRUE;
|
|
|
|
|
|
|
|
EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
|
|
|
|
{
|
|
|
|
state_write->image.w = 0;
|
|
|
|
state_write->image.h = 0;
|
|
|
|
state_write->image.stride = 0;
|
|
|
|
}
|
|
|
|
EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
|
|
|
|
|
|
|
|
o->engine_data = NULL;
|
|
|
|
}
|
|
|
|
/* FIXME - in engine call above
|
|
|
|
if (o->engine_data)
|
|
|
|
o->engine_data = ENFN->image_alpha_set(ENDT, o->engine_data, o->cur->has_alpha);
|
|
|
|
*/
|
|
|
|
if (o->pixels_checked_out > 0) o->pixels_checked_out--;
|
|
|
|
if (p_data != o->engine_data)
|
|
|
|
{
|
|
|
|
EVAS_OBJECT_WRITE_IMAGE_FREE_FILE_AND_KEY(o);
|
|
|
|
o->pixels_checked_out = 0;
|
|
|
|
}
|
|
|
|
if (resize_call) evas_object_inform_call_image_resize(eo_obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void*
|
|
|
|
evas_object_image_data_get(const Eo *eo_obj, Eina_Bool for_writing)
|
|
|
|
{
|
|
|
|
Evas_Image_Data *o = eo_data_scope_get(eo_obj, MY_CLASS);
|
|
|
|
int stride = 0;
|
|
|
|
void *pixels;
|
|
|
|
DATA32 *data;
|
|
|
|
|
|
|
|
if (!o->engine_data) return NULL;
|
|
|
|
|
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
|
|
|
|
|
|
|
if (for_writing) evas_object_async_block(obj);
|
|
|
|
if (for_writing) evas_render_rendering_wait(obj->layer->evas);
|
|
|
|
|
|
|
|
data = NULL;
|
|
|
|
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);
|
|
|
|
pixels = ENFN->image_data_get(ENDT, o->engine_data, for_writing, &data, &o->load_error, NULL);
|
|
|
|
|
|
|
|
/* if we fail to get engine_data, we have to return NULL */
|
|
|
|
if (!pixels) return NULL;
|
|
|
|
|
|
|
|
o->engine_data = pixels;
|
|
|
|
if (ENFN->image_stride_get)
|
|
|
|
ENFN->image_stride_get(ENDT, o->engine_data, &stride);
|
|
|
|
else
|
|
|
|
stride = o->cur->image.w * 4;
|
|
|
|
|
|
|
|
if (o->cur->image.stride != stride)
|
|
|
|
{
|
|
|
|
EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
|
|
|
|
state_write->image.stride = stride;
|
|
|
|
EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
|
|
|
|
}
|
|
|
|
|
|
|
|
o->pixels_checked_out++;
|
|
|
|
if (for_writing)
|
|
|
|
{
|
|
|
|
o->written = EINA_TRUE;
|
|
|
|
EVAS_OBJECT_WRITE_IMAGE_FREE_FILE_AND_KEY(o);
|
|
|
|
}
|
|
|
|
|
|
|
|
return data;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
evas_object_image_data_copy_set(Eo *eo_obj, void *data)
|
|
|
|
{
|
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
|
|
|
Evas_Image_Data *o = eo_data_scope_get(eo_obj, MY_CLASS);
|
|
|
|
|
|
|
|
if (!data) return;
|
|
|
|
evas_object_async_block(obj);
|
2016-03-07 21:11:07 -08:00
|
|
|
_evas_image_cleanup(eo_obj, obj, o);
|
2016-03-03 22:57:36 -08:00
|
|
|
if ((o->cur->image.w <= 0) ||
|
|
|
|
(o->cur->image.h <= 0)) return;
|
|
|
|
if (o->engine_data)
|
|
|
|
ENFN->image_free(ENDT, o->engine_data);
|
|
|
|
o->engine_data = ENFN->image_new_from_copied_data(ENDT,
|
|
|
|
o->cur->image.w,
|
|
|
|
o->cur->image.h,
|
|
|
|
data,
|
|
|
|
o->cur->has_alpha,
|
|
|
|
o->cur->cspace);
|
|
|
|
if (o->engine_data)
|
|
|
|
{
|
|
|
|
int stride = 0;
|
|
|
|
|
|
|
|
o->engine_data =
|
|
|
|
ENFN->image_alpha_set(ENDT, o->engine_data, o->cur->has_alpha);
|
|
|
|
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 = o->cur->image.w * 4;
|
|
|
|
|
|
|
|
if (o->cur->image.stride != stride)
|
|
|
|
{
|
|
|
|
EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
|
|
|
|
state_write->image.stride = stride;
|
|
|
|
EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
|
|
|
|
}
|
|
|
|
o->written = EINA_TRUE;
|
|
|
|
}
|
|
|
|
o->pixels_checked_out = 0;
|
|
|
|
EVAS_OBJECT_WRITE_IMAGE_FREE_FILE_AND_KEY(o);
|
|
|
|
}
|
|
|
|
|
2016-03-01 23:38:57 -08:00
|
|
|
/* 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,
|
2016-03-14 03:38:44 -07:00
|
|
|
efl_gfx_fill_filled_set(eoid, EINA_FALSE),
|
|
|
|
evas_obj_legacy_ctor(eoid));
|
2016-03-01 23:38:57 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
2016-03-14 03:38:44 -07:00
|
|
|
return eo_add(EVAS_IMAGE_CLASS, eo_e,
|
|
|
|
evas_obj_legacy_ctor(eoid));
|
2016-03-01 23:38:57 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2016-03-02 03:46:11 -08:00
|
|
|
evas_object_image_fill_set(Evas_Image *obj,
|
|
|
|
Evas_Coord x, Evas_Coord y,
|
|
|
|
Evas_Coord w, Evas_Coord h)
|
2016-03-01 23:38:57 -08:00
|
|
|
{
|
2016-03-02 03:46:11 -08:00
|
|
|
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);
|
2016-03-01 23:38:57 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
evas_object_image_filled_get(const Evas_Object *eo_obj)
|
|
|
|
{
|
2016-03-02 03:46:11 -08:00
|
|
|
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);
|
2016-03-01 23:38:57 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
evas_object_image_fill_get(const Evas_Image *obj,
|
|
|
|
Evas_Coord *x, Evas_Coord *y,
|
|
|
|
Evas_Coord *w, Evas_Coord *h)
|
|
|
|
{
|
2016-03-02 03:46:11 -08:00
|
|
|
efl_gfx_fill_get(obj, x, y, w, h);
|
2016-03-01 23:38:57 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2016-03-02 03:46:11 -08:00
|
|
|
EAPI void
|
|
|
|
evas_object_image_alpha_set(Evas_Object *obj, Eina_Bool alpha)
|
|
|
|
{
|
|
|
|
efl_image_alpha_set(obj, alpha);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
evas_object_image_alpha_get(const Evas_Object *obj)
|
|
|
|
{
|
|
|
|
return efl_image_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)
|
|
|
|
{
|
2016-03-03 22:57:36 -08:00
|
|
|
efl_gfx_view_size_get(obj, w, h);
|
2016-03-02 03:46:11 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
2016-03-03 22:57:36 -08:00
|
|
|
efl_gfx_buffer_update_add(obj, x, y, w, h);
|
2016-03-01 23:38:57 -08:00
|
|
|
}
|
|
|
|
|
2014-07-22 06:55:51 -07:00
|
|
|
EAPI void
|
|
|
|
evas_object_image_file_set(Eo *obj, const char *file, const char *key)
|
|
|
|
{
|
2016-03-02 03:46:11 -08:00
|
|
|
efl_file_set(obj, file, key);
|
2014-07-22 06:55:51 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
evas_object_image_file_get(const Eo *obj, const char **file, const char **key)
|
|
|
|
{
|
2016-03-02 03:46:11 -08:00
|
|
|
efl_file_get(obj, file, key);
|
2014-07-22 06:55:51 -07:00
|
|
|
}
|
|
|
|
|
2015-04-03 07:23:13 -07:00
|
|
|
EAPI void
|
|
|
|
evas_object_image_mmap_set(Evas_Image *obj, const Eina_File *f, const char *key)
|
|
|
|
{
|
2016-03-02 03:46:11 -08:00
|
|
|
efl_file_mmap_set(obj, f, key);
|
2015-04-03 07:23:13 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
evas_object_image_mmap_get(const Evas_Image *obj, const Eina_File **f, const char **key)
|
|
|
|
{
|
2016-03-02 03:46:11 -08:00
|
|
|
efl_file_mmap_get(obj, f, key);
|
2015-04-03 07:23:13 -07:00
|
|
|
}
|
2014-07-22 06:55:51 -07:00
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
evas_object_image_save(const Eo *obj, const char *file, const char *key, const char *flags)
|
|
|
|
{
|
2016-03-02 03:46:11 -08:00
|
|
|
return efl_file_save(obj, file, key, flags);
|
2014-07-22 06:55:51 -07:00
|
|
|
}
|
|
|
|
|
2014-07-23 09:03:40 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
evas_object_image_animated_get(const Eo *obj)
|
|
|
|
{
|
2016-03-02 03:46:11 -08:00
|
|
|
return efl_image_animated_get(obj);
|
2014-07-23 09:03:40 -07:00
|
|
|
}
|
|
|
|
|
2016-03-02 01:12:29 -08:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2014-07-23 09:03:40 -07:00
|
|
|
EAPI void
|
|
|
|
evas_object_image_load_size_set(Eo *obj, int w, int h)
|
|
|
|
{
|
2016-03-02 03:46:11 -08:00
|
|
|
efl_image_load_size_set(obj, w, h);
|
2014-07-23 09:03:40 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
evas_object_image_load_size_get(const Eo *obj, int *w, int *h)
|
|
|
|
{
|
2016-03-02 03:46:11 -08:00
|
|
|
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);
|
2014-07-23 09:03:40 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
evas_object_image_smooth_scale_set(Eo *obj, Eina_Bool smooth_scale)
|
|
|
|
{
|
2016-03-02 03:46:11 -08:00
|
|
|
efl_image_smooth_scale_set(obj, smooth_scale);
|
2014-07-23 09:03:40 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
evas_object_image_smooth_scale_get(const Eo *obj)
|
|
|
|
{
|
2016-03-02 03:46:11 -08:00
|
|
|
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);
|
2014-07-23 09:03:40 -07:00
|
|
|
}
|
|
|
|
|
2016-03-14 03:38:44 -07:00
|
|
|
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);
|
2016-03-09 22:13:20 -08:00
|
|
|
return _evas_image_proxy_source_set(eo, src);
|
2016-03-14 03:38:44 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Evas_Object *
|
|
|
|
evas_object_image_source_get(const Evas_Object *eo)
|
|
|
|
{
|
|
|
|
EVAS_OBJECT_LEGACY_API(eo, NULL);
|
2016-03-09 22:13:20 -08:00
|
|
|
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);
|
2016-03-14 03:38:44 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
evas_object_image_source_clip_set(Evas_Object *eo, Eina_Bool source_clip)
|
|
|
|
{
|
|
|
|
EVAS_OBJECT_LEGACY_API(eo);
|
2016-03-09 22:13:20 -08:00
|
|
|
_evas_image_proxy_source_clip_set(eo, source_clip);
|
2016-03-14 03:38:44 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
evas_object_image_source_clip_get(const Evas_Object *eo)
|
|
|
|
{
|
|
|
|
EVAS_OBJECT_LEGACY_API(eo, EINA_FALSE);
|
2016-03-09 22:13:20 -08:00
|
|
|
return _evas_image_proxy_source_clip_get(eo);
|
2016-03-14 03:38:44 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
evas_object_image_source_events_set(Evas_Object *eo, Eina_Bool repeat)
|
|
|
|
{
|
|
|
|
EVAS_OBJECT_LEGACY_API(eo);
|
2016-03-09 22:13:20 -08:00
|
|
|
_evas_image_proxy_source_events_set(eo, repeat);
|
2016-03-14 03:38:44 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
evas_object_image_source_events_get(const Evas_Object *eo)
|
|
|
|
{
|
|
|
|
EVAS_OBJECT_LEGACY_API(eo, EINA_FALSE);
|
2016-03-09 22:13:20 -08:00
|
|
|
return _evas_image_proxy_source_events_get(eo);
|
2016-03-14 03:38:44 -07:00
|
|
|
}
|
|
|
|
|
2016-03-10 20:59:14 -08:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2016-03-14 03:38:44 -07:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2016-03-10 20:56:14 -08:00
|
|
|
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.");
|
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
#include "canvas/evas_image.eo.c"
|
2015-04-14 06:21:52 -07:00
|
|
|
|
|
|
|
/* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/
|