summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/edje/edje_calc.c4
-rw-r--r--src/lib/evas/Evas_Legacy.h134
-rw-r--r--src/lib/evas/canvas/evas_image.eo129
-rw-r--r--src/lib/evas/canvas/evas_object.eo3
-rw-r--r--src/lib/evas/canvas/evas_object_image.c464
-rw-r--r--src/lib/evas/canvas/evas_object_main.c7
-rw-r--r--src/lib/evas/canvas/evas_render.c2
-rw-r--r--src/tests/edje/edje_test_edje.c2
8 files changed, 290 insertions, 455 deletions
diff --git a/src/lib/edje/edje_calc.c b/src/lib/edje/edje_calc.c
index 8b19443584..2a2ada6d8d 100644
--- a/src/lib/edje/edje_calc.c
+++ b/src/lib/edje/edje_calc.c
@@ -3163,8 +3163,8 @@ _edje_proxy_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3, Edj
3163 3163
3164 efl_gfx_fill_set(ep->object, p3->type.common.fill.x, p3->type.common.fill.y, p3->type.common.fill.w, p3->type.common.fill.h); 3164 efl_gfx_fill_set(ep->object, p3->type.common.fill.x, p3->type.common.fill.y, p3->type.common.fill.w, p3->type.common.fill.h);
3165 efl_image_smooth_scale_set(ep->object, p3->smooth); 3165 efl_image_smooth_scale_set(ep->object, p3->smooth);
3166 evas_obj_image_source_visible_set(ep->object, chosen_desc->proxy.source_visible); 3166 evas_object_image_source_visible_set(ep->object, chosen_desc->proxy.source_visible);
3167 evas_obj_image_source_clip_set(ep->object, chosen_desc->proxy.source_clip); 3167 efl_canvas_proxy_source_clip_set(ep->object, chosen_desc->proxy.source_clip);
3168} 3168}
3169 3169
3170static void 3170static void
diff --git a/src/lib/evas/Evas_Legacy.h b/src/lib/evas/Evas_Legacy.h
index 73baa1aace..f5b5e5c32e 100644
--- a/src/lib/evas/Evas_Legacy.h
+++ b/src/lib/evas/Evas_Legacy.h
@@ -3439,6 +3439,140 @@ EAPI void *evas_object_image_data_get(const Evas_Object *obj, Eina_Bool for_writ
3439 */ 3439 */
3440EAPI void evas_object_image_data_update_add(Evas_Object *obj, int x, int y, int w, int h); 3440EAPI void evas_object_image_data_update_add(Evas_Object *obj, int x, int y, int w, int h);
3441 3441
3442/**
3443 * @brief The content below the Evas_Object_Image will be rendered inside it
3444 * and you can reuse it as a source for any kind of effect.
3445 *
3446 * @param[in] s Wether to put the content of the canvas below inside the
3447 * Evas_Object_Image.
3448 *
3449 * @since 1.15
3450 */
3451EAPI void evas_object_image_snapshot_set(Evas_Object *obj, Eina_Bool s);
3452
3453/**
3454 * @brief Determine wether the Evas_Object_Image replicate the content of the
3455 * canvas below.
3456 *
3457 * @return Wether to put the content of the canvas below inside the
3458 * Evas_Object_Image.
3459 *
3460 * @since 1.15
3461 */
3462EAPI Eina_Bool evas_object_image_snapshot_get(const Evas_Object *obj);
3463
3464/**
3465 * @brief Set the source object on an image object to used as a proxy.
3466 *
3467 * If an image object is set to behave as a proxy, it will mirror the rendering
3468 * contents of a given source object in its drawing region, without affecting
3469 * that source in any way. The source must be another valid Evas object. Other
3470 * effects may be applied to the proxy, such as a map (see @ref
3471 * evas_object_map_set) to create a reflection of the original object (for
3472 * example).
3473 *
3474 * Any existing source object on @c obj will be removed after this call.
3475 * Setting @c src to @c null clears the proxy object (not in "proxy state"
3476 * anymore).
3477 *
3478 * @warning You cannot set a proxy as another proxy's source.
3479 *
3480 * @param[in] src Source object to use for the proxy.
3481 */
3482EAPI Eina_Bool evas_object_image_source_set(Evas_Object *obj, Evas_Object *src);
3483
3484/**
3485 * @brief Get the current source object of an image object.
3486 *
3487 * @return Source object to use for the proxy.
3488 */
3489EAPI Evas_Object *evas_object_image_source_get(const Evas_Object *obj);
3490
3491/**
3492 * @brief Clip the proxy object with the source object's clipper.
3493 *
3494 * @param[in] source_clip Whether @c obj is clipped by the source clipper
3495 * ($true) or not ($false).
3496 *
3497 * @since 1.8
3498 */
3499EAPI void evas_object_image_source_clip_set(Evas_Object *obj, Eina_Bool source_clip);
3500
3501/**
3502 * @brief Determine whether an object is clipped by source object's clipper.
3503 *
3504 * @return Whether @c obj is clipped by the source clipper ($true) or not
3505 * ($false).
3506 *
3507 * @since 1.8
3508 */
3509EAPI Eina_Bool evas_object_image_source_clip_get(const Evas_Object *obj);
3510
3511/**
3512 * @brief Set whether an Evas object is to source events.
3513 *
3514 * Set whether an Evas object is to repeat events to source.
3515 *
3516 * If @c repeat is @c true, it will make events on @c obj to also be repeated
3517 * for the source object (see @ref evas_object_image_source_set). Even the
3518 * @c obj and source geometries are different, the event position will be
3519 * transformed to the source object's space.
3520 *
3521 * If @c repeat is @c false, events occurring on @c obj will be processed only
3522 * on it.
3523 *
3524 * @param[in] source Whether @c obj is to pass events ($true) or not ($false).
3525 *
3526 * @since 1.8
3527 */
3528EAPI void evas_object_image_source_events_set(Evas_Object *obj, Eina_Bool repeat);
3529
3530/**
3531 * @brief Determine whether an object is set to source events.
3532 *
3533 * @return Whether @c obj is to pass events ($true) or not ($false).
3534 *
3535 * @since 1.8
3536 */
3537EAPI Eina_Bool evas_object_image_source_events_get(const Evas_Object *obj);
3538
3539/**
3540 * @brief Set the source object to be visible or not.
3541 *
3542 * If @c visible is set to @c false, the source object of the proxy ($obj) will
3543 * be invisible.
3544 *
3545 * This API works differently to @ref evas_object_show and @ref
3546 * evas_object_hide. Once source object is hidden, the proxy object will be
3547 * hidden as well. Actually in this case both objects are excluded from the
3548 * Evas internal update circle.
3549 *
3550 * By this API, instead, one can toggle the visibility of a proxy's source
3551 * object remaining the proxy visibility untouched.
3552 *
3553 * @warning If the all of proxies are deleted, then the source visibility of
3554 * the source object will be cancelled.
3555 *
3556 * @param[in] visible @c true is source object to be shown, @c false otherwise.
3557 *
3558 * @deprecated Please use evas_object_norender_get() on the source instead.
3559 *
3560 * @since 1.8
3561 */
3562EAPI void evas_object_image_source_visible_set(Evas_Object *obj, Eina_Bool visible);
3563
3564/**
3565 * @brief Get the state of the source object visibility.
3566 *
3567 * @return @c true is source object to be shown, @c false otherwise.
3568 *
3569 * @deprecated Please use evas_object_norender_get() on the source instead.
3570 *
3571 * @since 1.8
3572 */
3573EAPI Eina_Bool evas_object_image_source_visible_get(const Evas_Object *obj);
3574
3575
3442/* 3576/*
3443 * Converts the raw image data of the given image object to the 3577 * Converts the raw image data of the given image object to the
3444 * specified colorspace. 3578 * specified colorspace.
diff --git a/src/lib/evas/canvas/evas_image.eo b/src/lib/evas/canvas/evas_image.eo
index 7ed0ac2624..9edb29e5fa 100644
--- a/src/lib/evas/canvas/evas_image.eo
+++ b/src/lib/evas/canvas/evas_image.eo
@@ -5,114 +5,6 @@ class Evas.Image (Evas.Object, Efl.File, Efl.Image, Efl.Image_Load, Efl.Image_An
5 legacy_prefix: evas_object_image; 5 legacy_prefix: evas_object_image;
6 eo_prefix: evas_obj_image; 6 eo_prefix: evas_obj_image;
7 methods { 7 methods {
8 /* PROXY stuff */
9 @property source_clip {
10 set {
11 [[Clip the proxy object with the source object's clipper.
12
13 @since 1.8
14 ]]
15 }
16 get {
17 [[Determine whether an object is clipped by source object's
18 clipper.
19
20 @since 1.8
21 ]]
22 }
23 values {
24 source_clip: bool; [[Whether $obj is clipped by the source
25 clipper ($true) or not ($false).]]
26 }
27 }
28 @property source {
29 set {
30 [[Set the source object on an image object to used as a proxy.
31
32 If an image object is set to behave as a proxy, it will mirror
33 the rendering contents of a given source object in its drawing
34 region, without affecting that source in any way. The source
35 must be another valid Evas object. Other effects may be
36 applied to the proxy, such as a map (see
37 \@ref evas_object_map_set) to create a reflection of the
38 original object (for example).
39
40 Any existing source object on $obj will be removed after this
41 call. Setting $src to $null clears the proxy object (not in
42 "proxy state" anymore).
43
44 Warning: You cannot set a proxy as another proxy's source.
45 ]]
46 return: bool;
47 }
48 get {
49 [[Get the current source object of an image object.]]
50 }
51 values {
52 src: Evas.Object *; [[Source object to use for the proxy.]]
53 }
54 }
55 @property source_visible {
56 set {
57 [[Set the source object to be visible or not.
58
59 If $visible is set to $false, the source object of the
60 proxy ($obj) will be invisible.
61
62 This API works differently to \@ref evas_object_show and
63 \@ref evas_object_hide. Once source object is hidden, the
64 proxy object will be hidden as well. Actually in this case
65 both objects are excluded from the Evas internal update circle.
66
67 By this API, instead, one can toggle the visibility of a
68 proxy's source object remaining the proxy visibility untouched.
69
70 Warning: If the all of proxies are deleted, then the source
71 visibility of the source object will be cancelled.
72
73 @since 1.8
74 ]]
75 }
76 get {
77 [[Get the state of the source object visibility.
78
79 @since 1.8
80 ]]
81 }
82 values {
83 visible: bool; [[$true is source object to be shown, $false
84 otherwise.]]
85 }
86 }
87 @property source_events {
88 set {
89 [[Set whether an Evas object is to source events.
90
91 Set whether an Evas object is to repeat events to source.
92
93 If $source is $true, it will make events on $obj to also be
94 repeated for the source object (see @.source.set). Even the
95 $obj and source geometries are different, the event position
96 will be transformed to the source object's space.
97
98 If $source is $false, events occurring on $obj will be
99 processed only on it.
100
101 @since 1.8
102 ]]
103 }
104 get {
105 [[Determine whether an object is set to source events.
106
107 @since 1.8
108 ]]
109 }
110 values {
111 source: bool; [[Whether $obj is to pass events ($true) or not
112 ($false).]]
113 }
114 }
115
116 /* weird stuff - hints */ 8 /* weird stuff - hints */
117 @property content_hint { 9 @property content_hint {
118 set { 10 set {
@@ -274,27 +166,6 @@ class Evas.Image (Evas.Object, Efl.File, Efl.Image, Efl.Image_Load, Efl.Image_An
274 scene: Evas.Canvas3D.Scene *; [[3D scene on an image object.]] 166 scene: Evas.Canvas3D.Scene *; [[3D scene on an image object.]]
275 } 167 }
276 } 168 }
277 @property snapshot {
278 set {
279 [[The content below the Evas_Object_Image will be rendered
280 inside it and you can reuse it as a source for any kind
281 of effect.
282
283 @since 1.15
284 ]]
285 }
286 get {
287 [[Determine wether the Evas_Object_Image replicate the content
288 of the canvas below.
289
290 @since 1.15
291 ]]
292 }
293 values {
294 s: bool; [[Wether to put the content of the canvas below inside
295 the Evas_Object_Image.]]
296 }
297 }
298 } 169 }
299 implements { 170 implements {
300 Eo.Base.constructor; 171 Eo.Base.constructor;
diff --git a/src/lib/evas/canvas/evas_object.eo b/src/lib/evas/canvas/evas_object.eo
index 394031acf3..628580fb5a 100644
--- a/src/lib/evas/canvas/evas_object.eo
+++ b/src/lib/evas/canvas/evas_object.eo
@@ -5,6 +5,9 @@ abstract Evas.Object (Eo.Base, Evas.Common_Interface, Efl.Gfx.Base, Efl.Gfx.Stac
5 eo_prefix: evas_obj; 5 eo_prefix: evas_obj;
6 data: Evas_Object_Protected_Data; 6 data: Evas_Object_Protected_Data;
7 methods { 7 methods {
8 legacy_ctor @protected {
9 [[Internal function. Do not use.]]
10 }
8 @property size_hint_max { 11 @property size_hint_max {
9 set { 12 set {
10 [[Sets the hints for an object's maximum size. 13 [[Sets the hints for an object's maximum size.
diff --git a/src/lib/evas/canvas/evas_object_image.c b/src/lib/evas/canvas/evas_object_image.c
index 2bd78aa44c..ffb883a747 100644
--- a/src/lib/evas/canvas/evas_object_image.c
+++ b/src/lib/evas/canvas/evas_object_image.c
@@ -1,31 +1,8 @@
1#define EVAS_FILTER_PROTECTED 1#include "evas_image_private.h"
2
3#include "evas_common_private.h"
4
5#include <sys/types.h>
6#include <unistd.h>
7#ifdef HAVE_SYS_MMAN_H
8# include <sys/mman.h>
9#endif
10#include <math.h>
11
12#include "evas_private.h"
13#ifdef EVAS_CSERVE2
14#include "../cserve2/evas_cs2_private.h"
15#endif
16#include "../common/evas_convert_color.h"
17#include "../common/evas_convert_colorspace.h"
18#include "../common/evas_convert_yuv.h"
19
20#include "evas_filter.eo.h"
21#include "evas_filter.h"
22 2
23#define MY_CLASS EVAS_IMAGE_CLASS 3#define MY_CLASS EVAS_IMAGE_CLASS
24
25#define MY_CLASS_NAME "Evas_Image" 4#define MY_CLASS_NAME "Evas_Image"
26 5
27#define VERBOSE_PROXY_ERROR 1
28
29/* save typing */ 6/* save typing */
30#define ENFN obj->layer->evas->engine.func 7#define ENFN obj->layer->evas->engine.func
31#define ENDT obj->layer->evas->engine.data.output 8#define ENDT obj->layer->evas->engine.data.output
@@ -35,114 +12,6 @@ static const char o_type[] = "image";
35 12
36const char *o_image_type = o_type; 13const char *o_image_type = o_type;
37 14
38/* private struct for rectangle object internal data */
39typedef struct _Evas_Object_Image Evas_Image_Data;
40typedef struct _Evas_Object_Image_Load_Opts Evas_Object_Image_Load_Opts;
41typedef struct _Evas_Object_Image_Pixels Evas_Object_Image_Pixels;
42typedef struct _Evas_Object_Image_State Evas_Object_Image_State;
43
44struct _Evas_Object_Image_Load_Opts
45{
46 unsigned char scale_down_by;
47 double dpi;
48 short w, h;
49 struct {
50 short x, y, w, h;
51 } region;
52 struct {
53 int src_x, src_y, src_w, src_h;
54 int dst_w, dst_h;
55 int smooth;
56 int scale_hint;
57 } scale_load;
58 Eina_Bool orientation : 1;
59};
60
61struct _Evas_Object_Image_Pixels
62{
63 Eina_List *pixel_updates;
64 struct {
65 Evas_Object_Image_Pixels_Get_Cb get_pixels;
66 void *get_pixels_data;
67 } func;
68
69 Evas_Video_Surface video;
70 unsigned int video_caps;
71};
72
73struct _Evas_Object_Image_State
74{
75 Evas_Coord_Rectangle fill;
76 struct {
77 short w, h, stride;
78 } image;
79 struct {
80 double scale;
81 short l, r, t, b;
82 unsigned char fill;
83 } border;
84
85 Evas_Object *source;
86 Evas_Map *defmap;
87 Evas_Canvas3D_Scene *scene;
88
89 union {
90 const char *file;
91 Eina_File *f;
92 } u;
93 const char *key;
94 int frame;
95
96 Evas_Colorspace cspace;
97 Evas_Image_Orient orient;
98
99 Eina_Bool smooth_scale : 1;
100 Eina_Bool has_alpha :1;
101 Eina_Bool opaque_valid : 1;
102 Eina_Bool opaque : 1;
103 Eina_Bool mmaped_source : 1;
104};
105
106struct _Evas_Object_Image
107{
108 const Evas_Object_Image_State *cur;
109 const Evas_Object_Image_State *prev;
110
111 // This pointer is an Eina_Cow pointer
112 const Evas_Object_Image_Load_Opts *load_opts;
113 const Evas_Object_Image_Pixels *pixels;
114
115 void *engine_data;
116
117 int pixels_checked_out;
118 int load_error;
119
120 Evas_Image_Scale_Hint scale_hint;
121 Evas_Image_Content_Hint content_hint;
122
123 Eina_Bool changed : 1;
124 Eina_Bool dirty_pixels : 1;
125 Eina_Bool filled : 1;
126 Eina_Bool filled_set : 1;
127 Eina_Bool proxyrendering : 1;
128 Eina_Bool preloading : 1;
129 Eina_Bool video_surface : 1;
130 Eina_Bool video_visible : 1;
131 Eina_Bool created : 1;
132 Eina_Bool proxyerror : 1;
133 Eina_Bool proxy_src_clip : 1;
134 Eina_Bool written : 1;
135 Eina_Bool direct_render : 1;
136 Eina_Bool has_filter : 1;
137 struct
138 {
139 Eina_Bool video_move : 1;
140 Eina_Bool video_resize : 1;
141 Eina_Bool video_show : 1;
142 Eina_Bool video_hide : 1;
143 } delayed;
144};
145
146/* private methods for image objects */ 15/* private methods for image objects */
147static void evas_object_image_unload(Evas_Object *eo_obj, Eina_Bool dirty); 16static void evas_object_image_unload(Evas_Object *eo_obj, Eina_Bool dirty);
148static void evas_object_image_load(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Evas_Image_Data *o); 17static void evas_object_image_load(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Evas_Image_Data *o);
@@ -192,10 +61,6 @@ static int evas_object_image_can_map(Evas_Object *eo_obj);
192static void *evas_object_image_data_convert_internal(Evas_Image_Data *o, void *data, Evas_Colorspace to_cspace); 61static void *evas_object_image_data_convert_internal(Evas_Image_Data *o, void *data, Evas_Colorspace to_cspace);
193static void evas_object_image_filled_resize_listener(void *data, Evas *eo_e, Evas_Object *eo_obj, void *einfo); 62static void evas_object_image_filled_resize_listener(void *data, Evas *eo_e, Evas_Object *eo_obj, void *einfo);
194 63
195static void _proxy_unset(Evas_Object *proxy, Evas_Object_Protected_Data *obj, Evas_Image_Data *o);
196static void _proxy_set(Evas_Object *proxy, Evas_Object *src);
197static void _proxy_error(Evas_Object *proxy, void *context, void *output, void *surface, int x, int y, Eina_Bool do_async);
198
199static void _3d_render(Evas *eo_e, Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Evas_Image_Data *o, Evas_Canvas3D_Scene *scene); 64static void _3d_render(Evas *eo_e, Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Evas_Image_Data *o, Evas_Canvas3D_Scene *scene);
200static void _3d_set(Evas_Object *eo_obj, Evas_Canvas3D_Scene *scene); 65static void _3d_set(Evas_Object *eo_obj, Evas_Canvas3D_Scene *scene);
201static void _3d_unset(Evas_Object *eo_obj, Evas_Object_Protected_Data *image, Evas_Image_Data *o); 66static void _3d_unset(Evas_Object *eo_obj, Evas_Object_Protected_Data *image, Evas_Image_Data *o);
@@ -263,7 +128,6 @@ Eina_Cow *evas_object_image_state_cow = NULL;
263# define EINA_COW_PIXEL_WRITE_END(Obj, Write) \ 128# define EINA_COW_PIXEL_WRITE_END(Obj, Write) \
264 EINA_COW_WRITE_END(evas_object_image_pixels_cow, Obj->pixels, Write) 129 EINA_COW_WRITE_END(evas_object_image_pixels_cow, Obj->pixels, Write)
265 130
266
267# define EINA_COW_LOAD_OPTS_WRITE_BEGIN(Obj, Write) \ 131# define EINA_COW_LOAD_OPTS_WRITE_BEGIN(Obj, Write) \
268 EINA_COW_WRITE_BEGIN(evas_object_image_load_opts_cow, Obj->load_opts, Evas_Object_Image_Load_Opts, Write) 132 EINA_COW_WRITE_BEGIN(evas_object_image_load_opts_cow, Obj->load_opts, Evas_Object_Image_Load_Opts, Write)
269 133
@@ -288,7 +152,7 @@ Eina_Cow *evas_object_image_state_cow = NULL;
288 EINA_COW_IMAGE_STATE_WRITE_END(Obj, cur_write); \ 152 EINA_COW_IMAGE_STATE_WRITE_END(Obj, cur_write); \
289 } 153 }
290 154
291static void 155void
292_evas_object_image_cleanup(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Evas_Image_Data *o) 156_evas_object_image_cleanup(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Evas_Image_Data *o)
293{ 157{
294 /* Eina_Cow doesn't know if the resulting memory has changed, better check 158 /* Eina_Cow doesn't know if the resulting memory has changed, better check
@@ -601,65 +465,6 @@ _evas_image_efl_file_file_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o, const
601 if (key) *key = o->cur->key; 465 if (key) *key = o->cur->key;
602} 466}
603 467
604EOLIAN static Eina_Bool
605_evas_image_source_set(Eo *eo_obj, Evas_Image_Data *o, Evas_Object *eo_src)
606{
607 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
608
609 if (obj->delete_me && eo_src)
610 {
611 WRN("Setting deleted object %p as image source %p", eo_src, eo_obj);
612 return EINA_FALSE;
613 }
614 if (eo_src)
615 {
616 Evas_Object_Protected_Data *src = eo_data_scope_get(eo_src, EVAS_OBJECT_CLASS);
617 if (src->delete_me)
618 {
619 WRN("Setting object %p to deleted image source %p", eo_src, eo_obj);
620 return EINA_FALSE;
621 }
622 if (!src->layer)
623 {
624 CRI("No evas surface associated with source object (%p)", eo_src);
625 return EINA_FALSE;
626 }
627 if (!obj->layer)
628 {
629 CRI("No evas surface associated with destination object (%p)", eo_obj);
630 return EINA_FALSE;
631 }
632 if ((obj->layer && src->layer) &&
633 (obj->layer->evas != src->layer->evas))
634 {
635 CRI("Setting object %p from Evas (%p) from another Evas (%p)", eo_src, src->layer->evas, obj->layer->evas);
636 return EINA_FALSE;
637 }
638 if (eo_src == eo_obj)
639 {
640 CRI("Setting object %p as a source for itself", obj);
641 return EINA_FALSE;
642 }
643 }
644 if (o->cur->source == eo_src) return EINA_TRUE;
645 evas_object_async_block(obj);
646 _evas_object_image_cleanup(eo_obj, obj, o);
647 /* Kill the image if any */
648 if (o->cur->u.file || o->cur->key)
649 evas_object_image_file_set(eo_obj, NULL, NULL);
650
651 if (eo_src) _proxy_set(eo_obj, eo_src);
652 else _proxy_unset(eo_obj, obj, o);
653
654 return EINA_TRUE;
655}
656
657EOLIAN static Evas_Object*
658_evas_image_source_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o)
659{
660 return o->cur->source;
661}
662
663EOLIAN static void 468EOLIAN static void
664_evas_image_efl_image_orientation_set(Eo *eo_obj, Evas_Image_Data *o, Efl_Gfx_Orientation _orient) 469_evas_image_efl_image_orientation_set(Eo *eo_obj, Evas_Image_Data *o, Efl_Gfx_Orientation _orient)
665{ 470{
@@ -716,60 +521,6 @@ _evas_image_efl_image_orientation_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o
716 return (Efl_Gfx_Orientation) o->cur->orient; 521 return (Efl_Gfx_Orientation) o->cur->orient;
717} 522}
718 523
719EAPI Eina_Bool
720evas_object_image_source_unset(Evas_Object *eo_obj)
721{
722 Eina_Bool result = EINA_FALSE;
723 result = evas_obj_image_source_set(eo_obj, NULL);
724 return result;
725}
726
727EOLIAN static void
728_evas_image_source_clip_set(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o, Eina_Bool source_clip)
729{
730 Evas_Object_Protected_Data *src_obj;
731 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
732
733 source_clip = !!source_clip;
734 if (o->proxy_src_clip == source_clip) return;
735 evas_object_async_block(obj);
736 o->proxy_src_clip = source_clip;
737
738 if (!o->cur->source) return;
739
740 src_obj = eo_data_scope_get(o->cur->source, EVAS_OBJECT_CLASS);
741 evas_object_change(o->cur->source, src_obj);
742}
743
744EOLIAN static Eina_Bool
745_evas_image_source_clip_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o)
746{
747 return o->proxy_src_clip;
748}
749
750EOLIAN static void
751_evas_image_source_events_set(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o, Eina_Bool source_events)
752{
753 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
754
755 source_events = !!source_events;
756 if (obj->proxy->src_events == source_events) return;
757
758 EINA_COW_WRITE_BEGIN(evas_object_proxy_cow, obj->proxy, Evas_Object_Proxy_Data, proxy_write)
759 proxy_write->src_events = source_events;
760 EINA_COW_WRITE_END(evas_object_proxy_cow, obj->proxy, proxy_write);
761
762 if (!o->cur->source) return;
763 if ((obj->proxy->src_invisible) || (!source_events)) return;
764 //FIXME: Feed mouse events here.
765}
766
767EOLIAN static Eina_Bool
768_evas_image_source_events_get(Eo *eo_obj, Evas_Image_Data *_pd EINA_UNUSED)
769{
770 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
771 return obj->proxy->src_events;
772}
773 524
774EOLIAN static void 525EOLIAN static void
775_evas_image_eo_base_dbg_info_get(Eo *eo_obj, Evas_Image_Data *o, Eo_Dbg_Info *root) 526_evas_image_eo_base_dbg_info_get(Eo *eo_obj, Evas_Image_Data *o, Eo_Dbg_Info *root)
@@ -799,46 +550,6 @@ _evas_image_eo_base_dbg_info_get(Eo *eo_obj, Evas_Image_Data *o, Eo_Dbg_Info *ro
799} 550}
800 551
801EOLIAN static void 552EOLIAN static void
802_evas_image_source_visible_set(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o, Eina_Bool visible)
803{
804 Evas_Object_Protected_Data *src_obj;
805 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
806
807 if (!o->cur->source) return;
808
809 visible = !!visible;
810 src_obj = eo_data_scope_get(o->cur->source, EVAS_OBJECT_CLASS);
811 if (src_obj->proxy->src_invisible == !visible) return;
812
813 evas_object_async_block(obj);
814 EINA_COW_WRITE_BEGIN(evas_object_proxy_cow, src_obj->proxy, Evas_Object_Proxy_Data, proxy_write)
815 proxy_write->src_invisible = !visible;
816 EINA_COW_WRITE_END(evas_object_proxy_cow, src_obj->proxy, proxy_write);
817
818 src_obj->changed_src_visible = EINA_TRUE;
819 evas_object_smart_member_cache_invalidate(o->cur->source, EINA_FALSE,
820 EINA_FALSE, EINA_TRUE);
821 evas_object_change(o->cur->source, src_obj);
822 if ((!visible) || (!src_obj->proxy->src_events)) return;
823 //FIXME: Feed mouse events here.
824}
825
826EOLIAN static Eina_Bool
827_evas_image_source_visible_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o)
828{
829 Evas_Object_Protected_Data *src_obj;
830 Eina_Bool visible;
831
832 if (!o->cur->source) visible = EINA_FALSE;
833 src_obj = eo_data_scope_get(o->cur->source, EVAS_OBJECT_CLASS);
834 if (src_obj) visible = !src_obj->proxy->src_invisible;
835 else visible = EINA_FALSE;
836
837 return visible;
838}
839
840
841EOLIAN static void
842_evas_image_scene_set(Eo *eo_obj, Evas_Image_Data *o, Evas_Canvas3D_Scene *scene) 553_evas_image_scene_set(Eo *eo_obj, Evas_Image_Data *o, Evas_Canvas3D_Scene *scene)
843{ 554{
844 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS); 555 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
@@ -2252,8 +1963,7 @@ _evas_canvas_image_max_size_get(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e, int *
2252 return EINA_TRUE; 1963 return EINA_TRUE;
2253} 1964}
2254 1965
2255/* all nice and private */ 1966void
2256static void
2257_proxy_unset(Evas_Object *proxy, Evas_Object_Protected_Data *cur_proxy, Evas_Image_Data *o) 1967_proxy_unset(Evas_Object *proxy, Evas_Object_Protected_Data *cur_proxy, Evas_Image_Data *o)
2258{ 1968{
2259 Evas_Object_Protected_Data *cur_source; 1969 Evas_Object_Protected_Data *cur_source;
@@ -2309,7 +2019,7 @@ _proxy_unset(Evas_Object *proxy, Evas_Object_Protected_Data *cur_proxy, Evas_Ima
2309 EINA_COW_WRITE_END(evas_object_proxy_cow, cur_proxy->proxy, proxy_write); 2019 EINA_COW_WRITE_END(evas_object_proxy_cow, cur_proxy->proxy, proxy_write);
2310} 2020}
2311 2021
2312static void 2022void
2313_proxy_set(Evas_Object *eo_proxy, Evas_Object *eo_src) 2023_proxy_set(Evas_Object *eo_proxy, Evas_Object *eo_src)
2314{ 2024{
2315 Evas_Object_Protected_Data *src = eo_data_scope_get(eo_src, EVAS_OBJECT_CLASS); 2025 Evas_Object_Protected_Data *src = eo_data_scope_get(eo_src, EVAS_OBJECT_CLASS);
@@ -2341,17 +2051,21 @@ _proxy_set(Evas_Object *eo_proxy, Evas_Object *eo_src)
2341/* Some moron just set a proxy on a proxy. 2051/* Some moron just set a proxy on a proxy.
2342 * Give them some pixels. A random color 2052 * Give them some pixels. A random color
2343 */ 2053 */
2344static void 2054void
2345_proxy_error(Evas_Object *eo_proxy, void *context, void *output, void *surface, 2055_proxy_error(Evas_Object *eo_proxy, void *context, void *output, void *surface,
2346 int x, int y, Eina_Bool do_async) 2056 int x, int y, Eina_Bool do_async)
2347{ 2057{
2348 Evas_Func *func;
2349 Evas_Image_Data *o = eo_data_scope_get(eo_proxy, MY_CLASS); 2058 Evas_Image_Data *o = eo_data_scope_get(eo_proxy, MY_CLASS);
2059 Evas_Object_Protected_Data *proxy;
2060 Evas_Func *func;
2350 2061
2351 if (!o->proxyerror) printf("Err: Argh! Recursive proxies.\n"); 2062 if (!o->proxyerror)
2352 o->proxyerror = 1; 2063 {
2064 ERR("Using recursive proxies! Don't set a proxy's source as another proxy!");
2065 o->proxyerror = 1;
2066 }
2353 2067
2354 Evas_Object_Protected_Data *proxy = eo_data_scope_get(eo_proxy, EVAS_OBJECT_CLASS); 2068 proxy = eo_data_scope_get(eo_proxy, EVAS_OBJECT_CLASS);
2355 func = proxy->layer->evas->engine.func; 2069 func = proxy->layer->evas->engine.func;
2356 func->context_color_set(output, context, 0, 0, 0, 255); 2070 func->context_color_set(output, context, 0, 0, 0, 255);
2357 func->context_multiplier_unset(output, context); 2071 func->context_multiplier_unset(output, context);
@@ -2361,7 +2075,6 @@ _proxy_error(Evas_Object *eo_proxy, void *context, void *output, void *surface,
2361 proxy->cur->geometry.w, 2075 proxy->cur->geometry.w,
2362 proxy->cur->geometry.h, 2076 proxy->cur->geometry.h,
2363 do_async); 2077 do_async);
2364 return;
2365} 2078}
2366 2079
2367static void 2080static void
@@ -4622,26 +4335,6 @@ _evas_object_image_video_overlay_do(Evas_Object *eo_obj)
4622 o->delayed.video_hide = EINA_FALSE; 4335 o->delayed.video_hide = EINA_FALSE;
4623} 4336}
4624 4337
4625static void
4626_evas_image_snapshot_set(Eo *eo, Evas_Image_Data *pd EINA_UNUSED, Eina_Bool s)
4627{
4628 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo, EVAS_OBJECT_CLASS);
4629
4630 if (obj->cur->snapshot == s) return ;
4631
4632 EINA_COW_STATE_WRITE_BEGIN(obj, state_write, cur)
4633 state_write->snapshot = !!s;
4634 EINA_COW_STATE_WRITE_END(obj, state_write, cur);
4635}
4636
4637static Eina_Bool
4638_evas_image_snapshot_get(Eo *eo, Evas_Image_Data *pd EINA_UNUSED)
4639{
4640 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo, EVAS_OBJECT_CLASS);
4641
4642 return obj->cur->snapshot;
4643}
4644
4645void * 4338void *
4646_evas_object_image_surface_get(Evas_Object *eo, Evas_Object_Protected_Data *obj) 4339_evas_object_image_surface_get(Evas_Object *eo, Evas_Object_Protected_Data *obj)
4647{ 4340{
@@ -4966,14 +4659,16 @@ evas_object_image_add(Evas *eo_e)
4966{ 4659{
4967 EINA_SAFETY_ON_FALSE_RETURN_VAL(eo_isa(eo_e, EVAS_CANVAS_CLASS), NULL); 4660 EINA_SAFETY_ON_FALSE_RETURN_VAL(eo_isa(eo_e, EVAS_CANVAS_CLASS), NULL);
4968 return eo_add(EVAS_IMAGE_CLASS, eo_e, 4661 return eo_add(EVAS_IMAGE_CLASS, eo_e,
4969 efl_gfx_fill_filled_set(eoid, EINA_FALSE)); 4662 efl_gfx_fill_filled_set(eoid, EINA_FALSE),
4663 evas_obj_legacy_ctor(eoid));
4970} 4664}
4971 4665
4972EAPI Evas_Object * 4666EAPI Evas_Object *
4973evas_object_image_filled_add(Evas *eo_e) 4667evas_object_image_filled_add(Evas *eo_e)
4974{ 4668{
4975 EINA_SAFETY_ON_FALSE_RETURN_VAL(eo_isa(eo_e, EVAS_CANVAS_CLASS), NULL); 4669 EINA_SAFETY_ON_FALSE_RETURN_VAL(eo_isa(eo_e, EVAS_CANVAS_CLASS), NULL);
4976 return eo_add(EVAS_IMAGE_CLASS, eo_e); 4670 return eo_add(EVAS_IMAGE_CLASS, eo_e,
4671 evas_obj_legacy_ctor(eoid));
4977} 4672}
4978 4673
4979EAPI void 4674EAPI void
@@ -5261,6 +4956,131 @@ evas_object_image_orient_get(const Evas_Image *obj)
5261 return (Evas_Image_Orient) efl_image_orientation_get(obj); 4956 return (Evas_Image_Orient) efl_image_orientation_get(obj);
5262} 4957}
5263 4958
4959EAPI void
4960evas_object_image_snapshot_set(Evas_Object *eo, Eina_Bool s)
4961{
4962 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo, EVAS_OBJECT_CLASS);
4963
4964 EVAS_OBJECT_LEGACY_API(eo);
4965 if (obj->cur->snapshot == s) return;
4966
4967 EINA_COW_STATE_WRITE_BEGIN(obj, state_write, cur)
4968 state_write->snapshot = !!s;
4969 EINA_COW_STATE_WRITE_END(obj, state_write, cur);
4970}
4971
4972EAPI Eina_Bool
4973evas_object_image_snapshot_get(const Evas_Object *eo)
4974{
4975 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo, EVAS_OBJECT_CLASS);
4976 EVAS_OBJECT_LEGACY_API(eo, EINA_FALSE);
4977 return obj->cur->snapshot;
4978}
4979
4980EAPI Eina_Bool
4981evas_object_image_source_set(Evas_Object *eo, Evas_Object *src)
4982{
4983 EVAS_OBJECT_LEGACY_API(eo, EINA_FALSE);
4984 return efl_canvas_proxy_source_set(eo, src);
4985}
4986
4987EAPI Evas_Object *
4988evas_object_image_source_get(const Evas_Object *eo)
4989{
4990 EVAS_OBJECT_LEGACY_API(eo, NULL);
4991 return efl_canvas_proxy_source_get(eo);
4992}
4993
4994EAPI void
4995evas_object_image_source_clip_set(Evas_Object *eo, Eina_Bool source_clip)
4996{
4997 EVAS_OBJECT_LEGACY_API(eo);
4998 efl_canvas_proxy_source_clip_set(eo, source_clip);
4999}
5000
5001EAPI Eina_Bool
5002evas_object_image_source_clip_get(const Evas_Object *eo)
5003{
5004 EVAS_OBJECT_LEGACY_API(eo, EINA_FALSE);
5005 return efl_canvas_proxy_source_clip_get(eo);
5006}
5007
5008EAPI void
5009evas_object_image_source_events_set(Evas_Object *eo, Eina_Bool repeat)
5010{
5011 EVAS_OBJECT_LEGACY_API(eo);
5012 efl_canvas_proxy_source_events_set(eo, repeat);
5013}
5014
5015EAPI Eina_Bool
5016evas_object_image_source_events_get(const Evas_Object *eo)
5017{
5018 EVAS_OBJECT_LEGACY_API(eo, EINA_FALSE);
5019 return efl_canvas_proxy_source_events_get(eo);
5020}
5021
5022EAPI void
5023evas_object_image_source_visible_set(Evas_Object *eo, Eina_Bool visible)
5024{
5025 /* FIXME: I'd love to remove this feature and replace by no_render.
5026 * But they are not 100% equivalent: if all proxies are removed, then the
5027 * source becomes visible again. This has some advantages for some apps but
5028 * it's complete hell to handle in evas render side.
5029 * -- jpeg, 2016/03/07
5030 */
5031
5032 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo, EVAS_OBJECT_CLASS);
5033 Evas_Object_Protected_Data *src_obj;
5034 Evas_Image_Data *o;
5035
5036 EVAS_OBJECT_LEGACY_API(eo);
5037
5038 o = eo_data_scope_get(eo, MY_CLASS);
5039 if (!o->cur->source) return;
5040
5041 visible = !!visible;
5042 src_obj = eo_data_scope_get(o->cur->source, EVAS_OBJECT_CLASS);
5043 if (src_obj->proxy->src_invisible == !visible) return;
5044
5045 evas_object_async_block(obj);
5046 EINA_COW_WRITE_BEGIN(evas_object_proxy_cow, src_obj->proxy, Evas_Object_Proxy_Data, proxy_write)
5047 proxy_write->src_invisible = !visible;
5048 EINA_COW_WRITE_END(evas_object_proxy_cow, src_obj->proxy, proxy_write);
5049
5050 src_obj->changed_src_visible = EINA_TRUE;
5051 evas_object_smart_member_cache_invalidate(o->cur->source, EINA_FALSE,
5052 EINA_FALSE, EINA_TRUE);
5053 evas_object_change(o->cur->source, src_obj);
5054 if ((!visible) || (!src_obj->proxy->src_events)) return;
5055 //FIXME: Feed mouse events here.
5056}
5057
5058EAPI Eina_Bool
5059evas_object_image_source_visible_get(const Evas_Object *eo)
5060{
5061 /* FIXME: see evas_object_image_source_visible_set */
5062
5063 Evas_Object_Protected_Data *src_obj;
5064 Evas_Image_Data *o;
5065 Eina_Bool visible;
5066
5067 EVAS_OBJECT_LEGACY_API(eo, EINA_FALSE);
5068
5069 o = eo_data_scope_get(eo, MY_CLASS);
5070 if (!o->cur->source) visible = EINA_FALSE;
5071 src_obj = eo_data_scope_get(o->cur->source, EVAS_OBJECT_CLASS);
5072 if (src_obj) visible = !src_obj->proxy->src_invisible;
5073 else visible = EINA_FALSE;
5074
5075 return visible;
5076}
5077
5078EAPI Eina_Bool
5079evas_object_image_source_unset(Evas_Object *eo_obj)
5080{
5081 return efl_canvas_proxy_source_set(eo_obj, NULL);
5082}
5083
5264#include "canvas/evas_image.eo.c" 5084#include "canvas/evas_image.eo.c"
5265 5085
5266/* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/ 5086/* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/
diff --git a/src/lib/evas/canvas/evas_object_main.c b/src/lib/evas/canvas/evas_object_main.c
index f18df1850d..26959bf362 100644
--- a/src/lib/evas/canvas/evas_object_main.c
+++ b/src/lib/evas/canvas/evas_object_main.c
@@ -2098,5 +2098,12 @@ _evas_object_paragraph_direction_get(Eo *eo_obj EINA_UNUSED, Evas_Object_Protect
2098 return EVAS_BIDI_DIRECTION_NEUTRAL; 2098 return EVAS_BIDI_DIRECTION_NEUTRAL;
2099} 2099}
2100 2100
2101EOLIAN static void
2102_evas_object_legacy_ctor(Eo *eo_obj, Evas_Object_Protected_Data *obj)
2103{
2104 EINA_SAFETY_ON_FALSE_RETURN(!eo_finalized_get(eo_obj));
2105 obj->legacy = EINA_TRUE;
2106}
2107
2101#include "canvas/evas_object.eo.c" 2108#include "canvas/evas_object.eo.c"
2102 2109
diff --git a/src/lib/evas/canvas/evas_render.c b/src/lib/evas/canvas/evas_render.c
index bc59739447..2eb3bffad6 100644
--- a/src/lib/evas/canvas/evas_render.c
+++ b/src/lib/evas/canvas/evas_render.c
@@ -1872,7 +1872,7 @@ evas_render_proxy_subrender(Evas *eo_e, Evas_Object *eo_source, Evas_Object *eo_
1872 ENFN->context_free(ENDT, ctx); 1872 ENFN->context_free(ENDT, ctx);
1873 1873
1874 if (eo_isa(eo_proxy, EVAS_IMAGE_CLASS)) 1874 if (eo_isa(eo_proxy, EVAS_IMAGE_CLASS))
1875 source_clip = evas_obj_image_source_clip_get(eo_proxy); 1875 source_clip = efl_canvas_proxy_source_clip_get(eo_proxy);
1876 1876
1877 Evas_Proxy_Render_Data proxy_render_data = { 1877 Evas_Proxy_Render_Data proxy_render_data = {
1878 .eo_proxy = eo_proxy, 1878 .eo_proxy = eo_proxy,
diff --git a/src/tests/edje/edje_test_edje.c b/src/tests/edje/edje_test_edje.c
index f8aea4a7b9..9772128c18 100644
--- a/src/tests/edje/edje_test_edje.c
+++ b/src/tests/edje/edje_test_edje.c
@@ -262,7 +262,7 @@ START_TEST(edje_test_snapshot)
262 262
263 /* check value of no_render flag as seen from evas land */ 263 /* check value of no_render flag as seen from evas land */
264 sub = edje_object_part_object_get(obj, "snap"); 264 sub = edje_object_part_object_get(obj, "snap");
265 fail_if(!evas_obj_image_snapshot_get(sub)); 265 fail_if(!eo_isa(sub, EFL_CANVAS_SNAPSHOT_CLASS));
266 266
267 // TODO: Verify that evas snapshot actually works (and has a filter) 267 // TODO: Verify that evas snapshot actually works (and has a filter)
268 268