2014-09-23 12:48:16 -07:00
|
|
|
#include "evas_common_private.h"
|
|
|
|
|
2011-03-14 03:53:37 -07:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <unistd.h>
|
2011-12-05 06:32:10 -08:00
|
|
|
#ifdef HAVE_SYS_MMAN_H
|
2011-12-05 06:00:53 -08:00
|
|
|
# include <sys/mman.h>
|
|
|
|
#endif
|
2011-10-10 23:06:11 -07:00
|
|
|
#include <math.h>
|
2011-03-14 03:53:37 -07:00
|
|
|
|
2011-12-05 08:50:40 -08:00
|
|
|
#include "evas_private.h"
|
2012-11-27 10:23:25 -08:00
|
|
|
#ifdef EVAS_CSERVE2
|
|
|
|
#include "../cserve2/evas_cs2_private.h"
|
|
|
|
#endif
|
2012-11-04 03:51:42 -08:00
|
|
|
#include "../common/evas_convert_color.h"
|
|
|
|
#include "../common/evas_convert_colorspace.h"
|
|
|
|
#include "../common/evas_convert_yuv.h"
|
2014-03-17 00:10:03 -07:00
|
|
|
#include "evas_filter.h"
|
2008-11-04 01:19:35 -08:00
|
|
|
|
2014-06-02 06:47:59 -07:00
|
|
|
#define MY_CLASS EVAS_IMAGE_CLASS
|
2012-10-08 18:58:41 -07:00
|
|
|
|
2013-11-07 03:16:01 -08:00
|
|
|
#define MY_CLASS_NAME "Evas_Image"
|
2013-01-28 22:36:23 -08:00
|
|
|
|
2011-02-06 20:18:37 -08:00
|
|
|
#define VERBOSE_PROXY_ERROR 1
|
|
|
|
|
2014-10-22 02:34:51 -07:00
|
|
|
/* save typing */
|
|
|
|
#define ENFN obj->layer->evas->engine.func
|
|
|
|
#define ENDT obj->layer->evas->engine.data.output
|
|
|
|
|
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;
|
|
|
|
|
2008-11-04 01:19:35 -08:00
|
|
|
/* private struct for rectangle object internal data */
|
2014-03-12 07:28:40 -07:00
|
|
|
typedef struct _Evas_Object_Image Evas_Image_Data;
|
2013-01-23 17:50:57 -08:00
|
|
|
typedef struct _Evas_Object_Image_Load_Opts Evas_Object_Image_Load_Opts;
|
2013-01-25 04:15:38 -08:00
|
|
|
typedef struct _Evas_Object_Image_Pixels Evas_Object_Image_Pixels;
|
2013-01-27 16:28:53 -08:00
|
|
|
typedef struct _Evas_Object_Image_State Evas_Object_Image_State;
|
2013-01-23 17:50:57 -08:00
|
|
|
|
|
|
|
struct _Evas_Object_Image_Load_Opts
|
|
|
|
{
|
|
|
|
unsigned char scale_down_by;
|
|
|
|
double dpi;
|
|
|
|
short w, h;
|
|
|
|
struct {
|
|
|
|
short x, y, w, h;
|
|
|
|
} region;
|
|
|
|
struct {
|
|
|
|
int src_x, src_y, src_w, src_h;
|
|
|
|
int dst_w, dst_h;
|
|
|
|
int smooth;
|
|
|
|
int scale_hint;
|
|
|
|
} scale_load;
|
|
|
|
Eina_Bool orientation : 1;
|
|
|
|
};
|
2008-11-04 01:19:35 -08:00
|
|
|
|
2013-01-25 04:15:38 -08:00
|
|
|
struct _Evas_Object_Image_Pixels
|
|
|
|
{
|
|
|
|
Eina_List *pixel_updates;
|
|
|
|
struct {
|
|
|
|
Evas_Object_Image_Pixels_Get_Cb get_pixels;
|
|
|
|
void *get_pixels_data;
|
|
|
|
} func;
|
|
|
|
|
|
|
|
Evas_Video_Surface 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
|
|
|
unsigned int video_caps;
|
2013-01-25 04:15:38 -08:00
|
|
|
};
|
|
|
|
|
2013-01-27 16:28:53 -08:00
|
|
|
struct _Evas_Object_Image_State
|
2008-11-04 01:19:35 -08:00
|
|
|
{
|
2013-03-12 05:58:19 -07:00
|
|
|
Evas_Coord_Rectangle fill;
|
|
|
|
struct {
|
|
|
|
short w, h, stride;
|
|
|
|
} image;
|
|
|
|
struct {
|
2013-04-06 23:33:58 -07:00
|
|
|
double scale;
|
2013-03-12 05:58:19 -07:00
|
|
|
short l, r, t, b;
|
|
|
|
unsigned char fill;
|
|
|
|
} border;
|
|
|
|
|
2015-01-20 09:21:03 -08:00
|
|
|
const Evas_Object_Filter_Data *filter;
|
|
|
|
|
2013-03-12 05:58:19 -07:00
|
|
|
Evas_Object *source;
|
|
|
|
Evas_Map *defmap;
|
2013-12-26 23:56:30 -08:00
|
|
|
Evas_3D_Scene *scene;
|
|
|
|
|
2013-07-11 00:03:01 -07:00
|
|
|
union {
|
|
|
|
const char *file;
|
|
|
|
Eina_File *f;
|
|
|
|
} u;
|
2013-03-12 05:58:19 -07:00
|
|
|
const char *key;
|
|
|
|
int frame;
|
2013-07-11 00:03:01 -07:00
|
|
|
int spread;
|
2013-03-12 05:58:19 -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
|
|
|
Evas_Colorspace cspace;
|
|
|
|
Evas_Image_Orient orient;
|
2013-04-06 23:33:58 -07:00
|
|
|
|
2013-03-12 05:58:19 -07:00
|
|
|
Eina_Bool smooth_scale : 1;
|
|
|
|
Eina_Bool has_alpha :1;
|
|
|
|
Eina_Bool opaque_valid : 1;
|
|
|
|
Eina_Bool opaque : 1;
|
2013-07-11 00:03:01 -07:00
|
|
|
Eina_Bool mmaped_source : 1;
|
2013-01-27 16:28:53 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _Evas_Object_Image
|
|
|
|
{
|
|
|
|
const Evas_Object_Image_State *cur;
|
|
|
|
const Evas_Object_Image_State *prev;
|
2008-11-04 01:19:35 -08:00
|
|
|
|
2013-01-23 17:50:57 -08:00
|
|
|
// This pointer is an Eina_Cow pointer
|
|
|
|
const Evas_Object_Image_Load_Opts *load_opts;
|
2013-01-25 04:15:38 -08:00
|
|
|
const Evas_Object_Image_Pixels *pixels;
|
2011-10-02 20:28:52 -07:00
|
|
|
|
2013-02-11 23:09:17 -08:00
|
|
|
void *engine_data;
|
|
|
|
|
|
|
|
int pixels_checked_out;
|
|
|
|
int load_error;
|
2008-11-04 01:19:35 -08:00
|
|
|
|
2010-03-06 20:19:17 -08:00
|
|
|
Evas_Image_Scale_Hint scale_hint;
|
|
|
|
Evas_Image_Content_Hint content_hint;
|
2009-09-03 22:13:19 -07:00
|
|
|
|
2012-09-04 01:56:46 -07:00
|
|
|
Eina_Bool changed : 1;
|
|
|
|
Eina_Bool dirty_pixels : 1;
|
|
|
|
Eina_Bool filled : 1;
|
|
|
|
Eina_Bool proxyrendering : 1;
|
|
|
|
Eina_Bool preloading : 1;
|
|
|
|
Eina_Bool video_surface : 1;
|
|
|
|
Eina_Bool video_visible : 1;
|
|
|
|
Eina_Bool created : 1;
|
2013-04-22 08:41:24 -07:00
|
|
|
Eina_Bool proxyerror : 1;
|
2013-04-28 23:30:37 -07:00
|
|
|
Eina_Bool proxy_src_clip : 1;
|
2013-06-12 22:09:28 -07:00
|
|
|
Eina_Bool written : 1;
|
2013-06-17 01:53:33 -07:00
|
|
|
Eina_Bool direct_render : 1;
|
2013-10-01 11:35:09 -07:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
Eina_Bool video_move : 1;
|
|
|
|
Eina_Bool video_resize : 1;
|
|
|
|
Eina_Bool video_show : 1;
|
|
|
|
Eina_Bool video_hide : 1;
|
|
|
|
} delayed;
|
2008-11-04 01:19:35 -08:00
|
|
|
};
|
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);
|
|
|
|
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
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
static void _proxy_unset(Evas_Object *proxy, Evas_Object_Protected_Data *obj, Evas_Image_Data *o);
|
2011-02-06 20:18:37 -08:00
|
|
|
static void _proxy_set(Evas_Object *proxy, Evas_Object *src);
|
2012-12-18 08:28:55 -08:00
|
|
|
static void _proxy_error(Evas_Object *proxy, void *context, void *output, void *surface, int x, int y, Eina_Bool do_async);
|
2011-02-06 20:18:37 -08:00
|
|
|
|
2013-12-26 23:56:30 -08:00
|
|
|
static void _3d_set(Evas_Object *eo_obj, Evas_3D_Scene *scene);
|
|
|
|
static void _3d_unset(Evas_Object *eo_obj, Evas_Object_Protected_Data *image, Evas_Image_Data *o);
|
|
|
|
|
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,
|
|
|
|
evas_object_image_can_map
|
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 = {
|
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
|
|
|
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
|
2015-01-20 09:21:03 -08:00
|
|
|
NULL, // filter
|
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-01-27 16:28:53 -08:00
|
|
|
EVAS_TEXTURE_REPEAT,
|
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
|
|
|
|
|
|
|
// flags
|
2013-11-10 21:25:43 -08:00
|
|
|
EINA_TRUE, EINA_FALSE, EINA_FALSE, EINA_FALSE, EINA_FALSE
|
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-03-12 05:58:19 -07:00
|
|
|
# define EINA_COW_IMAGE_STATE_WRITE_BEGIN(Obj, Write) \
|
2013-01-27 16:28:53 -08:00
|
|
|
EINA_COW_WRITE_BEGIN(evas_object_image_state_cow, Obj->cur, Evas_Object_Image_State, Write)
|
|
|
|
|
2013-03-12 05:58:19 -07:00
|
|
|
# define EINA_COW_IMAGE_STATE_WRITE_END(Obj, Write) \
|
2013-01-27 16:28:53 -08:00
|
|
|
EINA_COW_WRITE_END(evas_object_image_state_cow, Obj->cur, Write)
|
|
|
|
|
2014-10-21 19:27:11 -07:00
|
|
|
# define EINA_COW_IMAGE_FILTER_WRITE_BEGIN(State, Write) \
|
|
|
|
EINA_COW_WRITE_BEGIN(evas_object_filter_cow, State->filter, Evas_Object_Filter_Data, Write)
|
|
|
|
|
|
|
|
# define EINA_COW_IMAGE_FILTER_WRITE_END(State, Write) \
|
|
|
|
EINA_COW_WRITE_END(evas_object_filter_cow, State->filter, Write)
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2011-10-02 20:28:52 -07:00
|
|
|
static void
|
2014-03-12 07:28:40 -07:00
|
|
|
_evas_object_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
|
|
|
}
|
2013-05-06 22:23:53 -07:00
|
|
|
if (o->cur->source) _proxy_unset(eo_obj, obj, o);
|
2013-12-26 23:56:30 -08:00
|
|
|
if (o->cur->scene) _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
|
|
|
|
_init_cow(Eo *eo_obj)
|
|
|
|
{
|
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
|
|
|
{
|
|
|
|
eo_error_set(eo_obj);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static void
|
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-09-24 21:32:56 -07:00
|
|
|
Evas *eo_e;
|
2014-04-02 03:16:09 -07:00
|
|
|
Eo *parent = NULL;
|
2013-01-27 16:28:53 -08:00
|
|
|
Evas_Colorspace cspace;
|
2002-11-08 00:02:15 -08:00
|
|
|
|
2013-03-18 08:33:54 -07:00
|
|
|
eo_do_super(eo_obj, MY_CLASS, eo_constructor());
|
2013-09-24 21:32:56 -07:00
|
|
|
|
2014-04-02 03:16:09 -07:00
|
|
|
eo_do(eo_obj, parent = eo_parent_get());
|
2013-09-24 21:32:56 -07:00
|
|
|
eo_e = evas_object_evas_get(parent);
|
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_image_init(eo_obj);
|
|
|
|
evas_object_inject(eo_obj, obj, eo_e);
|
2013-01-23 17:50:57 -08:00
|
|
|
|
2013-01-25 04:15:38 -08:00
|
|
|
if (!_init_cow(eo_obj))
|
2013-06-20 04:28:18 -07:00
|
|
|
return;
|
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);
|
2013-01-27 16:28:53 -08:00
|
|
|
|
2014-10-21 22:14:58 -07:00
|
|
|
if (!o->cur->filter || (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;
|
2014-10-21 22:14:58 -07:00
|
|
|
if (!state_write->filter)
|
|
|
|
state_write->filter = eina_cow_alloc(evas_object_filter_cow);
|
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-10-08 18:58:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Evas_Object *
|
|
|
|
evas_object_image_add(Evas *eo_e)
|
|
|
|
{
|
|
|
|
MAGIC_CHECK(eo_e, Evas, MAGIC_EVAS);
|
2002-11-08 00:02:15 -08:00
|
|
|
return NULL;
|
|
|
|
MAGIC_CHECK_END();
|
2014-06-26 14:29:46 -07:00
|
|
|
Evas_Public_Data *e = eo_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
|
2012-12-12 01:45:49 -08:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(e, NULL);
|
2012-06-13 01:20:28 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(e->engine.func, NULL);
|
2014-06-02 06:47:59 -07:00
|
|
|
Evas_Object *eo_obj = eo_add(EVAS_IMAGE_CLASS, eo_e);
|
2012-10-08 18:58:41 -07:00
|
|
|
return eo_obj;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2008-12-12 14:36:47 -08:00
|
|
|
EAPI Evas_Object *
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_image_filled_add(Evas *eo_e)
|
2008-12-12 14:36:47 -08:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
Evas_Object *eo_obj;
|
|
|
|
eo_obj = evas_object_image_add(eo_e);
|
|
|
|
evas_object_image_filled_set(eo_obj, 1);
|
|
|
|
return eo_obj;
|
2008-12-12 14:36:47 -08:00
|
|
|
}
|
|
|
|
|
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 ;
|
|
|
|
eo_do(eo_obj, evas_obj_image_mmap_set(f, key));
|
|
|
|
eina_file_close(f);
|
2011-03-14 03:53:37 -07:00
|
|
|
}
|
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
static void
|
2013-11-03 18:27:59 -08:00
|
|
|
_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
|
|
|
{
|
2013-05-06 22:23:53 -07:00
|
|
|
if (o->cur->source) _proxy_unset(eo_obj, obj, o);
|
2013-12-26 23:56:30 -08:00
|
|
|
if (o->cur->scene) _3d_unset(eo_obj, obj, o);
|
|
|
|
|
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);
|
|
|
|
else if (state_write->u.f)
|
|
|
|
eina_file_close(state_write->u.f);
|
|
|
|
state_write->u.f = eina_file_dup(f);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!state_write->mmaped_source)
|
|
|
|
eina_stringshare_replace(&state_write->u.file, file);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (state_write->u.f) eina_file_close(state_write->u.f);
|
|
|
|
state_write->u.file = eina_stringshare_add(file);
|
|
|
|
}
|
|
|
|
}
|
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);
|
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
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-03-12 07:28:40 -07:00
|
|
|
_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
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_evas_image_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))
|
|
|
|
return;
|
|
|
|
if ((o->cur->key) && (key) && (!strcmp(o->cur->key, key)))
|
|
|
|
return;
|
|
|
|
}
|
2015-02-10 03:44:38 -08:00
|
|
|
evas_object_async_block(obj);
|
2013-05-07 23:37:37 -07:00
|
|
|
_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);
|
2013-05-07 23:37:37 -07:00
|
|
|
_image_done_set(eo_obj, obj, o);
|
|
|
|
}
|
|
|
|
|
2014-03-29 13:19:01 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_evas_image_mmap_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o, const Eina_File **f, const char **key)
|
|
|
|
{
|
|
|
|
if (f)
|
|
|
|
*f = o->cur->mmaped_source ? o->cur->u.f : NULL;
|
|
|
|
if (key)
|
|
|
|
*key = o->cur->key;
|
|
|
|
}
|
|
|
|
|
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);
|
2013-05-07 23:37:37 -07:00
|
|
|
_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);
|
2013-05-07 23:37:37 -07:00
|
|
|
_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
|
|
|
{
|
2013-07-11 00:03:01 -07:00
|
|
|
if (file) *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
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_evas_image_source_set(Eo *eo_obj, Evas_Image_Data *o, Evas_Object *eo_src)
|
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
|
|
|
|
|
|
|
if (obj->delete_me && eo_src)
|
2012-08-21 01:41:02 -07:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
WRN("Setting deleted object %p as image source %p", eo_src, eo_obj);
|
2014-03-12 07:28:40 -07:00
|
|
|
return EINA_FALSE;
|
2012-08-21 01:41:02 -07:00
|
|
|
}
|
2012-10-08 18:58:41 -07:00
|
|
|
if (eo_src)
|
2012-08-07 02:43:22 -07:00
|
|
|
{
|
2014-06-02 06:47:59 -07:00
|
|
|
Evas_Object_Protected_Data *src = eo_data_scope_get(eo_src, EVAS_OBJECT_CLASS);
|
2012-08-21 01:41:02 -07:00
|
|
|
if (src->delete_me)
|
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
WRN("Setting object %p to deleted image source %p", eo_src, eo_obj);
|
2014-03-12 07:28:40 -07:00
|
|
|
return EINA_FALSE;
|
2012-08-21 01:41:02 -07:00
|
|
|
}
|
2012-08-07 03:59:44 -07:00
|
|
|
if (!src->layer)
|
|
|
|
{
|
2014-03-13 19:44:49 -07:00
|
|
|
CRI("No evas surface associated with source object (%p)", eo_src);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
if (!obj->layer)
|
|
|
|
{
|
|
|
|
CRI("No evas surface associated with destination object (%p)", eo_obj);
|
2014-03-12 07:28:40 -07:00
|
|
|
return EINA_FALSE;
|
2012-08-07 03:59:44 -07:00
|
|
|
}
|
|
|
|
if ((obj->layer && src->layer) &&
|
|
|
|
(obj->layer->evas != src->layer->evas))
|
|
|
|
{
|
2013-12-25 19:22:05 -08:00
|
|
|
CRI("Setting object %p from Evas (%p) from another Evas (%p)", eo_src, src->layer->evas, obj->layer->evas);
|
2014-03-12 07:28:40 -07:00
|
|
|
return EINA_FALSE;
|
2012-08-07 03:59:44 -07:00
|
|
|
}
|
2012-10-08 18:58:41 -07:00
|
|
|
if (eo_src == eo_obj)
|
2012-08-07 03:59:44 -07:00
|
|
|
{
|
2013-12-25 19:22:05 -08:00
|
|
|
CRI("Setting object %p as a source for itself", obj);
|
2014-03-12 07:28:40 -07:00
|
|
|
return EINA_FALSE;
|
2012-08-07 03:59:44 -07:00
|
|
|
}
|
2012-08-07 02:43:22 -07:00
|
|
|
}
|
2014-03-12 07:28:40 -07:00
|
|
|
if (o->cur->source == eo_src) return EINA_TRUE;
|
2015-02-10 03:44:38 -08:00
|
|
|
evas_object_async_block(obj);
|
2012-10-09 00:49:07 -07:00
|
|
|
_evas_object_image_cleanup(eo_obj, obj, o);
|
2011-02-06 20:18:37 -08:00
|
|
|
/* Kill the image if any */
|
2013-07-11 00:03:01 -07:00
|
|
|
if (o->cur->u.file || o->cur->key)
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_image_file_set(eo_obj, NULL, NULL);
|
2011-02-06 20:18:37 -08:00
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
if (eo_src) _proxy_set(eo_obj, eo_src);
|
2013-05-06 22:23:53 -07:00
|
|
|
else _proxy_unset(eo_obj, obj, o);
|
2011-02-06 20:18:37 -08:00
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
return EINA_TRUE;
|
2012-10-08 18:58:41 -07:00
|
|
|
}
|
2011-02-06 20:18:37 -08:00
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static Evas_Object*
|
|
|
|
_evas_image_source_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->source;
|
2011-02-06 20:18:37 -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
|
|
|
|
_evas_image_orient_set(Eo *eo_obj, Evas_Image_Data *o, Evas_Image_Orient orient)
|
|
|
|
{
|
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(o->engine_data)
|
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Evas_Image_Orient
|
|
|
|
_evas_image_orient_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o)
|
|
|
|
{
|
|
|
|
return o->cur->orient;
|
|
|
|
}
|
|
|
|
|
2011-02-06 20:18:37 -08:00
|
|
|
EAPI Eina_Bool
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_image_source_unset(Evas_Object *eo_obj)
|
2011-02-06 20:18:37 -08:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
Eina_Bool result = EINA_FALSE;
|
2014-04-02 03:16:09 -07:00
|
|
|
eo_do(eo_obj, result = evas_obj_image_source_set(NULL));
|
2012-10-08 18:58:41 -07:00
|
|
|
return result;
|
2011-02-06 20:18:37 -08:00
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_evas_image_source_clip_set(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o, Eina_Bool source_clip)
|
2013-04-28 23:30:37 -07:00
|
|
|
{
|
|
|
|
Evas_Object_Protected_Data *src_obj;
|
2015-02-10 03:44:38 -08:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2013-04-28 23:30:37 -07:00
|
|
|
|
|
|
|
source_clip = !!source_clip;
|
|
|
|
if (o->proxy_src_clip == source_clip) return;
|
2015-02-10 03:44:38 -08:00
|
|
|
evas_object_async_block(obj);
|
2013-04-28 23:30:37 -07:00
|
|
|
o->proxy_src_clip = source_clip;
|
|
|
|
|
|
|
|
if (!o->cur->source) return;
|
|
|
|
|
2014-06-02 06:47:59 -07:00
|
|
|
src_obj = eo_data_scope_get(o->cur->source, EVAS_OBJECT_CLASS);
|
2013-04-28 23:30:37 -07:00
|
|
|
evas_object_change(o->cur->source, src_obj);
|
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_evas_image_source_clip_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o)
|
2013-04-28 23:30:37 -07:00
|
|
|
{
|
2014-03-12 07:28:40 -07:00
|
|
|
return o->proxy_src_clip;
|
2013-04-28 23:30:37 -07:00
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_evas_image_source_events_set(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o, Eina_Bool source_events)
|
2012-10-23 01:44:11 -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-23 01:44:11 -07:00
|
|
|
|
|
|
|
source_events = !!source_events;
|
2013-01-16 23:21:06 -08:00
|
|
|
if (obj->proxy->src_events == source_events) return;
|
|
|
|
|
2013-01-20 19:12:39 -08:00
|
|
|
EINA_COW_WRITE_BEGIN(evas_object_proxy_cow, obj->proxy, Evas_Object_Proxy_Data, proxy_write)
|
|
|
|
proxy_write->src_events = source_events;
|
|
|
|
EINA_COW_WRITE_END(evas_object_proxy_cow, obj->proxy, proxy_write);
|
2013-01-16 23:21:06 -08:00
|
|
|
|
2013-01-27 16:28:53 -08:00
|
|
|
if (!o->cur->source) return;
|
2013-01-16 23:21:06 -08:00
|
|
|
if ((obj->proxy->src_invisible) || (!source_events)) return;
|
2012-10-23 01:44:11 -07:00
|
|
|
//FIXME: Feed mouse events here.
|
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_evas_image_source_events_get(Eo *eo_obj, Evas_Image_Data *_pd EINA_UNUSED)
|
2012-10-23 01:44:11 -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
|
|
|
return obj->proxy->src_events;
|
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
|
|
|
{
|
2013-03-18 08:33:54 -07:00
|
|
|
eo_do_super(eo_obj, MY_CLASS, eo_dbg_info_get(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;
|
|
|
|
eo_do(eo_obj, error = evas_obj_image_load_error_get());
|
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
|
|
|
|
_evas_image_source_visible_set(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o, Eina_Bool visible)
|
2012-10-18 04:30:04 -07:00
|
|
|
{
|
|
|
|
Evas_Object_Protected_Data *src_obj;
|
2015-02-10 03:44:38 -08:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2012-10-18 04:30:04 -07:00
|
|
|
|
2013-01-27 16:28:53 -08:00
|
|
|
if (!o->cur->source) return;
|
2012-10-23 23:15:21 -07:00
|
|
|
|
|
|
|
visible = !!visible;
|
2014-06-02 06:47:59 -07:00
|
|
|
src_obj = eo_data_scope_get(o->cur->source, EVAS_OBJECT_CLASS);
|
2013-01-16 23:21:06 -08:00
|
|
|
if (src_obj->proxy->src_invisible == !visible) return;
|
|
|
|
|
2015-02-10 03:44:38 -08:00
|
|
|
evas_object_async_block(obj);
|
2013-01-20 19:12:39 -08:00
|
|
|
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);
|
2013-01-16 23:21:06 -08:00
|
|
|
|
2012-10-25 08:24:27 -07:00
|
|
|
src_obj->changed_src_visible = EINA_TRUE;
|
2013-01-27 16:28:53 -08:00
|
|
|
evas_object_smart_member_cache_invalidate(o->cur->source, EINA_FALSE,
|
2012-10-18 04:30:04 -07:00
|
|
|
EINA_FALSE, EINA_TRUE);
|
2013-01-27 16:28:53 -08:00
|
|
|
evas_object_change(o->cur->source, src_obj);
|
2013-01-16 23:21:06 -08:00
|
|
|
if ((!visible) || (!src_obj->proxy->src_events)) return;
|
2012-10-18 04:30:04 -07:00
|
|
|
//FIXME: Feed mouse events here.
|
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_evas_image_source_visible_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o)
|
2012-10-18 04:30:04 -07:00
|
|
|
{
|
|
|
|
Evas_Object_Protected_Data *src_obj;
|
2014-03-12 07:28:40 -07:00
|
|
|
Eina_Bool visible;
|
2012-10-18 04:30:04 -07:00
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
if (!o->cur->source) visible = EINA_FALSE;
|
2014-06-02 06:47:59 -07:00
|
|
|
src_obj = eo_data_scope_get(o->cur->source, EVAS_OBJECT_CLASS);
|
2014-03-12 07:28:40 -07:00
|
|
|
if (src_obj) visible = !src_obj->proxy->src_invisible;
|
|
|
|
else visible = EINA_FALSE;
|
2012-10-18 04:30:04 -07:00
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
return visible;
|
2012-10-22 03:27:08 -07:00
|
|
|
}
|
|
|
|
|
2013-12-26 23:56:30 -08:00
|
|
|
|
|
|
|
EOLIAN static void
|
2014-04-25 03:53:18 -07:00
|
|
|
_evas_image_scene_set(Eo *eo_obj, Evas_Image_Data *o, Evas_3D_Scene *scene)
|
2013-12-26 23:56:30 -08:00
|
|
|
{
|
2014-06-02 06:47:59 -07:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2014-05-12 03:52:02 -07:00
|
|
|
Evas_Image_Load_Opts lo;
|
2013-12-26 23:56:30 -08:00
|
|
|
|
2014-04-16 01:55:34 -07:00
|
|
|
if (o->cur->scene == scene) return;
|
2013-12-26 23:56:30 -08:00
|
|
|
|
2015-02-10 03:44:38 -08:00
|
|
|
evas_object_async_block(obj);
|
2014-05-12 03:52:02 -07:00
|
|
|
_image_init_set(NULL, NULL, NULL, 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);
|
2014-05-12 03:52:02 -07:00
|
|
|
_image_done_set(eo_obj, obj, o);
|
2013-12-26 23:56:30 -08:00
|
|
|
|
|
|
|
if (scene) _3d_set(eo_obj, scene);
|
|
|
|
else _3d_unset(eo_obj, obj, o);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Evas_3D_Scene *
|
2014-04-25 03:53:18 -07:00
|
|
|
_evas_image_scene_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o)
|
2013-12-26 23:56:30 -08:00
|
|
|
{
|
|
|
|
return o->cur->scene;
|
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_evas_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
|
|
|
|
_evas_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
|
|
|
|
_evas_image_border_center_fill_set(Eo *eo_obj, Evas_Image_Data *o, Evas_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);
|
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
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static Evas_Border_Fill_Mode
|
|
|
|
_evas_image_border_center_fill_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.fill;
|
2012-10-08 18:58:41 -07:00
|
|
|
}
|
2008-12-12 14:36:47 -08:00
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
static void
|
2014-03-12 07:28:40 -07:00
|
|
|
_evas_image_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;
|
|
|
|
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
|
|
|
|
_evas_image_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
|
|
|
|
_evas_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
|
|
|
|
_evas_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
|
|
|
|
_evas_image_fill_set(Eo *eo_obj, Evas_Image_Data *o, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord 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
|
|
|
|
_evas_image_fill_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *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
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_evas_image_fill_spread_set(Eo *eo_obj, Evas_Image_Data *o, Evas_Fill_Spread spread)
|
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 (spread == (Evas_Fill_Spread)o->cur->spread) 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->spread = spread;
|
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);
|
2008-08-30 19:04:31 -07:00
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static Evas_Fill_Spread
|
|
|
|
_evas_image_fill_spread_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 (Evas_Fill_Spread)o->cur->spread;;
|
2012-10-08 18:58:41 -07:00
|
|
|
}
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_evas_image_size_set(Eo *eo_obj, Evas_Image_Data *o, 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);
|
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);
|
2012-10-09 00:49:07 -07:00
|
|
|
_evas_object_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
|
|
|
|
_evas_image_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-27 16:28:53 -08:00
|
|
|
if (w) *w = o->cur->image.w;
|
|
|
|
if (h) *h = o->cur->image.h;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static int
|
|
|
|
_evas_image_stride_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->image.stride;;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static Evas_Load_Error
|
|
|
|
_evas_image_load_error_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o)
|
2008-05-18 20:13:16 -07:00
|
|
|
{
|
2014-03-12 07:28:40 -07:00
|
|
|
return o->load_error;
|
2012-10-08 18:58:41 -07:00
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static void*
|
|
|
|
_evas_image_data_convert(Eo *eo_obj, Evas_Image_Data *o, 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);
|
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-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
|
|
|
}
|
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;
|
2014-10-22 02:34:51 -07:00
|
|
|
o->engine_data = ENFN->image_data_get(ENDT, o->engine_data, 0, &data, &o->load_error);
|
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
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_evas_image_data_set(Eo *eo_obj, Evas_Image_Data *o, void *data)
|
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);
|
2002-11-08 00:02:15 -08:00
|
|
|
void *p_data;
|
2012-09-04 21:20:42 -07:00
|
|
|
Eina_Bool resize_call = EINA_FALSE;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
|
2015-02-10 03:44:38 -08:00
|
|
|
evas_object_async_block(obj);
|
2012-12-21 09:30:44 -08:00
|
|
|
evas_render_rendering_wait(obj->layer->evas);
|
|
|
|
|
2012-10-09 00:49:07 -07:00
|
|
|
_evas_object_image_cleanup(eo_obj, obj, o);
|
2002-11-08 00:02:15 -08:00
|
|
|
p_data = o->engine_data;
|
2005-04-01 08:12:09 -08:00
|
|
|
if (data)
|
|
|
|
{
|
2012-09-04 01:42:38 -07:00
|
|
|
if (o->engine_data)
|
2012-07-03 00:30:05 -07:00
|
|
|
{
|
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
|
|
|
}
|
2012-09-04 01:42:38 -07:00
|
|
|
else
|
2012-07-03 00:30:05 -07:00
|
|
|
{
|
2014-10-22 02:34:51 -07:00
|
|
|
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);
|
2012-07-03 00:30:05 -07:00
|
|
|
}
|
2010-08-18 22:03:37 -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)
|
|
|
|
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
|
|
|
}
|
2010-08-19 00:32:44 -07:00
|
|
|
}
|
2013-06-12 22:09:28 -07:00
|
|
|
o->written = EINA_TRUE;
|
2005-04-01 08:12:09 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-09-04 01:42:38 -07:00
|
|
|
if (o->engine_data)
|
2014-10-22 02:34:51 -07:00
|
|
|
ENFN->image_free(ENDT, o->engine_data);
|
2012-09-04 01:42:38 -07:00
|
|
|
o->load_error = EVAS_LOAD_ERROR_NONE;
|
2013-01-27 16:28:53 -08:00
|
|
|
if ((o->cur->image.w != 0) || (o->cur->image.h != 0))
|
2012-09-04 21:20:42 -07:00
|
|
|
resize_call = EINA_TRUE;
|
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->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);
|
2013-01-27 16:28:53 -08:00
|
|
|
|
2012-09-04 01:42:38 -07:00
|
|
|
o->engine_data = NULL;
|
2005-04-01 08:12:09 -08: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
|
|
|
*/
|
2004-09-21 21:54:39 -07:00
|
|
|
if (o->pixels_checked_out > 0) o->pixels_checked_out--;
|
2002-11-08 00:02:15 -08:00
|
|
|
if (p_data != o->engine_data)
|
|
|
|
{
|
2013-01-27 16:28:53 -08:00
|
|
|
EVAS_OBJECT_WRITE_IMAGE_FREE_FILE_AND_KEY(o);
|
2012-09-04 01:42:38 -07:00
|
|
|
o->pixels_checked_out = 0;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static void*
|
|
|
|
_evas_image_data_get(Eo *eo_obj, Evas_Image_Data *_pd EINA_UNUSED, Eina_Bool for_writing)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2014-03-12 07:28:40 -07:00
|
|
|
Evas_Image_Data *o = (Evas_Image_Data *) _pd;
|
2012-10-08 18:58:41 -07:00
|
|
|
DATA32 *data;
|
2010-05-21 00:10:45 -07:00
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
if (!o->engine_data) return NULL;
|
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-12-18 08:28:55 -08:00
|
|
|
|
2015-02-10 03:44:38 -08:00
|
|
|
if (for_writing) evas_object_async_block(obj);
|
2012-12-18 08:28:55 -08:00
|
|
|
if (for_writing) evas_render_rendering_wait(obj->layer->evas);
|
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
data = NULL;
|
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);
|
|
|
|
o->engine_data = ENFN->image_data_get(ENDT, o->engine_data, for_writing, &data, &o->load_error);
|
From: Jiyoun Park <jy0703.park@samsung.com>
Subject: [E-devel] [Patch] evas gl engine's texture creation
Hello.
1. _pool_tex_dynamic_new function, it didnt set pt to NULL when secsym_eglCreateImage function failed.
In this case, it returns wrong pt pointer and it has possibility to make crash.
So I add free pt code and return NULL code into _pool_tex_dynamic_new function.
2. I modified eng_image_data_get of gl engine.
If Evas_GL_Image's texture creation failed and evas_gl_image's cache image was droped,
Im->im can be NULL. So I add check code.
Example: evas_gl_common_image_content_hint_set
1) EVAS_IMAGE_CONTENT_HINT_DYNAMIC , it drop cache image
2) if evas_gl_common_texture_dynamic_new failed
3) then, im->im =NULL, im->tex=NULL
In this situation, if application call's evas_object_image_data_get function,
It make crash in evas_cache_image_load_data function.
3. I think function's related with evas_object's engine data have to be return NULL if it failed.
If function's returns null, evas object code can handle error more easily.
But evas object's code was implemented differently each case. Does my suggestion right?
I add engine data null check code to evas_object_image based on upper consumtion.
If it is wrong , the patch code related with evas object image have to be removed.
If it is right , I will survey other evas object type also.
SVN revision: 62775
2011-08-24 21:48:45 -07:00
|
|
|
|
|
|
|
/* if we fail to get engine_data, we have to return NULL */
|
2014-03-12 07:28:40 -07:00
|
|
|
if (!o->engine_data) return NULL;
|
From: Jiyoun Park <jy0703.park@samsung.com>
Subject: [E-devel] [Patch] evas gl engine's texture creation
Hello.
1. _pool_tex_dynamic_new function, it didnt set pt to NULL when secsym_eglCreateImage function failed.
In this case, it returns wrong pt pointer and it has possibility to make crash.
So I add free pt code and return NULL code into _pool_tex_dynamic_new function.
2. I modified eng_image_data_get of gl engine.
If Evas_GL_Image's texture creation failed and evas_gl_image's cache image was droped,
Im->im can be NULL. So I add check code.
Example: evas_gl_common_image_content_hint_set
1) EVAS_IMAGE_CONTENT_HINT_DYNAMIC , it drop cache image
2) if evas_gl_common_texture_dynamic_new failed
3) then, im->im =NULL, im->tex=NULL
In this situation, if application call's evas_object_image_data_get function,
It make crash in evas_cache_image_load_data function.
3. I think function's related with evas_object's engine data have to be return NULL if it failed.
If function's returns null, evas object code can handle error more easily.
But evas object's code was implemented differently each case. Does my suggestion right?
I add engine data null check code to evas_object_image based on upper consumtion.
If it is wrong , the patch code related with evas object image have to be removed.
If it is right , I will survey other evas object type also.
SVN revision: 62775
2011-08-24 21:48:45 -07:00
|
|
|
|
2010-08-18 22:18:17 -07:00
|
|
|
if (o->engine_data)
|
|
|
|
{
|
2010-08-19 00:32:44 -07:00
|
|
|
int stride = 0;
|
|
|
|
|
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
|
|
|
}
|
2004-09-21 21:54:39 -07:00
|
|
|
o->pixels_checked_out++;
|
|
|
|
if (for_writing)
|
|
|
|
{
|
2013-06-12 22:09:28 -07:00
|
|
|
o->written = EINA_TRUE;
|
2013-01-27 16:28:53 -08:00
|
|
|
EVAS_OBJECT_WRITE_IMAGE_FREE_FILE_AND_KEY(o);
|
2004-09-21 21:54:39 -07:00
|
|
|
}
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
return data;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2008-09-16 07:52:57 -07:00
|
|
|
EAPI void
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_image_preload(Evas_Object *eo_obj, Eina_Bool cancel)
|
2008-09-16 07:52:57 -07:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
|
2013-06-20 04:28:18 -07:00
|
|
|
return;
|
2008-09-16 07:52:57 -07:00
|
|
|
MAGIC_CHECK_END();
|
2013-04-02 05:58:32 -07:00
|
|
|
if (cancel)
|
|
|
|
eo_do(eo_obj, evas_obj_image_preload_cancel());
|
|
|
|
else
|
|
|
|
eo_do(eo_obj, evas_obj_image_preload_begin());
|
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
|
|
|
|
_evas_image_preload_begin(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
|
|
|
|
_evas_image_preload_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
|
|
|
|
_evas_image_data_copy_set(Eo *eo_obj, Evas_Image_Data *o, void *data)
|
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
|
|
|
|
|
|
|
if (!data) return;
|
2015-02-10 03:44:38 -08:00
|
|
|
evas_object_async_block(obj);
|
2012-10-09 00:49:07 -07:00
|
|
|
_evas_object_image_cleanup(eo_obj, obj, o);
|
2013-01-27 16:28:53 -08:00
|
|
|
if ((o->cur->image.w <= 0) ||
|
|
|
|
(o->cur->image.h <= 0)) return;
|
2002-11-08 00:02:15 -08:00
|
|
|
if (o->engine_data)
|
2014-10-22 02:34:51 -07:00
|
|
|
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);
|
2002-11-08 00:02:15 -08:00
|
|
|
if (o->engine_data)
|
2010-08-18 22:03:37 -07:00
|
|
|
{
|
2010-08-19 00:32:44 -07:00
|
|
|
int stride = 0;
|
|
|
|
|
2012-09-04 01:42:38 -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);
|
|
|
|
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-08-18 22:03:37 -07:00
|
|
|
}
|
2004-09-21 21:54:39 -07:00
|
|
|
o->pixels_checked_out = 0;
|
2013-01-27 16:28:53 -08:00
|
|
|
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 void
|
|
|
|
_evas_image_data_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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (cnt >= 512)
|
|
|
|
{ // 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
|
|
|
|
_evas_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
|
|
|
}
|
2013-01-27 16:28:53 -08:00
|
|
|
if (((has_alpha) && (o->cur->has_alpha)) ||
|
|
|
|
((!has_alpha) && (!o->cur->has_alpha)))
|
2002-11-08 00:02:15 -08:00
|
|
|
return;
|
2013-01-27 16:28:53 -08:00
|
|
|
if (o->cur->has_alpha != has_alpha)
|
|
|
|
{
|
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 = has_alpha;
|
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
|
|
|
}
|
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
|
|
|
|
_evas_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
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_evas_image_reload(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);
|
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
|
|
|
}
|
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
|
2014-07-22 06:55:51 -07:00
|
|
|
_evas_image_efl_file_save(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;
|
2012-10-08 18:58:41 -07:00
|
|
|
RGBA_Image *im;
|
2014-03-12 07:28:40 -07:00
|
|
|
if (!o->engine_data) return 0;
|
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);
|
2014-10-22 02:34:51 -07:00
|
|
|
o->engine_data = ENFN->image_data_get(ENDT, o->engine_data, 0, &data, &o->load_error);
|
2005-11-10 22:09:46 -08:00
|
|
|
if (flags)
|
|
|
|
{
|
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;
|
|
|
|
}
|
2005-11-10 22:09:46 -08:00
|
|
|
}
|
2008-04-11 17:32:30 -07:00
|
|
|
im = (RGBA_Image*) evas_cache_image_data(evas_common_image_cache_get(),
|
2013-01-27 16:28:53 -08:00
|
|
|
o->cur->image.w,
|
|
|
|
o->cur->image.h,
|
2008-04-11 17:32:30 -07:00
|
|
|
data,
|
2013-01-27 16:28:53 -08:00
|
|
|
o->cur->has_alpha,
|
2008-04-11 17:32:30 -07:00
|
|
|
EVAS_COLORSPACE_ARGB8888);
|
2005-11-10 22:09:46 -08:00
|
|
|
if (im)
|
|
|
|
{
|
2013-01-27 16:28:53 -08:00
|
|
|
if (o->cur->cspace == EVAS_COLORSPACE_ARGB8888)
|
2012-09-04 01:42:38 -07:00
|
|
|
im->image.data = data;
|
|
|
|
else
|
|
|
|
im->image.data = evas_object_image_data_convert_internal(o,
|
|
|
|
data,
|
|
|
|
EVAS_COLORSPACE_ARGB8888);
|
|
|
|
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
|
|
|
|
2013-01-27 16:28:53 -08:00
|
|
|
if (o->cur->cspace != EVAS_COLORSPACE_ARGB8888)
|
2012-09-04 01:42:38 -07:00
|
|
|
free(im->image.data);
|
|
|
|
}
|
2007-07-16 00:25:35 -07:00
|
|
|
|
2012-09-04 01:42:38 -07:00
|
|
|
evas_cache_image_drop(&im->cache_entry);
|
2005-11-10 22:09:46 -08:00
|
|
|
}
|
2014-10-22 02:34:51 -07:00
|
|
|
o->engine_data = ENFN->image_data_put(ENDT, o->engine_data, 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
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_evas_image_pixels_import(Eo *eo_obj, Evas_Image_Data *o, 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);
|
2012-10-08 18:58:41 -07:00
|
|
|
|
2015-02-10 03:44:38 -08:00
|
|
|
evas_object_async_block(obj);
|
2012-10-09 00:49:07 -07:00
|
|
|
_evas_object_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;
|
|
|
|
|
2014-10-22 02:34:51 -07:00
|
|
|
o->engine_data = ENFN->image_data_get(ENDT, o->engine_data, 1, &image_pixels,&o->load_error);
|
2012-09-04 01:42:38 -07:00
|
|
|
if (image_pixels)
|
2013-01-27 16:28:53 -08:00
|
|
|
evas_common_convert_yuv_420p_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
|
|
|
|
_evas_image_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
|
|
|
|
_evas_image_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
|
2014-07-23 09:03:40 -07:00
|
|
|
_evas_image_efl_image_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
|
2014-07-23 09:03:40 -07:00
|
|
|
_evas_image_efl_image_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
|
|
|
|
_evas_image_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
|
|
|
|
_evas_image_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
|
|
|
|
_evas_image_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
|
|
|
|
_evas_image_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
|
|
|
|
_evas_image_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
|
|
|
|
_evas_image_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
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_evas_image_colorspace_set(Eo *eo_obj, Evas_Image_Data *o, 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);
|
2015-02-10 03:44:38 -08:00
|
|
|
evas_object_async_block(obj);
|
2012-10-08 18:58:41 -07:00
|
|
|
|
2012-10-09 00:49:07 -07:00
|
|
|
_evas_object_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
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static Evas_Colorspace
|
|
|
|
_evas_image_colorspace_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->cspace;
|
2012-10-08 18:58:41 -07:00
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_evas_image_video_surface_set(Eo *eo_obj, Evas_Image_Data *o, Evas_Video_Surface *surf)
|
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-10-08 18:58:41 -07:00
|
|
|
|
2012-10-09 00:49:07 -07:00
|
|
|
_evas_object_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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static const Evas_Video_Surface*
|
|
|
|
_evas_image_video_surface_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *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
|
|
|
{
|
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
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_evas_image_video_surface_caps_set(Eo *eo_obj, Evas_Image_Data *o, 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
|
|
|
{
|
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);
|
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
|
|
|
|
|
|
|
_evas_object_image_cleanup(eo_obj, obj, o);
|
|
|
|
|
|
|
|
if (caps == o->pixels->video_caps)
|
|
|
|
return;
|
|
|
|
|
|
|
|
EINA_COW_PIXEL_WRITE_BEGIN(o, pixi_write)
|
|
|
|
pixi_write->video_caps = caps;
|
|
|
|
EINA_COW_PIXEL_WRITE_END(o, pixi_write)
|
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static unsigned int
|
|
|
|
_evas_image_video_surface_caps_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *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
|
|
|
{
|
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);
|
|
|
|
}
|
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
EAPI void
|
|
|
|
evas_object_image_native_surface_set(Evas_Object *eo_obj, Evas_Native_Surface *surf)
|
|
|
|
{
|
|
|
|
MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
|
2011-10-02 20:28:52 -07:00
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
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
|
|
|
eo_do(eo_obj, evas_obj_image_native_surface_set(surf));
|
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_evas_image_native_surface_set(Eo *eo_obj, Evas_Image_Data *o, Evas_Native_Surface *surf)
|
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-12-21 09:30:44 -08:00
|
|
|
evas_render_rendering_wait(obj->layer->evas);
|
|
|
|
|
2012-10-09 00:49:07 -07:00
|
|
|
_evas_object_image_cleanup(eo_obj, obj, o);
|
2014-10-22 02:34:51 -07:00
|
|
|
if (!ENFN->image_native_set) return;
|
2010-12-06 01:02:16 -08:00
|
|
|
if ((surf) &&
|
|
|
|
((surf->version < 2) ||
|
|
|
|
(surf->version > EVAS_NATIVE_SURFACE_VERSION))) return;
|
2014-10-22 02:34:51 -07:00
|
|
|
o->engine_data = ENFN->image_native_set(ENDT, o->engine_data, surf);
|
2006-12-09 00:52:08 -08:00
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static Evas_Native_Surface*
|
|
|
|
_evas_image_native_surface_get(Eo *eo_obj, Evas_Image_Data *o)
|
2009-05-07 06:29:56 -07:00
|
|
|
{
|
2014-10-22 02:34:51 -07:00
|
|
|
Evas_Native_Surface *surf = NULL;
|
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-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
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_evas_image_scale_hint_set(Eo *eo_obj, Evas_Image_Data *o, Evas_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)
|
|
|
|
ENFN->image_scale_hint_set(ENFN->image_native_get, o->engine_data, o->scale_hint);
|
|
|
|
if (ENFN->image_stride_get)
|
|
|
|
ENFN->image_stride_get(ENFN->image_native_get, 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
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static Evas_Image_Scale_Hint
|
|
|
|
_evas_image_scale_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->scale_hint;;
|
2012-10-08 18:58:41 -07:00
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_evas_image_content_hint_set(Eo *eo_obj, Evas_Image_Data *o, Evas_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)
|
|
|
|
ENFN->image_content_hint_set(ENFN->image_native_get, 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
|
|
|
}
|
2010-08-18 22:18:17 -07:00
|
|
|
}
|
2010-03-06 20:19:17 -08:00
|
|
|
}
|
|
|
|
|
2011-02-06 15:52:17 -08:00
|
|
|
EAPI void
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_image_alpha_mask_set(Evas_Object *eo_obj, Eina_Bool ismask)
|
2011-02-06 15:52:17 -08:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
|
2011-02-06 15:52:17 -08:00
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
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);
|
2012-10-08 18:58:41 -07:00
|
|
|
if (!ismask) return;
|
2011-02-06 15:52:17 -08:00
|
|
|
/* Convert to A8 if not already */
|
|
|
|
|
|
|
|
/* done */
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2011-08-10 23:04:08 -07:00
|
|
|
#define FRAME_MAX 1024
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static Evas_Image_Content_Hint
|
|
|
|
_evas_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
|
|
|
|
_evas_image_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
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
Eina_Bool region;
|
2014-10-22 02:34:51 -07:00
|
|
|
region = ENFN->image_can_region_get(ENDT, o->engine_data);
|
2011-12-13 08:58:20 -08:00
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
return region;
|
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
|
2014-07-23 09:03:40 -07:00
|
|
|
_evas_image_efl_image_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
|
|
|
|
_evas_image_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
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static Evas_Image_Animated_Loop_Hint
|
|
|
|
_evas_image_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);
|
2011-08-10 23:04:08 -07:00
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
Evas_Image_Animated_Loop_Hint hint;
|
|
|
|
hint = EVAS_IMAGE_ANIMATED_HINT_NONE;
|
|
|
|
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)
|
|
|
|
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
|
|
|
|
_evas_image_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
|
|
|
|
_evas_image_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);
|
2012-10-08 18:58:41 -07:00
|
|
|
int frame_count = 0;
|
2011-08-10 23:04:08 -07:00
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
double frame_duration;
|
|
|
|
frame_duration = -1;
|
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
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_evas_image_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
|
|
|
|
2013-07-11 00:03:01 -07:00
|
|
|
if (!o->cur->u.file) return;
|
2013-01-27 16:28:53 -08:00
|
|
|
if (o->cur->frame == frame_index) return;
|
2011-08-10 23:04:08 -07:00
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
if (!evas_object_image_animated_get(eo_obj)) return;
|
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))
|
|
|
|
return;
|
|
|
|
|
2014-10-22 02:34:51 -07:00
|
|
|
if (!ENFN->image_animated_frame_set) return;
|
|
|
|
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
|
|
|
|
|
|
|
}
|
|
|
|
|
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
|
|
|
/* all nice and private */
|
2011-02-06 20:18:37 -08:00
|
|
|
static void
|
2014-03-12 07:28:40 -07:00
|
|
|
_proxy_unset(Evas_Object *proxy, Evas_Object_Protected_Data *cur_proxy, Evas_Image_Data *o)
|
2011-02-06 20:18:37 -08:00
|
|
|
{
|
2013-01-16 23:21:06 -08:00
|
|
|
Evas_Object_Protected_Data *cur_source;
|
2011-02-06 20:18:37 -08:00
|
|
|
|
2013-01-27 16:28:53 -08:00
|
|
|
if (!o->cur->source) return;
|
2011-02-06 20:18:37 -08:00
|
|
|
|
2014-06-02 06:47:59 -07:00
|
|
|
cur_source = eo_data_scope_get(o->cur->source, EVAS_OBJECT_CLASS);
|
2012-10-08 18:58:41 -07:00
|
|
|
|
2013-01-20 19:12:39 -08:00
|
|
|
EINA_COW_WRITE_BEGIN(evas_object_proxy_cow, cur_source->proxy, Evas_Object_Proxy_Data, proxy_source_write)
|
2012-10-18 04:30:04 -07:00
|
|
|
{
|
2013-01-20 19:12:39 -08:00
|
|
|
proxy_source_write->proxies = eina_list_remove(proxy_source_write->proxies,
|
|
|
|
proxy);
|
2013-01-27 16:28:53 -08:00
|
|
|
|
2013-05-06 22:23:53 -07:00
|
|
|
if (eina_list_count(proxy_source_write->proxies) == 0)
|
|
|
|
{
|
2013-05-08 07:41:39 -07:00
|
|
|
if (proxy_source_write->surface)
|
|
|
|
cur_proxy->layer->evas->engine.func->image_map_surface_free(cur_proxy->layer->evas->engine.data.output,
|
|
|
|
proxy_source_write->surface);
|
2013-05-06 22:23:53 -07:00
|
|
|
proxy_source_write->surface = NULL;
|
2014-08-13 23:27:31 -07:00
|
|
|
proxy_source_write->redraw = EINA_FALSE;
|
2013-05-06 22:23:53 -07:00
|
|
|
}
|
|
|
|
|
2013-01-20 19:12:39 -08:00
|
|
|
if (proxy_source_write->src_invisible)
|
|
|
|
{
|
|
|
|
proxy_source_write->src_invisible = EINA_FALSE;
|
|
|
|
cur_source->changed_src_visible = EINA_TRUE;
|
2013-01-27 16:28:53 -08:00
|
|
|
evas_object_change(o->cur->source, cur_source);
|
|
|
|
evas_object_smart_member_cache_invalidate(o->cur->source, EINA_FALSE,
|
2013-01-20 19:12:39 -08:00
|
|
|
EINA_FALSE, EINA_TRUE);
|
|
|
|
}
|
2012-10-18 04:30:04 -07:00
|
|
|
}
|
2013-01-20 19:12:39 -08:00
|
|
|
EINA_COW_WRITE_END(evas_object_proxy_cow, cur_source->proxy, proxy_source_write);
|
2013-01-16 23:21:06 -08:00
|
|
|
|
2013-01-27 16:28:53 -08:00
|
|
|
if (o->cur->source)
|
|
|
|
{
|
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->source = NULL;
|
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-01-16 23:21:06 -08:00
|
|
|
|
2013-01-27 16:28:53 -08:00
|
|
|
if (o->cur->defmap)
|
2011-02-06 20:18:37 -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
|
|
|
{
|
|
|
|
evas_map_free(state_write->defmap);
|
|
|
|
state_write->defmap = NULL;
|
|
|
|
}
|
2013-03-12 05:58:19 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
|
2011-02-06 20:18:37 -08:00
|
|
|
}
|
2013-01-16 23:21:06 -08:00
|
|
|
|
2013-01-20 19:12:39 -08:00
|
|
|
EINA_COW_WRITE_BEGIN(evas_object_proxy_cow, cur_source->proxy, Evas_Object_Proxy_Data, proxy_write)
|
|
|
|
proxy_write->is_proxy = EINA_FALSE;
|
|
|
|
EINA_COW_WRITE_END(evas_object_proxy_cow, cur_proxy->proxy, proxy_write);
|
2011-02-06 20:18:37 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-10-08 18:58:41 -07:00
|
|
|
_proxy_set(Evas_Object *eo_proxy, Evas_Object *eo_src)
|
2011-02-06 20:18:37 -08:00
|
|
|
{
|
2014-06-02 06:47:59 -07:00
|
|
|
Evas_Object_Protected_Data *src = eo_data_scope_get(eo_src, EVAS_OBJECT_CLASS);
|
|
|
|
Evas_Object_Protected_Data *proxy = eo_data_scope_get(eo_proxy, EVAS_OBJECT_CLASS);
|
2014-03-12 07:28:40 -07:00
|
|
|
Evas_Image_Data *o = eo_data_scope_get(eo_proxy, MY_CLASS);
|
2011-02-06 20:18:37 -08:00
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_image_file_set(eo_proxy, NULL, NULL);
|
2011-02-06 20:18:37 -08:00
|
|
|
|
2013-01-20 19:12:39 -08:00
|
|
|
EINA_COW_WRITE_BEGIN(evas_object_proxy_cow, proxy->proxy, Evas_Object_Proxy_Data, proxy_write)
|
|
|
|
proxy_write->is_proxy = EINA_TRUE;
|
|
|
|
EINA_COW_WRITE_END(evas_object_proxy_cow, proxy->proxy, proxy_write);
|
2013-01-16 23:21:06 -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->source = eo_src;
|
2013-03-12 05:58:19 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
|
2012-07-18 07:09:53 -07:00
|
|
|
o->load_error = EVAS_LOAD_ERROR_NONE;
|
2013-04-22 08:41:24 -07:00
|
|
|
o->proxyerror = 0;
|
2011-02-06 20:18:37 -08:00
|
|
|
|
2013-01-20 19:12:39 -08:00
|
|
|
EINA_COW_WRITE_BEGIN(evas_object_proxy_cow, src->proxy, Evas_Object_Proxy_Data, proxy_src_write)
|
|
|
|
{
|
2014-01-23 23:41:21 -08:00
|
|
|
if (!eina_list_data_find(proxy_src_write->proxies, eo_proxy))
|
|
|
|
proxy_src_write->proxies = eina_list_append(proxy_src_write->proxies,
|
|
|
|
eo_proxy);
|
2013-01-20 19:12:39 -08:00
|
|
|
proxy_src_write->redraw = EINA_TRUE;
|
|
|
|
}
|
|
|
|
EINA_COW_WRITE_END(evas_object_proxy_cow, src->proxy, proxy_src_write);
|
2011-02-06 20:18:37 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Some moron just set a proxy on a proxy.
|
|
|
|
* Give them some pixels. A random color
|
|
|
|
*/
|
|
|
|
static void
|
2012-10-08 18:58:41 -07:00
|
|
|
_proxy_error(Evas_Object *eo_proxy, void *context, void *output, void *surface,
|
2012-12-18 08:28:55 -08:00
|
|
|
int x, int y, Eina_Bool do_async)
|
2011-02-06 20:18:37 -08:00
|
|
|
{
|
|
|
|
Evas_Func *func;
|
2014-03-12 07:28:40 -07:00
|
|
|
Evas_Image_Data *o = eo_data_scope_get(eo_proxy, MY_CLASS);
|
2012-09-04 01:42:38 -07:00
|
|
|
|
2013-04-22 08:41:24 -07:00
|
|
|
if (!o->proxyerror) printf("Err: Argh! Recursive proxies.\n");
|
|
|
|
o->proxyerror = 1;
|
2012-09-04 01:42:38 -07:00
|
|
|
|
2014-06-02 06:47:59 -07:00
|
|
|
Evas_Object_Protected_Data *proxy = eo_data_scope_get(eo_proxy, EVAS_OBJECT_CLASS);
|
2011-02-06 20:18:37 -08:00
|
|
|
func = proxy->layer->evas->engine.func;
|
2013-04-22 08:41:24 -07:00
|
|
|
func->context_color_set(output, context, 0, 0, 0, 255);
|
2011-02-06 20:18:37 -08:00
|
|
|
func->context_multiplier_unset(output, context);
|
2013-03-12 05:58:19 -07:00
|
|
|
func->context_render_op_set(output, context, proxy->cur->render_op);
|
|
|
|
func->rectangle_draw(output, context, surface, proxy->cur->geometry.x + x,
|
|
|
|
proxy->cur->geometry.y + y,
|
|
|
|
proxy->cur->geometry.w,
|
|
|
|
proxy->cur->geometry.h,
|
2012-12-18 08:28:55 -08:00
|
|
|
do_async);
|
2011-02-06 20:18:37 -08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-12-26 23:56:30 -08:00
|
|
|
static void
|
|
|
|
_3d_set(Evas_Object *eo_obj, Evas_3D_Scene *scene)
|
|
|
|
{
|
2014-06-02 06:47:59 -07:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2013-12-26 23:56:30 -08:00
|
|
|
Evas_Image_Data *o = eo_data_scope_get(eo_obj, MY_CLASS);
|
2014-04-16 01:55:34 -07:00
|
|
|
Evas_3D_Scene_Data *pd_scene = eo_data_scope_get(scene,
|
2014-04-25 10:28:38 -07:00
|
|
|
EVAS_3D_SCENE_CLASS);
|
2014-04-16 01:55:34 -07:00
|
|
|
EINA_COW_WRITE_BEGIN(evas_object_3d_cow, obj->data_3d, Evas_Object_3D_Data,
|
|
|
|
data)
|
2013-12-26 23:56:30 -08:00
|
|
|
{
|
|
|
|
data->surface = NULL;
|
|
|
|
data->w = 0;
|
|
|
|
data->h = 0;
|
2014-04-14 03:59:38 -07:00
|
|
|
eo_ref(scene);
|
2013-12-26 23:56:30 -08:00
|
|
|
}
|
|
|
|
EINA_COW_WRITE_END(evas_object_3d_cow, obj->data_3d, data);
|
|
|
|
|
|
|
|
EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
|
|
|
|
{
|
|
|
|
state_write->scene = scene;
|
|
|
|
}
|
|
|
|
EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
|
|
|
|
|
2014-04-14 03:03:47 -07:00
|
|
|
pd_scene->images = eina_list_append(pd_scene->images, eo_obj);
|
2013-12-26 23:56:30 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-04-16 01:55:34 -07:00
|
|
|
_3d_unset(Evas_Object *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj,
|
|
|
|
Evas_Image_Data *o)
|
2013-12-26 23:56:30 -08:00
|
|
|
{
|
2014-04-16 01:55:34 -07:00
|
|
|
Evas_Public_Data *e;
|
|
|
|
|
2013-12-26 23:56:30 -08:00
|
|
|
if (!o->cur->scene) return;
|
|
|
|
|
2014-04-16 01:55:34 -07:00
|
|
|
Evas_3D_Scene_Data *pd_scene =
|
2014-04-25 10:28:38 -07:00
|
|
|
eo_data_scope_get(o->cur->scene, EVAS_3D_SCENE_CLASS);
|
2014-04-16 01:55:34 -07:00
|
|
|
|
|
|
|
EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
|
2013-12-26 23:56:30 -08:00
|
|
|
{
|
2014-04-16 01:55:34 -07:00
|
|
|
pd_scene->images = eina_list_remove(pd_scene->images, eo_obj);
|
|
|
|
eo_unref(state_write->scene);
|
|
|
|
state_write->scene = NULL;
|
2013-12-26 23:56:30 -08:00
|
|
|
}
|
2014-04-16 01:55:34 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
|
2013-12-26 23:56:30 -08:00
|
|
|
|
|
|
|
if (o->cur->defmap)
|
|
|
|
{
|
|
|
|
EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
|
|
|
|
{
|
|
|
|
evas_map_free(state_write->defmap);
|
|
|
|
state_write->defmap = NULL;
|
|
|
|
}
|
|
|
|
EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
|
|
|
|
}
|
|
|
|
|
2014-04-16 01:55:34 -07:00
|
|
|
EINA_COW_WRITE_BEGIN(evas_object_3d_cow, obj->data_3d, Evas_Object_3D_Data,
|
|
|
|
data)
|
2013-12-26 23:56:30 -08:00
|
|
|
{
|
2014-04-16 01:55:34 -07:00
|
|
|
e = obj->layer->evas;
|
|
|
|
|
2013-12-26 23:56:30 -08:00
|
|
|
if (data->surface)
|
2014-04-16 01:55:34 -07:00
|
|
|
e->engine.func->image_free(e->engine.data.output, data->surface);
|
2013-12-26 23:56:30 -08:00
|
|
|
|
|
|
|
data->surface = NULL;
|
|
|
|
data->w = 0;
|
|
|
|
data->h = 0;
|
|
|
|
}
|
|
|
|
EINA_COW_WRITE_END(evas_object_3d_cow, obj->data_3d, data);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-04-16 01:55:34 -07:00
|
|
|
_3d_render(Evas *eo_e, Evas_Object *eo_obj EINA_UNUSED,
|
|
|
|
Evas_Object_Protected_Data *obj, Evas_Image_Data *o EINA_UNUSED,
|
|
|
|
Evas_3D_Scene *scene)
|
2013-12-26 23:56:30 -08:00
|
|
|
{
|
2014-04-16 01:55:34 -07:00
|
|
|
Evas_Public_Data *e;
|
|
|
|
Eina_Bool need_native_set = EINA_FALSE;
|
|
|
|
Evas_3D_Scene_Public_Data scene_data;
|
|
|
|
Evas_3D_Scene_Data *pd_scene = NULL;
|
2013-12-26 23:56:30 -08:00
|
|
|
|
2014-04-25 10:28:38 -07:00
|
|
|
pd_scene = eo_data_scope_get(scene, EVAS_3D_SCENE_CLASS);
|
2013-12-26 23:56:30 -08:00
|
|
|
|
2014-04-30 04:20:44 -07:00
|
|
|
if ((pd_scene->w == 0) || (pd_scene->h == 0)) return;
|
|
|
|
if (!pd_scene->camera_node)
|
|
|
|
{
|
|
|
|
WRN("Camera has not been set to scene(%p)", scene);
|
|
|
|
return;
|
|
|
|
}
|
2013-12-26 23:56:30 -08:00
|
|
|
|
2014-06-26 14:29:46 -07:00
|
|
|
e = eo_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
|
2013-12-26 23:56:30 -08:00
|
|
|
|
2014-04-16 01:55:34 -07:00
|
|
|
if (pd_scene->surface)
|
2013-12-26 23:56:30 -08:00
|
|
|
{
|
2014-05-10 02:44:57 -07:00
|
|
|
int w = 0;
|
|
|
|
int h = 0;
|
2013-12-26 23:56:30 -08:00
|
|
|
|
2014-05-07 00:23:53 -07:00
|
|
|
if (e->engine.func->drawable_size_get)
|
|
|
|
{
|
|
|
|
e->engine.func->drawable_size_get(e->engine.data.output,
|
|
|
|
pd_scene->surface, &w, &h);
|
|
|
|
}
|
2014-04-14 03:03:47 -07:00
|
|
|
if ((w != pd_scene->w) || (h != pd_scene->h))
|
2013-12-26 23:56:30 -08:00
|
|
|
{
|
2014-05-07 00:23:53 -07:00
|
|
|
if (e->engine.func->drawable_free)
|
|
|
|
{
|
|
|
|
e->engine.func->drawable_free(e->engine.data.output,
|
|
|
|
pd_scene->surface);
|
|
|
|
}
|
2014-04-14 03:03:47 -07:00
|
|
|
pd_scene->surface = NULL;
|
2013-12-26 23:56:30 -08:00
|
|
|
need_native_set = EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
2014-04-16 01:55:34 -07:00
|
|
|
else
|
2013-12-26 23:56:30 -08:00
|
|
|
{
|
|
|
|
/* TODO: Hard-coded alpha on. */
|
2014-05-07 00:23:53 -07:00
|
|
|
if (e->engine.func->drawable_new)
|
|
|
|
{
|
|
|
|
pd_scene->surface =
|
|
|
|
e->engine.func->drawable_new(e->engine.data.output,
|
|
|
|
pd_scene->w, pd_scene->h, 1);
|
|
|
|
}
|
2013-12-26 23:56:30 -08:00
|
|
|
need_native_set = EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2014-04-16 01:55:34 -07:00
|
|
|
EINA_COW_WRITE_BEGIN(evas_object_3d_cow, obj->data_3d, Evas_Object_3D_Data,
|
|
|
|
data)
|
2013-12-26 23:56:30 -08:00
|
|
|
{
|
|
|
|
if (need_native_set)
|
|
|
|
{
|
2014-05-07 00:23:53 -07:00
|
|
|
if (e->engine.func->image_drawable_set)
|
|
|
|
{
|
|
|
|
data->surface =
|
|
|
|
e->engine.func->image_drawable_set(e->engine.data.output,
|
|
|
|
data->surface,
|
|
|
|
pd_scene->surface);
|
|
|
|
}
|
2013-12-26 23:56:30 -08:00
|
|
|
}
|
2014-04-14 03:03:47 -07:00
|
|
|
data->w = pd_scene->w;
|
|
|
|
data->h = pd_scene->h;
|
2013-12-26 23:56:30 -08:00
|
|
|
}
|
|
|
|
EINA_COW_WRITE_END(evas_object_3d_cow, obj->data_3d, data);
|
|
|
|
|
|
|
|
evas_3d_scene_data_init(&scene_data);
|
|
|
|
|
2014-04-14 03:03:47 -07:00
|
|
|
scene_data.bg_color = pd_scene->bg_color;
|
2014-09-03 05:06:03 -07:00
|
|
|
scene_data.shadows_enabled = pd_scene->shadows_enabled;
|
2014-04-14 03:03:47 -07:00
|
|
|
scene_data.camera_node = pd_scene->camera_node;
|
2013-12-26 23:56:30 -08:00
|
|
|
|
|
|
|
/* Phase 1 - Update scene graph tree. */
|
2014-04-25 10:28:38 -07:00
|
|
|
eo_do(scene, evas_3d_object_update());
|
2013-12-26 23:56:30 -08:00
|
|
|
|
|
|
|
/* Phase 2 - Do frustum culling and get visible model nodes. */
|
2014-04-16 01:55:34 -07:00
|
|
|
evas_3d_node_tree_traverse(pd_scene->root_node,
|
|
|
|
EVAS_3D_TREE_TRAVERSE_LEVEL_ORDER, EINA_TRUE,
|
2013-12-26 23:56:30 -08:00
|
|
|
evas_3d_node_mesh_collect, &scene_data);
|
|
|
|
|
|
|
|
/* Phase 3 - Collect active light nodes in the scene graph tree. */
|
2014-04-16 01:55:34 -07:00
|
|
|
evas_3d_node_tree_traverse(pd_scene->root_node,
|
|
|
|
EVAS_3D_TREE_TRAVERSE_ANY_ORDER, EINA_FALSE,
|
2013-12-26 23:56:30 -08:00
|
|
|
evas_3d_node_light_collect, &scene_data);
|
|
|
|
|
|
|
|
/* Phase 5 - Draw the scene. */
|
2014-05-07 00:23:53 -07:00
|
|
|
if (e->engine.func->drawable_scene_render)
|
|
|
|
{
|
|
|
|
e->engine.func->drawable_scene_render(e->engine.data.output,
|
|
|
|
pd_scene->surface, &scene_data);
|
|
|
|
}
|
2013-12-26 23:56:30 -08:00
|
|
|
/* Clean up temporary resources. */
|
|
|
|
evas_3d_scene_data_fini(&scene_data);
|
|
|
|
}
|
|
|
|
|
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);
|
2013-03-18 08:33:54 -07:00
|
|
|
eo_do_super(eo_obj, MY_CLASS, eo_destructor());
|
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);
|
2013-05-06 22:23:53 -07:00
|
|
|
if (o->cur->source) _proxy_unset(eo_obj, obj, o);
|
2013-12-26 23:56:30 -08:00
|
|
|
if (o->cur->scene) _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,
|
2013-07-15 03:11:06 -07:00
|
|
|
void *output, void *pixels)
|
|
|
|
{
|
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-02-24 02:05:39 -08:00
|
|
|
direct_renderable = ENFN->gl_surface_direct_renderable_get(output, ns, &direct_override);
|
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) &&
|
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)
|
|
|
|
ENFN->gl_surface_direct_renderable_get(output, ns, &direct_override);
|
|
|
|
|
|
|
|
if (direct_override && !direct_force_off)
|
|
|
|
{
|
|
|
|
// always use direct rendering
|
|
|
|
ENFN->gl_get_pixels_set(output, o->pixels->func.get_pixels, o->pixels->func.get_pixels_data, eo_obj);
|
|
|
|
}
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2014-03-21 01:03:33 -07:00
|
|
|
static void
|
|
|
|
_filter_cb(Evas_Filter_Context *ctx, void *data, Eina_Bool success)
|
|
|
|
{
|
|
|
|
Eo *eo_obj = data;
|
|
|
|
|
|
|
|
// Destroy context as we won't reuse it.
|
|
|
|
evas_filter_context_destroy(ctx);
|
|
|
|
|
|
|
|
// Redraw image normally
|
|
|
|
if (!success)
|
|
|
|
{
|
2014-06-02 06:47:59 -07:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2014-03-21 01:03:33 -07:00
|
|
|
Evas_Image_Data *o = (Evas_Image_Data *) obj->private_data;
|
|
|
|
|
|
|
|
ERR("Filter failed at runtime!");
|
|
|
|
EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
|
2014-10-21 19:27:11 -07:00
|
|
|
EINA_COW_IMAGE_FILTER_WRITE_BEGIN(state_write, fcow)
|
|
|
|
fcow->invalid = EINA_TRUE;
|
|
|
|
EINA_COW_IMAGE_FILTER_WRITE_END(state_write, fcow)
|
2014-03-21 01:03:33 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_END(o, state_write)
|
|
|
|
|
|
|
|
// Update object
|
2014-06-02 06:47:59 -07:00
|
|
|
obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2014-03-21 01:03:33 -07:00
|
|
|
o->changed = EINA_TRUE;
|
|
|
|
evas_object_change(eo_obj, obj);
|
|
|
|
evas_object_clip_dirty(eo_obj, obj);
|
|
|
|
evas_object_coords_recalc(eo_obj, obj);
|
|
|
|
evas_object_inform_call_resize(eo_obj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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;
|
2011-05-18 22:52:47 -07:00
|
|
|
int imagew, imageh, uvw, uvh;
|
2011-02-06 20:18:37 -08:00
|
|
|
void *pixels;
|
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)
|
|
|
|
{
|
2012-12-18 08:28:55 -08:00
|
|
|
_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
|
|
|
|
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);
|
2013-12-26 23:56:30 -08:00
|
|
|
|
|
|
|
if (o->cur->scene)
|
|
|
|
{
|
|
|
|
_3d_render(obj->layer->evas->evas, eo_obj, obj, o, o->cur->scene);
|
|
|
|
pixels = obj->data_3d->surface;
|
|
|
|
imagew = obj->data_3d->w;
|
|
|
|
imageh = obj->data_3d->h;
|
|
|
|
uvw = imagew;
|
|
|
|
uvh = imageh;
|
|
|
|
}
|
|
|
|
else if (!o->cur->source)
|
2011-02-06 20:18:37 -08:00
|
|
|
{
|
2013-07-15 03:11:06 -07:00
|
|
|
pixels = evas_process_dirty_pixels(eo_obj, obj, o, output, o->engine_data);
|
|
|
|
/* 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
|
|
|
}
|
2012-10-08 18:58:41 -07:00
|
|
|
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)
|
2011-02-06 20:18:37 -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);
|
2011-02-06 20:18:37 -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;
|
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
|
|
|
}
|
|
|
|
|
|
|
|
if (pixels)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2012-09-04 01:42:38 -07:00
|
|
|
Evas_Coord idw, idh, idx, idy;
|
2014-03-19 19:10:43 -07:00
|
|
|
int l = 0, r = 0, t = 0, b = 0;
|
2012-09-04 01:42:38 -07:00
|
|
|
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
|
|
|
|
{
|
2014-03-17 00:10:03 -07:00
|
|
|
Evas_Filter_Context *filter = NULL;
|
|
|
|
void * const surface_save = surface;
|
|
|
|
void * const context_save = context;
|
2014-03-19 19:10:43 -07:00
|
|
|
Eina_Bool input_stolen = EINA_FALSE;
|
2014-03-17 00:10:03 -07:00
|
|
|
Eina_Bool clear = EINA_FALSE;
|
|
|
|
int W, H, offx, offy;
|
|
|
|
|
2014-03-21 01:03:33 -07:00
|
|
|
start_draw:
|
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;
|
|
|
|
|
|
|
|
/* Evas Filters on Image Object. Yet another experimental piece of code.
|
|
|
|
* Replace current context, offset and surface by filter-made targets.
|
2014-03-19 19:10:43 -07:00
|
|
|
*
|
|
|
|
* Mechanism:
|
|
|
|
* 1. Create a new surface & context, matching the object geometry
|
|
|
|
* 2. Render all borders & tiles into that surface
|
|
|
|
* 3. Apply effect and draw this surface into the original target
|
|
|
|
*
|
|
|
|
* Notes:
|
|
|
|
* This becomes VERY SLOW when the image OBJECT size grows... even if
|
|
|
|
* the image itself is very small. But we can't really apply a proper blur
|
|
|
|
* over one tile and repeat since blurs should overlap.
|
|
|
|
*
|
|
|
|
* Behaviour depends on the 'filled' flag:
|
|
|
|
* - If filled, then scale down the image to accomodate the whole filter's padding.
|
|
|
|
* - Otherwise, draw image in place and clip the filter's effects (eg. blur will be clipped out).
|
2014-03-17 00:10:03 -07:00
|
|
|
*/
|
2014-10-21 19:27:11 -07:00
|
|
|
if (!o->cur->filter->invalid && o->cur->filter->code)
|
2014-03-17 00:10:03 -07:00
|
|
|
{
|
2014-10-21 19:27:11 -07:00
|
|
|
Evas_Filter_Program *pgm = o->cur->filter->chain;
|
|
|
|
Eina_Bool redraw = (o->changed || o->cur->filter->changed);
|
2014-03-17 00:10:03 -07:00
|
|
|
Eina_Bool ok;
|
|
|
|
|
|
|
|
evas_filter_program_padding_get(pgm, &l, &r, &t, &b);
|
2014-03-19 19:10:43 -07:00
|
|
|
W = obj->cur->geometry.w;
|
|
|
|
H = obj->cur->geometry.h;
|
2014-03-17 00:10:03 -07:00
|
|
|
|
2014-10-21 19:27:11 -07:00
|
|
|
if (!redraw && o->cur->filter->output)
|
2014-03-18 17:40:28 -07:00
|
|
|
{
|
2014-10-21 22:14:58 -07:00
|
|
|
if (eina_hash_population(o->cur->filter->sources) > 0)
|
2014-03-18 17:40:28 -07:00
|
|
|
{
|
|
|
|
Evas_Filter_Proxy_Binding *pb;
|
|
|
|
Evas_Object_Protected_Data *prxsource;
|
|
|
|
Eina_Iterator *iter;
|
|
|
|
|
2014-10-21 19:27:11 -07:00
|
|
|
iter = eina_hash_iterator_data_new(o->cur->filter->sources);
|
2014-03-18 17:40:28 -07:00
|
|
|
EINA_ITERATOR_FOREACH(iter, pb)
|
|
|
|
{
|
2014-06-02 06:47:59 -07:00
|
|
|
prxsource = eo_data_scope_get(pb->eo_source, EVAS_OBJECT_CLASS);
|
2014-03-18 17:40:28 -07:00
|
|
|
if (prxsource->changed)
|
|
|
|
{
|
|
|
|
redraw = EINA_TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
eina_iterator_free(iter);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!redraw)
|
|
|
|
{
|
|
|
|
// Render this image only
|
2014-10-22 02:34:51 -07:00
|
|
|
ENFN->image_draw(output, context,
|
2014-10-21 19:27:11 -07:00
|
|
|
surface, o->cur->filter->output,
|
2014-03-18 17:40:28 -07:00
|
|
|
0, 0, W, H,
|
|
|
|
offx, offy, W, H,
|
|
|
|
EINA_TRUE,
|
|
|
|
do_async);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-17 00:10:03 -07:00
|
|
|
if (!pgm)
|
|
|
|
{
|
|
|
|
pgm = evas_filter_program_new("Image", EINA_FALSE);
|
2014-10-21 19:27:11 -07:00
|
|
|
evas_filter_program_source_set_all(pgm, o->cur->filter->sources);
|
|
|
|
ok = evas_filter_program_parse(pgm, o->cur->filter->code);
|
2014-03-17 00:10:03 -07:00
|
|
|
if (!ok) goto state_write;
|
|
|
|
}
|
|
|
|
|
|
|
|
filter = evas_filter_context_new(obj->layer->evas, do_async);
|
|
|
|
ok = evas_filter_context_program_use(filter, pgm);
|
|
|
|
if (!ok) goto state_write;
|
|
|
|
|
|
|
|
evas_filter_context_proxy_render_all(filter, eo_obj, EINA_FALSE);
|
|
|
|
ok = evas_filter_context_buffers_allocate_all(filter, W, H);
|
|
|
|
if (!ok) goto state_write;
|
|
|
|
|
2014-10-22 02:34:51 -07:00
|
|
|
if (ENFN->gl_surface_read_pixels)
|
2014-03-17 00:10:03 -07:00
|
|
|
{
|
2014-03-19 19:10:43 -07:00
|
|
|
// GL case: Create new surface, draw to it (OpenGL) and call glReadPixels
|
2014-10-22 02:34:51 -07:00
|
|
|
surface = ENFN->image_map_surface_new(output, W, H, EINA_TRUE);
|
2014-03-19 19:10:43 -07:00
|
|
|
input_stolen = EINA_FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Software case: Directly draw into the filter's input buffer
|
|
|
|
surface = evas_filter_buffer_backing_steal(filter, EVAS_FILTER_BUFFER_INPUT_ID);
|
|
|
|
input_stolen = EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!surface)
|
|
|
|
{
|
|
|
|
surface = surface_save;
|
|
|
|
ok = EINA_FALSE;
|
2014-03-17 00:10:03 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
state_write:
|
|
|
|
EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
|
|
|
|
{
|
|
|
|
if (ok)
|
|
|
|
{
|
2014-10-22 02:34:51 -07:00
|
|
|
context = ENFN->context_new(output);
|
2014-03-17 00:10:03 -07:00
|
|
|
clear = EINA_TRUE;
|
2014-10-21 19:27:11 -07:00
|
|
|
EINA_COW_IMAGE_FILTER_WRITE_BEGIN(state_write, fcow)
|
|
|
|
fcow->chain = pgm;
|
|
|
|
EINA_COW_IMAGE_FILTER_WRITE_END(state_write, fcow)
|
2014-03-19 19:10:43 -07:00
|
|
|
if (!o->filled)
|
|
|
|
{
|
|
|
|
offx = 0;
|
|
|
|
offy = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
offx = l;
|
|
|
|
offy = t;
|
|
|
|
}
|
2014-03-17 00:10:03 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ERR("Failed to apply this filter");
|
|
|
|
evas_filter_context_destroy(filter);
|
|
|
|
evas_filter_program_del(pgm);
|
2014-10-21 19:27:11 -07:00
|
|
|
EINA_COW_IMAGE_FILTER_WRITE_BEGIN(state_write, fcow)
|
|
|
|
fcow->invalid = EINA_TRUE;
|
|
|
|
fcow->chain = NULL;
|
|
|
|
EINA_COW_IMAGE_FILTER_WRITE_END(state_write, fcow)
|
2014-03-21 01:03:33 -07:00
|
|
|
l = r = t = b = 0;
|
2014-03-17 00:10:03 -07:00
|
|
|
filter = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
EINA_COW_IMAGE_STATE_WRITE_END(o, state_write)
|
2014-03-19 19:10:43 -07:00
|
|
|
|
|
|
|
if (clear)
|
|
|
|
{
|
2014-10-22 02:34:51 -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-19 19:10:43 -07:00
|
|
|
}
|
2014-03-17 00:10:03 -07:00
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
}
|
2014-03-17 00:10:03 -07:00
|
|
|
|
|
|
|
/* Evas filters wrap-up */
|
|
|
|
if (filter)
|
|
|
|
{
|
2014-10-21 19:27:11 -07:00
|
|
|
Eina_Bool ok = EINA_FALSE;
|
2014-03-17 00:10:03 -07:00
|
|
|
|
2014-10-21 19:27:11 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
|
|
|
|
EINA_COW_IMAGE_FILTER_WRITE_BEGIN(state_write, fcow)
|
|
|
|
{
|
2014-03-17 00:10:03 -07:00
|
|
|
|
2014-10-21 19:27:11 -07:00
|
|
|
void *outbuf = evas_filter_buffer_backing_steal(filter, EVAS_FILTER_BUFFER_OUTPUT_ID);
|
|
|
|
if (outbuf != fcow->output)
|
|
|
|
{
|
|
|
|
evas_filter_buffer_backing_release(filter, fcow->output);
|
|
|
|
fcow->output = outbuf;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!input_stolen)
|
|
|
|
evas_filter_image_draw(filter, context, EVAS_FILTER_BUFFER_INPUT_ID, surface, do_async);
|
|
|
|
else
|
|
|
|
evas_filter_buffer_backing_release(filter, surface);
|
|
|
|
|
|
|
|
evas_filter_target_set(filter, context_save, surface_save, obj->cur->geometry.x + x, obj->cur->geometry.y + y);
|
|
|
|
evas_filter_context_post_run_callback_set(filter, _filter_cb, eo_obj);
|
|
|
|
ok = evas_filter_run(filter);
|
|
|
|
|
|
|
|
if (!input_stolen)
|
2014-10-22 02:34:51 -07:00
|
|
|
ENFN->image_map_surface_free(output, surface);
|
|
|
|
ENFN->context_free(output, context);
|
2014-10-21 19:27:11 -07:00
|
|
|
|
|
|
|
if (!ok)
|
|
|
|
{
|
|
|
|
ERR("Rendering failed");
|
|
|
|
fcow->invalid = EINA_TRUE;
|
|
|
|
l = r = t = b = 0;
|
|
|
|
context = context_save;
|
|
|
|
surface = surface_save;
|
|
|
|
input_stolen = EINA_FALSE;
|
|
|
|
clear = EINA_FALSE;
|
|
|
|
filter = NULL;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
fcow->changed = EINA_FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
EINA_COW_IMAGE_FILTER_WRITE_END(state_write, fcow)
|
|
|
|
EINA_COW_IMAGE_STATE_WRITE_END(o, state_write)
|
2014-03-21 01:03:33 -07:00
|
|
|
|
|
|
|
if (!ok)
|
2014-10-21 19:27:11 -07:00
|
|
|
goto start_draw;
|
2014-03-17 00:10:03 -07:00
|
|
|
}
|
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)
|
|
|
|
{
|
|
|
|
Evas_3D_Scene *scene = o->cur->scene;
|
2014-04-25 10:28:38 -07:00
|
|
|
Eina_Bool dirty;
|
|
|
|
|
|
|
|
eo_do(scene, dirty = evas_3d_object_dirty_get(EVAS_3D_STATE_ANY));
|
|
|
|
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
|
|
|
}
|
|
|
|
if (o->dirty_pixels)
|
|
|
|
{
|
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->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
|
|
|
}
|
2014-10-21 22:14:58 -07:00
|
|
|
if (o->cur->filter->changed)
|
2014-03-21 01:03:33 -07:00
|
|
|
{
|
|
|
|
evas_object_render_pre_prev_cur_add(&e->clip_changes, eo_obj, obj);
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
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)
|
|
|
|
{
|
|
|
|
_3d_render(obj->layer->evas->evas, eo_obj, obj, o, o->cur->scene);
|
|
|
|
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-02-17 09:53:25 -08:00
|
|
|
void *im;
|
2012-12-19 14:41:12 -08:00
|
|
|
DATA32 *data = NULL;
|
|
|
|
int err = 0;
|
2012-09-04 01:42:38 -07:00
|
|
|
|
2014-10-22 02:34:51 -07:00
|
|
|
im = ENFN->image_data_get(ENDT, pixels, 0, &data, &err);
|
2012-12-19 14:41:12 -08:00
|
|
|
if ((!im) || (!data) || (err))
|
2009-11-05 07:24:48 -08:00
|
|
|
{
|
2013-02-17 09:53:25 -08:00
|
|
|
ERR("Couldn't get image pixels %p: im=%p, data=%p, err=%d",
|
|
|
|
pixels, im, data, err);
|
2012-12-19 14:41:12 -08:00
|
|
|
goto end;
|
2009-11-05 07:24:48 -08:00
|
|
|
}
|
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-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
|
|
|
end:
|
|
|
|
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;
|
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
|
|
|
|
2012-10-23 01:44:11 -07:00
|
|
|
Evas_Object *
|
|
|
|
_evas_object_image_source_get(Evas_Object *eo_obj)
|
|
|
|
{
|
2014-03-12 07:28:40 -07:00
|
|
|
Evas_Image_Data *o = eo_data_scope_get(eo_obj, MY_CLASS);
|
2013-01-27 16:28:53 -08:00
|
|
|
return o->cur->source;
|
2012-10-23 01:44:11 -07: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;
|
|
|
|
}
|
|
|
|
|
2014-03-17 00:10:03 -07:00
|
|
|
/* Evas Filters functions. Similar to Evas_Text. */
|
|
|
|
|
|
|
|
EOLIAN static void
|
|
|
|
_evas_image_filter_program_set(Eo *eo_obj, Evas_Image_Data *o, const char *arg)
|
|
|
|
{
|
2015-02-10 03:44:38 -08:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2014-03-17 00:10:03 -07:00
|
|
|
Evas_Filter_Program *pgm = NULL;
|
|
|
|
|
|
|
|
if (!o) return;
|
2014-10-21 22:14:58 -07:00
|
|
|
if (o->cur->filter->code == arg) return;
|
|
|
|
if (o->cur->filter->code && arg && !strcmp(arg, o->cur->filter->code)) return;
|
2014-03-17 00:10:03 -07:00
|
|
|
|
2015-02-10 03:44:38 -08:00
|
|
|
evas_object_async_block(obj);
|
2014-03-17 00:10:03 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
|
2014-10-21 19:27:11 -07:00
|
|
|
EINA_COW_IMAGE_FILTER_WRITE_BEGIN(state_write, fcow)
|
2014-03-17 00:10:03 -07:00
|
|
|
{
|
2014-10-21 19:27:11 -07:00
|
|
|
// Parse filter program
|
|
|
|
evas_filter_program_del(fcow->chain);
|
|
|
|
if (arg)
|
|
|
|
{
|
|
|
|
pgm = evas_filter_program_new("Evas_Text: Filter Program", EINA_FALSE);
|
|
|
|
evas_filter_program_source_set_all(pgm, fcow->sources);
|
|
|
|
if (!evas_filter_program_parse(pgm, arg))
|
|
|
|
{
|
|
|
|
ERR("Parsing failed!");
|
|
|
|
evas_filter_program_del(pgm);
|
|
|
|
pgm = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fcow->chain = pgm;
|
|
|
|
fcow->changed = EINA_TRUE;
|
|
|
|
fcow->invalid = (pgm == NULL);
|
|
|
|
eina_stringshare_replace(&fcow->code, arg);
|
2014-03-17 00:10:03 -07:00
|
|
|
}
|
2014-10-21 19:27:11 -07:00
|
|
|
EINA_COW_IMAGE_FILTER_WRITE_END(state_write, fcow)
|
2014-03-17 00:10:03 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
|
|
|
|
|
|
|
|
// Update object
|
|
|
|
o->changed = EINA_TRUE;
|
|
|
|
evas_object_change(eo_obj, obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_filter_source_hash_free_cb(void *data)
|
|
|
|
{
|
|
|
|
Evas_Filter_Proxy_Binding *pb = data;
|
|
|
|
Evas_Object_Protected_Data *proxy, *source;
|
|
|
|
Evas_Image_Data *o;
|
|
|
|
|
2014-06-02 06:47:59 -07:00
|
|
|
proxy = eo_data_scope_get(pb->eo_proxy, EVAS_OBJECT_CLASS);
|
|
|
|
source = eo_data_scope_get(pb->eo_source, EVAS_OBJECT_CLASS);
|
2014-03-17 00:10:03 -07:00
|
|
|
|
|
|
|
if (source)
|
|
|
|
{
|
|
|
|
EINA_COW_WRITE_BEGIN(evas_object_proxy_cow, source->proxy,
|
|
|
|
Evas_Object_Proxy_Data, source_write)
|
|
|
|
source_write->proxies = eina_list_remove(source_write->proxies, pb->eo_proxy);
|
|
|
|
EINA_COW_WRITE_END(evas_object_proxy_cow, source->proxy, source_write)
|
|
|
|
}
|
|
|
|
|
|
|
|
o = eo_data_scope_get(pb->eo_proxy, MY_CLASS);
|
|
|
|
|
|
|
|
if (o && proxy)
|
|
|
|
{
|
2014-10-21 22:14:58 -07:00
|
|
|
if (!eina_hash_population(o->cur->filter->sources))
|
2014-03-17 00:10:03 -07:00
|
|
|
{
|
|
|
|
EINA_COW_WRITE_BEGIN(evas_object_proxy_cow, proxy->proxy,
|
|
|
|
Evas_Object_Proxy_Data, proxy_write)
|
|
|
|
proxy_write->is_proxy = EINA_FALSE;
|
|
|
|
EINA_COW_WRITE_END(evas_object_proxy_cow, source->proxy, proxy_write)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
eina_stringshare_del(pb->name);
|
|
|
|
free(pb);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
|
|
|
_evas_image_filter_source_set(Eo *eo_obj, Evas_Image_Data *o, const char *name,
|
|
|
|
Evas_Object *eo_source)
|
|
|
|
{
|
|
|
|
|
|
|
|
Evas_Object_Protected_Data *obj;
|
2014-10-21 19:27:11 -07:00
|
|
|
Evas_Filter_Program *pgm = o->cur->filter->chain;
|
2014-03-17 00:10:03 -07:00
|
|
|
Evas_Filter_Proxy_Binding *pb, *pb_old = NULL;
|
|
|
|
Evas_Object_Protected_Data *source = NULL;
|
2014-10-21 19:27:11 -07:00
|
|
|
Eina_Hash *sources = o->cur->filter->sources;
|
2014-03-17 00:10:03 -07:00
|
|
|
|
2014-06-02 06:47:59 -07:00
|
|
|
obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
2015-02-10 03:44:38 -08:00
|
|
|
evas_object_async_block(obj);
|
2014-06-02 06:47:59 -07:00
|
|
|
if (eo_source) source = eo_data_scope_get(eo_source, EVAS_OBJECT_CLASS);
|
2014-03-17 00:10:03 -07:00
|
|
|
|
|
|
|
if (!name)
|
|
|
|
{
|
2014-10-21 19:27:11 -07:00
|
|
|
if (!eo_source || !o->cur->filter->sources) return;
|
|
|
|
if (eina_hash_del_by_data(o->cur->filter->sources, eo_source))
|
2014-03-17 00:10:03 -07:00
|
|
|
goto update;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!sources)
|
|
|
|
{
|
|
|
|
if (!source) return;
|
|
|
|
sources = eina_hash_string_small_new
|
|
|
|
(EINA_FREE_CB(_filter_source_hash_free_cb));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pb_old = eina_hash_find(sources, name);
|
|
|
|
if (pb_old)
|
|
|
|
{
|
|
|
|
if (pb_old->eo_source == eo_source) goto update;
|
|
|
|
eina_hash_del(sources, name, pb_old);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!source)
|
|
|
|
{
|
|
|
|
pb_old = eina_hash_find(sources, name);
|
|
|
|
if (!pb_old) return;
|
|
|
|
eina_hash_del_by_key(sources, name);
|
|
|
|
goto update;
|
|
|
|
}
|
|
|
|
|
|
|
|
pb = calloc(1, sizeof(*pb));
|
|
|
|
pb->eo_proxy = eo_obj;
|
|
|
|
pb->eo_source = eo_source;
|
|
|
|
pb->name = eina_stringshare_add(name);
|
|
|
|
|
|
|
|
EINA_COW_WRITE_BEGIN(evas_object_proxy_cow, source->proxy,
|
|
|
|
Evas_Object_Proxy_Data, source_write)
|
|
|
|
if (!eina_list_data_find(source_write->proxies, eo_obj))
|
|
|
|
source_write->proxies = eina_list_append(source_write->proxies, eo_obj);
|
|
|
|
EINA_COW_WRITE_END(evas_object_proxy_cow, source->proxy, source_write)
|
|
|
|
|
|
|
|
EINA_COW_WRITE_BEGIN(evas_object_proxy_cow, obj->proxy,
|
|
|
|
Evas_Object_Proxy_Data, proxy_write)
|
|
|
|
proxy_write->is_proxy = EINA_TRUE;
|
|
|
|
EINA_COW_WRITE_END(evas_object_proxy_cow, obj->proxy, proxy_write)
|
|
|
|
|
|
|
|
eina_hash_add(sources, pb->name, pb);
|
|
|
|
evas_filter_program_source_set_all(pgm, sources);
|
|
|
|
|
|
|
|
update:
|
|
|
|
EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
|
2014-10-21 19:27:11 -07:00
|
|
|
EINA_COW_IMAGE_FILTER_WRITE_BEGIN(state_write, fcow)
|
|
|
|
fcow->changed = EINA_TRUE;
|
|
|
|
fcow->invalid = EINA_FALSE;
|
|
|
|
fcow->sources = sources;
|
|
|
|
EINA_COW_IMAGE_FILTER_WRITE_END(state_write, fcow)
|
2014-03-17 00:10:03 -07:00
|
|
|
EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
|
|
|
|
|
|
|
|
// Update object
|
|
|
|
o->changed = 1;
|
|
|
|
evas_object_change(eo_obj, obj);
|
|
|
|
evas_object_clip_dirty(eo_obj, obj);
|
|
|
|
evas_object_coords_recalc(eo_obj, obj);
|
|
|
|
evas_object_inform_call_resize(eo_obj);
|
|
|
|
}
|
|
|
|
|
2014-03-20 00:29:24 -07:00
|
|
|
EOLIAN Eina_Bool
|
|
|
|
_evas_image_filter_padding_get(Eo *obj EINA_UNUSED, Evas_Image_Data *o,
|
|
|
|
int *l, int *r, int *t, int *b)
|
|
|
|
{
|
2014-10-21 19:27:11 -07:00
|
|
|
Evas_Filter_Program *pgm = o->cur->filter->chain;
|
2014-03-20 00:29:24 -07:00
|
|
|
int pl = 0, pr = 0, pt = 0, pb = 0;
|
|
|
|
Eina_Bool used = EINA_FALSE;
|
|
|
|
|
|
|
|
if (pgm)
|
|
|
|
{
|
2014-10-21 19:27:11 -07:00
|
|
|
used = !o->cur->filter->invalid;
|
2014-03-20 00:29:24 -07:00
|
|
|
evas_filter_program_padding_get(pgm, &pl, &pr, &pt, &pb);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (l) *l = pl;
|
|
|
|
if (r) *r = pr;
|
|
|
|
if (t) *t = pt;
|
|
|
|
if (b) *b = pb;
|
|
|
|
return used;
|
|
|
|
}
|
|
|
|
|
2011-02-06 15:52:17 -08:00
|
|
|
/* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/
|
2014-03-12 07:28:40 -07:00
|
|
|
|
2014-07-22 06:55:51 -07:00
|
|
|
EAPI void
|
|
|
|
evas_object_image_file_set(Eo *obj, const char *file, const char *key)
|
|
|
|
{
|
|
|
|
eo_do((Eo *) obj, efl_file_set(file, key));
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
evas_object_image_file_get(const Eo *obj, const char **file, const char **key)
|
|
|
|
{
|
|
|
|
eo_do((Eo *) obj, efl_file_get(file, key));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
evas_object_image_save(const Eo *obj, const char *file, const char *key, const char *flags)
|
|
|
|
{
|
2015-02-23 08:38:00 -08:00
|
|
|
Eina_Bool ret;
|
|
|
|
return eo_do_ret((Eo *) obj, ret, efl_file_save(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)
|
|
|
|
{
|
2015-02-23 08:38:00 -08:00
|
|
|
Eina_Bool ret;
|
|
|
|
return eo_do_ret((Eo *) obj, ret, efl_image_animated_get());
|
2014-07-23 09:03:40 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
evas_object_image_load_size_set(Eo *obj, int w, int h)
|
|
|
|
{
|
|
|
|
eo_do((Eo *) obj, efl_image_load_size_set(w, h));
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
evas_object_image_load_size_get(const Eo *obj, int *w, int *h)
|
|
|
|
{
|
|
|
|
eo_do((Eo *) obj, efl_image_load_size_get(w, h));
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
evas_object_image_smooth_scale_set(Eo *obj, Eina_Bool smooth_scale)
|
|
|
|
{
|
|
|
|
eo_do((Eo *) obj, efl_image_smooth_scale_set(smooth_scale));
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
evas_object_image_smooth_scale_get(const Eo *obj)
|
|
|
|
{
|
2015-02-23 08:38:00 -08:00
|
|
|
Eina_Bool ret;
|
|
|
|
return eo_do_ret((Eo *) obj, ret, efl_image_smooth_scale_get());
|
2014-07-23 09:03:40 -07:00
|
|
|
}
|
|
|
|
|
2014-03-12 07:28:40 -07:00
|
|
|
#include "canvas/evas_image.eo.c"
|