jpeg pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=06cf9e6beacacbb5b878794a829f2f98052dc072

commit 06cf9e6beacacbb5b878794a829f2f98052dc072
Author: Jean-Philippe Andre <jp.an...@samsung.com>
Date:   Mon Mar 14 19:38:44 2016 +0900

    Evas.Image: Complete implementation of proxy and snapshot
    
    This moves the EO APIs away from Evas.Image and adds the required
    legacy bindings.
---
 src/lib/edje/edje_calc.c                |   4 +-
 src/lib/evas/Evas_Legacy.h              | 134 +++++++++
 src/lib/evas/canvas/evas_image.eo       | 129 ---------
 src/lib/evas/canvas/evas_object.eo      |   3 +
 src/lib/evas/canvas/evas_object_image.c | 464 ++++++++++----------------------
 src/lib/evas/canvas/evas_object_main.c  |   7 +
 src/lib/evas/canvas/evas_render.c       |   2 +-
 src/tests/edje/edje_test_edje.c         |   2 +-
 8 files changed, 290 insertions(+), 455 deletions(-)

diff --git a/src/lib/edje/edje_calc.c b/src/lib/edje/edje_calc.c
index 8b19443..2a2ada6 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
 
    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);
    efl_image_smooth_scale_set(ep->object, p3->smooth);
-   evas_obj_image_source_visible_set(ep->object, 
chosen_desc->proxy.source_visible);
-   evas_obj_image_source_clip_set(ep->object, chosen_desc->proxy.source_clip);
+   evas_object_image_source_visible_set(ep->object, 
chosen_desc->proxy.source_visible);
+   efl_canvas_proxy_source_clip_set(ep->object, 
chosen_desc->proxy.source_clip);
 }
 
 static void
diff --git a/src/lib/evas/Evas_Legacy.h b/src/lib/evas/Evas_Legacy.h
index 73baa1a..f5b5e5c 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
  */
 EAPI void evas_object_image_data_update_add(Evas_Object *obj, int x, int y, 
int w, int h);
 
+/**
+ * @brief The content below the Evas_Object_Image will be rendered inside it
+ * and you can reuse it as a source for any kind of effect.
+ *
+ * @param[in] s Wether to put the content of the canvas below inside the
+ * Evas_Object_Image.
+ *
+ * @since 1.15
+ */
+EAPI void evas_object_image_snapshot_set(Evas_Object *obj, Eina_Bool s);
+
+/**
+ * @brief Determine wether the Evas_Object_Image replicate the content of the
+ * canvas below.
+ *
+ * @return Wether to put the content of the canvas below inside the
+ * Evas_Object_Image.
+ *
+ * @since 1.15
+ */
+EAPI Eina_Bool evas_object_image_snapshot_get(const Evas_Object *obj);
+
+/**
+ * @brief Set the source object on an image object to used as a proxy.
+ *
+ * If an image object is set to behave as a proxy, it will mirror the rendering
+ * contents of a given source object in its drawing region, without affecting
+ * that source in any way. The source must be another valid Evas object. Other
+ * effects may be applied to the proxy, such as a map (see @ref
+ * evas_object_map_set) to create a reflection of the original object (for
+ * example).
+ *
+ * Any existing source object on @c obj will be removed after this call.
+ * Setting @c src to @c null clears the proxy object (not in "proxy state"
+ * anymore).
+ *
+ * @warning You cannot set a proxy as another proxy's source.
+ *
+ * @param[in] src Source object to use for the proxy.
+ */
+EAPI Eina_Bool evas_object_image_source_set(Evas_Object *obj, Evas_Object 
*src);
+
+/**
+ * @brief Get the current source object of an image object.
+ *
+ * @return Source object to use for the proxy.
+ */
+EAPI Evas_Object *evas_object_image_source_get(const Evas_Object *obj);
+
+/**
+ * @brief Clip the proxy object with the source object's clipper.
+ *
+ * @param[in] source_clip Whether @c obj is clipped by the source clipper
+ * ($true) or not ($false).
+ *
+ * @since 1.8
+ */
+EAPI void evas_object_image_source_clip_set(Evas_Object *obj, Eina_Bool 
source_clip);
+
+/**
+ * @brief Determine whether an object is clipped by source object's clipper.
+ *
+ * @return Whether @c obj is clipped by the source clipper ($true) or not
+ * ($false).
+ *
+ * @since 1.8
+ */
+EAPI Eina_Bool evas_object_image_source_clip_get(const Evas_Object *obj);
+
+/**
+ * @brief Set whether an Evas object is to source events.
+ *
+ * Set whether an Evas object is to repeat events to source.
+ *
+ * If @c repeat is @c true, it will make events on @c obj to also be repeated
+ * for the source object (see @ref evas_object_image_source_set). Even the
+ * @c obj and source geometries are different, the event position will be
+ * transformed to the source object's space.
+ *
+ * If @c repeat is @c false, events occurring on @c obj will be processed only
+ * on it.
+ *
+ * @param[in] source Whether @c obj is to pass events ($true) or not ($false).
+ *
+ * @since 1.8
+ */
+EAPI void evas_object_image_source_events_set(Evas_Object *obj, Eina_Bool 
repeat);
+
+/**
+ * @brief Determine whether an object is set to source events.
+ *
+ * @return Whether @c obj is to pass events ($true) or not ($false).
+ *
+ * @since 1.8
+ */
+EAPI Eina_Bool evas_object_image_source_events_get(const Evas_Object *obj);
+
+/**
+ * @brief Set the source object to be visible or not.
+ *
+ * If @c visible is set to @c false, the source object of the proxy ($obj) will
+ * be invisible.
+ *
+ * This API works differently to @ref evas_object_show and @ref
+ * evas_object_hide. Once source object is hidden, the proxy object will be
+ * hidden as well. Actually in this case both objects are excluded from the
+ * Evas internal update circle.
+ *
+ * By this API, instead, one can toggle the visibility of a proxy's source
+ *  object remaining the proxy visibility untouched.
+ *
+ * @warning If the all of proxies are deleted, then the source visibility of
+ * the source object will be cancelled.
+ *
+ * @param[in] visible @c true is source object to be shown, @c false otherwise.
+ *
+ * @deprecated Please use evas_object_norender_get() on the source instead.
+ *
+ * @since 1.8
+ */
+EAPI void evas_object_image_source_visible_set(Evas_Object *obj, Eina_Bool 
visible);
+
+/**
+ * @brief Get the state of the source object visibility.
+ *
+ * @return @c true is source object to be shown, @c false otherwise.
+ *
+ * @deprecated Please use evas_object_norender_get() on the source instead.
+ *
+ * @since 1.8
+ */
+EAPI Eina_Bool evas_object_image_source_visible_get(const Evas_Object *obj);
+
+
 /*
  * Converts the raw image data of the given image object to the
  * specified colorspace.
diff --git a/src/lib/evas/canvas/evas_image.eo 
b/src/lib/evas/canvas/evas_image.eo
index 7ed0ac2..9edb29e 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
    legacy_prefix: evas_object_image;
    eo_prefix: evas_obj_image;
    methods {
-      /* PROXY stuff */
-      @property source_clip {
-         set {
-            [[Clip the proxy object with the source object's clipper.
-
-              @since 1.8
-            ]]
-         }
-         get {
-            [[Determine whether an object is clipped by source object's
-              clipper.
-
-              @since 1.8
-            ]]
-         }
-         values {
-            source_clip: bool; [[Whether $obj is clipped by the source
-                                clipper ($true) or not ($false).]]
-         }
-      }
-      @property source {
-         set {
-            [[Set the source object on an image object to used as a proxy.
-
-              If an image object is set to behave as a proxy, it will mirror
-              the rendering contents of a given source object in its drawing
-              region, without affecting that source in any way. The source
-              must be another valid Evas object. Other effects may be
-              applied to the proxy, such as a map (see
-              \@ref evas_object_map_set) to create a reflection of the
-              original object (for example).
-
-              Any existing source object on $obj will be removed after this
-              call. Setting $src to $null clears the proxy object (not in
-              "proxy state" anymore).
-
-              Warning: You cannot set a proxy as another proxy's source.
-            ]]
-            return: bool;
-         }
-         get {
-            [[Get the current source object of an image object.]]
-         }
-         values {
-            src: Evas.Object *; [[Source object to use for the proxy.]]
-         }
-      }
-      @property source_visible {
-         set {
-            [[Set the source object to be visible or not.
-
-              If $visible is set to $false, the source object of the
-              proxy ($obj) will be invisible.
-
-              This API works differently to \@ref evas_object_show and
-              \@ref evas_object_hide. Once source object is hidden, the
-              proxy object will be hidden as well. Actually in this case
-              both objects are excluded from the Evas internal update circle.
-
-              By this API, instead, one can toggle the visibility of a
-              proxy's source  object remaining the proxy visibility untouched.
-
-              Warning: If the all of proxies are deleted, then the source
-              visibility of the source object will be cancelled.
-
-              @since 1.8
-            ]]
-         }
-         get {
-            [[Get the state of the source object visibility.
-
-              @since 1.8
-            ]]
-         }
-         values {
-            visible: bool; [[$true is source object to be shown, $false
-                             otherwise.]]
-         }
-      }
-      @property source_events {
-         set {
-            [[Set whether an Evas object is to source events.
-
-              Set whether an Evas object is to repeat events to source.
-
-              If $source is $true, it will make events on $obj to also be
-              repeated for the source object (see @.source.set). Even the
-              $obj and source geometries are different, the event position
-              will be transformed to the source object's space.
-
-              If $source is $false, events occurring on $obj will be
-              processed only on it.
-
-              @since 1.8
-            ]]
-         }
-         get {
-            [[Determine whether an object is set to source events.
-
-              @since 1.8
-            ]]
-         }
-         values {
-            source: bool; [[Whether $obj is to pass events ($true) or not
-                            ($false).]]
-         }
-      }
-
       /* weird stuff - hints */
       @property content_hint {
          set {
@@ -274,27 +166,6 @@ class Evas.Image (Evas.Object, Efl.File, Efl.Image, 
Efl.Image_Load, Efl.Image_An
             scene: Evas.Canvas3D.Scene *; [[3D scene on an image object.]]
          }
       }
-      @property snapshot {
-         set {
-            [[The content below the Evas_Object_Image will be rendered
-              inside it and you can reuse it as a source for any kind
-              of effect.
-
-              @since 1.15
-            ]]
-         }
-         get {
-            [[Determine wether the Evas_Object_Image replicate the content
-              of the canvas below.
-
-              @since 1.15
-            ]]
-         }
-         values {
-            s: bool; [[Wether to put the content of the canvas below inside
-                       the Evas_Object_Image.]]
-         }
-      }
    }
    implements {
       Eo.Base.constructor;
diff --git a/src/lib/evas/canvas/evas_object.eo 
b/src/lib/evas/canvas/evas_object.eo
index 394031a..628580f 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
    eo_prefix: evas_obj;
    data: Evas_Object_Protected_Data;
    methods {
+      legacy_ctor @protected {
+          [[Internal function. Do not use.]]
+      }
       @property size_hint_max {
          set {
             [[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 2bd78aa..ffb883a 100644
--- a/src/lib/evas/canvas/evas_object_image.c
+++ b/src/lib/evas/canvas/evas_object_image.c
@@ -1,31 +1,8 @@
-#define EVAS_FILTER_PROTECTED
-
-#include "evas_common_private.h"
-
-#include <sys/types.h>
-#include <unistd.h>
-#ifdef HAVE_SYS_MMAN_H
-# include <sys/mman.h>
-#endif
-#include <math.h>
-
-#include "evas_private.h"
-#ifdef EVAS_CSERVE2
-#include "../cserve2/evas_cs2_private.h"
-#endif
-#include "../common/evas_convert_color.h"
-#include "../common/evas_convert_colorspace.h"
-#include "../common/evas_convert_yuv.h"
-
-#include "evas_filter.eo.h"
-#include "evas_filter.h"
+#include "evas_image_private.h"
 
 #define MY_CLASS EVAS_IMAGE_CLASS
-
 #define MY_CLASS_NAME "Evas_Image"
 
-#define VERBOSE_PROXY_ERROR 1
-
 /* save typing */
 #define ENFN obj->layer->evas->engine.func
 #define ENDT obj->layer->evas->engine.data.output
@@ -35,114 +12,6 @@ static const char o_type[] = "image";
 
 const char *o_image_type = o_type;
 
-/* private struct for rectangle object internal data */
-typedef struct _Evas_Object_Image Evas_Image_Data;
-typedef struct _Evas_Object_Image_Load_Opts Evas_Object_Image_Load_Opts;
-typedef struct _Evas_Object_Image_Pixels Evas_Object_Image_Pixels;
-typedef struct _Evas_Object_Image_State Evas_Object_Image_State;
-
-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;
-};
-
-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;
-   unsigned int video_caps;
-};
-
-struct _Evas_Object_Image_State
-{
-   Evas_Coord_Rectangle fill;
-   struct {
-      short         w, h, stride;
-   } image;
-   struct {
-      double        scale;
-      short         l, r, t, b;
-      unsigned char fill;
-   } border;
-
-   Evas_Object   *source;
-   Evas_Map      *defmap;
-   Evas_Canvas3D_Scene *scene;
-
-   union {
-      const char    *file;
-      Eina_File     *f;
-   } u;
-   const char    *key;
-   int            frame;
-
-   Evas_Colorspace    cspace;
-   Evas_Image_Orient  orient;
-
-   Eina_Bool      smooth_scale : 1;
-   Eina_Bool      has_alpha :1;
-   Eina_Bool      opaque_valid : 1;
-   Eina_Bool      opaque : 1;
-   Eina_Bool      mmaped_source : 1;
-};
-
-struct _Evas_Object_Image
-{
-   const Evas_Object_Image_State *cur;
-   const Evas_Object_Image_State *prev;
-
-   // This pointer is an Eina_Cow pointer
-   const Evas_Object_Image_Load_Opts *load_opts;
-   const Evas_Object_Image_Pixels *pixels;
-
-   void             *engine_data;
-
-   int               pixels_checked_out;
-   int               load_error;
-
-   Evas_Image_Scale_Hint   scale_hint;
-   Evas_Image_Content_Hint content_hint;
-
-   Eina_Bool         changed : 1;
-   Eina_Bool         dirty_pixels : 1;
-   Eina_Bool         filled : 1;
-   Eina_Bool         filled_set : 1;
-   Eina_Bool         proxyrendering : 1;
-   Eina_Bool         preloading : 1;
-   Eina_Bool         video_surface : 1;
-   Eina_Bool         video_visible : 1;
-   Eina_Bool         created : 1;
-   Eina_Bool         proxyerror : 1;
-   Eina_Bool         proxy_src_clip : 1;
-   Eina_Bool         written : 1;
-   Eina_Bool         direct_render : 1;
-   Eina_Bool         has_filter : 1;
-   struct
-   {
-      Eina_Bool      video_move : 1;
-      Eina_Bool      video_resize : 1;
-      Eina_Bool      video_show : 1;
-      Eina_Bool      video_hide : 1;
-   } delayed;
-};
-
 /* private methods for image objects */
 static void evas_object_image_unload(Evas_Object *eo_obj, Eina_Bool dirty);
 static 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);
 static void *evas_object_image_data_convert_internal(Evas_Image_Data *o, void 
*data, Evas_Colorspace to_cspace);
 static void evas_object_image_filled_resize_listener(void *data, Evas *eo_e, 
Evas_Object *eo_obj, void *einfo);
 
-static void _proxy_unset(Evas_Object *proxy, Evas_Object_Protected_Data *obj, 
Evas_Image_Data *o);
-static void _proxy_set(Evas_Object *proxy, Evas_Object *src);
-static void _proxy_error(Evas_Object *proxy, void *context, void *output, void 
*surface, int x, int y, Eina_Bool do_async);
-
 static void _3d_render(Evas *eo_e, Evas_Object *eo_obj, 
Evas_Object_Protected_Data *obj, Evas_Image_Data *o, Evas_Canvas3D_Scene 
*scene);
 static void _3d_set(Evas_Object *eo_obj, Evas_Canvas3D_Scene *scene);
 static 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;
 # 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)
 
@@ -288,7 +152,7 @@ Eina_Cow *evas_object_image_state_cow = NULL;
        EINA_COW_IMAGE_STATE_WRITE_END(Obj, cur_write);                  \
     }
 
-static void
+void
 _evas_object_image_cleanup(Evas_Object *eo_obj, Evas_Object_Protected_Data 
*obj, Evas_Image_Data *o)
 {
    /* 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
    if (key) *key = o->cur->key;
 }
 
-EOLIAN static Eina_Bool
-_evas_image_source_set(Eo *eo_obj, Evas_Image_Data *o, Evas_Object *eo_src)
-{
-   Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, 
EVAS_OBJECT_CLASS);
-
-   if (obj->delete_me && eo_src)
-     {
-        WRN("Setting deleted object %p as image source %p", eo_src, eo_obj);
-        return EINA_FALSE;
-     }
-   if (eo_src)
-     {
-        Evas_Object_Protected_Data *src = eo_data_scope_get(eo_src, 
EVAS_OBJECT_CLASS);
-        if (src->delete_me)
-          {
-             WRN("Setting object %p to deleted image source %p", eo_src, 
eo_obj);
-             return EINA_FALSE;
-          }
-        if (!src->layer)
-          {
-             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);
-             return EINA_FALSE;
-          }
-        if ((obj->layer && src->layer) &&
-            (obj->layer->evas != src->layer->evas))
-          {
-             CRI("Setting object %p from Evas (%p) from another Evas (%p)", 
eo_src, src->layer->evas, obj->layer->evas);
-             return EINA_FALSE;
-          }
-        if (eo_src == eo_obj)
-          {
-             CRI("Setting object %p as a source for itself", obj);
-             return EINA_FALSE;
-          }
-     }
-   if (o->cur->source == eo_src) return EINA_TRUE;
-   evas_object_async_block(obj);
-   _evas_object_image_cleanup(eo_obj, obj, o);
-   /* Kill the image if any */
-   if (o->cur->u.file || o->cur->key)
-      evas_object_image_file_set(eo_obj, NULL, NULL);
-
-   if (eo_src) _proxy_set(eo_obj, eo_src);
-   else _proxy_unset(eo_obj, obj, o);
-
-   return EINA_TRUE;
-}
-
-EOLIAN static Evas_Object*
-_evas_image_source_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o)
-{
-   return o->cur->source;
-}
-
 EOLIAN static void
 _evas_image_efl_image_orientation_set(Eo *eo_obj, Evas_Image_Data *o, 
Efl_Gfx_Orientation _orient)
 {
@@ -716,60 +521,6 @@ _evas_image_efl_image_orientation_get(Eo *eo_obj 
EINA_UNUSED, Evas_Image_Data *o
    return (Efl_Gfx_Orientation) o->cur->orient;
 }
 
-EAPI Eina_Bool
-evas_object_image_source_unset(Evas_Object *eo_obj)
-{
-   Eina_Bool result = EINA_FALSE;
-   result = evas_obj_image_source_set(eo_obj, NULL);
-   return result;
-}
-
-EOLIAN static void
-_evas_image_source_clip_set(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o, 
Eina_Bool source_clip)
-{
-   Evas_Object_Protected_Data *src_obj;
-   Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, 
EVAS_OBJECT_CLASS);
-
-   source_clip = !!source_clip;
-   if (o->proxy_src_clip == source_clip) return;
-   evas_object_async_block(obj);
-   o->proxy_src_clip = source_clip;
-
-   if (!o->cur->source) return;
-
-   src_obj = eo_data_scope_get(o->cur->source, EVAS_OBJECT_CLASS);
-   evas_object_change(o->cur->source, src_obj);
-}
-
-EOLIAN static Eina_Bool
-_evas_image_source_clip_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o)
-{
-   return o->proxy_src_clip;
-}
-
-EOLIAN static void
-_evas_image_source_events_set(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o, 
Eina_Bool source_events)
-{
-   Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, 
EVAS_OBJECT_CLASS);
-
-   source_events = !!source_events;
-   if (obj->proxy->src_events == source_events) return;
-
-   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);
-
-   if (!o->cur->source) return;
-   if ((obj->proxy->src_invisible) || (!source_events)) return;
-   //FIXME: Feed mouse events here.
-}
-
-EOLIAN static Eina_Bool
-_evas_image_source_events_get(Eo *eo_obj, Evas_Image_Data *_pd EINA_UNUSED)
-{
-   Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, 
EVAS_OBJECT_CLASS);
-   return obj->proxy->src_events;
-}
 
 EOLIAN static void
 _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
 }
 
 EOLIAN static void
-_evas_image_source_visible_set(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o, 
Eina_Bool visible)
-{
-   Evas_Object_Protected_Data *src_obj;
-   Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, 
EVAS_OBJECT_CLASS);
-
-   if (!o->cur->source) return;
-
-   visible = !!visible;
-   src_obj = eo_data_scope_get(o->cur->source, EVAS_OBJECT_CLASS);
-   if (src_obj->proxy->src_invisible == !visible) return;
-
-   evas_object_async_block(obj);
-   EINA_COW_WRITE_BEGIN(evas_object_proxy_cow, src_obj->proxy, 
Evas_Object_Proxy_Data, proxy_write)
-     proxy_write->src_invisible = !visible;
-   EINA_COW_WRITE_END(evas_object_proxy_cow, src_obj->proxy, proxy_write);
-
-   src_obj->changed_src_visible = EINA_TRUE;
-   evas_object_smart_member_cache_invalidate(o->cur->source, EINA_FALSE,
-                                             EINA_FALSE, EINA_TRUE);
-   evas_object_change(o->cur->source, src_obj);
-   if ((!visible) || (!src_obj->proxy->src_events)) return;
-   //FIXME: Feed mouse events here.
-}
-
-EOLIAN static Eina_Bool
-_evas_image_source_visible_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o)
-{
-   Evas_Object_Protected_Data *src_obj;
-   Eina_Bool visible;
-
-   if (!o->cur->source) visible = EINA_FALSE;
-   src_obj = eo_data_scope_get(o->cur->source, EVAS_OBJECT_CLASS);
-   if (src_obj) visible = !src_obj->proxy->src_invisible;
-   else visible = EINA_FALSE;
-
-   return visible;
-}
-
-
-EOLIAN static void
 _evas_image_scene_set(Eo *eo_obj, Evas_Image_Data *o, Evas_Canvas3D_Scene 
*scene)
 {
    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 *
    return EINA_TRUE;
 }
 
-/* all nice and private */
-static void
+void
 _proxy_unset(Evas_Object *proxy, Evas_Object_Protected_Data *cur_proxy, 
Evas_Image_Data *o)
 {
    Evas_Object_Protected_Data *cur_source;
@@ -2309,7 +2019,7 @@ _proxy_unset(Evas_Object *proxy, 
Evas_Object_Protected_Data *cur_proxy, Evas_Ima
    EINA_COW_WRITE_END(evas_object_proxy_cow, cur_proxy->proxy, proxy_write);
 }
 
-static void
+void
 _proxy_set(Evas_Object *eo_proxy, Evas_Object *eo_src)
 {
    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)
 /* Some moron just set a proxy on a proxy.
  * Give them some pixels.  A random color
  */
-static void
+void
 _proxy_error(Evas_Object *eo_proxy, void *context, void *output, void *surface,
              int x, int y, Eina_Bool do_async)
 {
-   Evas_Func *func;
    Evas_Image_Data *o = eo_data_scope_get(eo_proxy, MY_CLASS);
+   Evas_Object_Protected_Data *proxy;
+   Evas_Func *func;
 
-   if (!o->proxyerror) printf("Err: Argh! Recursive proxies.\n");
-   o->proxyerror = 1;
+   if (!o->proxyerror)
+     {
+        ERR("Using recursive proxies! Don't set a proxy's source as another 
proxy!");
+        o->proxyerror = 1;
+     }
 
-   Evas_Object_Protected_Data *proxy = eo_data_scope_get(eo_proxy, 
EVAS_OBJECT_CLASS);
+   proxy = eo_data_scope_get(eo_proxy, EVAS_OBJECT_CLASS);
    func = proxy->layer->evas->engine.func;
    func->context_color_set(output, context, 0, 0, 0, 255);
    func->context_multiplier_unset(output, context);
@@ -2361,7 +2075,6 @@ _proxy_error(Evas_Object *eo_proxy, void *context, void 
*output, void *surface,
                         proxy->cur->geometry.w,
                         proxy->cur->geometry.h,
                         do_async);
-   return;
 }
 
 static void
@@ -4622,26 +4335,6 @@ _evas_object_image_video_overlay_do(Evas_Object *eo_obj)
    o->delayed.video_hide = EINA_FALSE;
 }
 
-static void
-_evas_image_snapshot_set(Eo *eo, Evas_Image_Data *pd EINA_UNUSED, Eina_Bool s)
-{
-   Evas_Object_Protected_Data *obj = eo_data_scope_get(eo, EVAS_OBJECT_CLASS);
-
-   if (obj->cur->snapshot == s) return ;
-
-   EINA_COW_STATE_WRITE_BEGIN(obj, state_write, cur)
-     state_write->snapshot = !!s;
-   EINA_COW_STATE_WRITE_END(obj, state_write, cur);
-}
-
-static Eina_Bool
-_evas_image_snapshot_get(Eo *eo, Evas_Image_Data *pd EINA_UNUSED)
-{
-   Evas_Object_Protected_Data *obj = eo_data_scope_get(eo, EVAS_OBJECT_CLASS);
-
-   return obj->cur->snapshot;
-}
-
 void *
 _evas_object_image_surface_get(Evas_Object *eo, Evas_Object_Protected_Data 
*obj)
 {
@@ -4966,14 +4659,16 @@ evas_object_image_add(Evas *eo_e)
 {
    EINA_SAFETY_ON_FALSE_RETURN_VAL(eo_isa(eo_e, EVAS_CANVAS_CLASS), NULL);
    return eo_add(EVAS_IMAGE_CLASS, eo_e,
-                 efl_gfx_fill_filled_set(eoid, EINA_FALSE));
+                 efl_gfx_fill_filled_set(eoid, EINA_FALSE),
+                 evas_obj_legacy_ctor(eoid));
 }
 
 EAPI Evas_Object *
 evas_object_image_filled_add(Evas *eo_e)
 {
    EINA_SAFETY_ON_FALSE_RETURN_VAL(eo_isa(eo_e, EVAS_CANVAS_CLASS), NULL);
-   return eo_add(EVAS_IMAGE_CLASS, eo_e);
+   return eo_add(EVAS_IMAGE_CLASS, eo_e,
+                 evas_obj_legacy_ctor(eoid));
 }
 
 EAPI void
@@ -5261,6 +4956,131 @@ evas_object_image_orient_get(const Evas_Image *obj)
    return (Evas_Image_Orient) efl_image_orientation_get(obj);
 }
 
+EAPI void
+evas_object_image_snapshot_set(Evas_Object *eo, Eina_Bool s)
+{
+   Evas_Object_Protected_Data *obj = eo_data_scope_get(eo, EVAS_OBJECT_CLASS);
+
+   EVAS_OBJECT_LEGACY_API(eo);
+   if (obj->cur->snapshot == s) return;
+
+   EINA_COW_STATE_WRITE_BEGIN(obj, state_write, cur)
+     state_write->snapshot = !!s;
+   EINA_COW_STATE_WRITE_END(obj, state_write, cur);
+}
+
+EAPI Eina_Bool
+evas_object_image_snapshot_get(const Evas_Object *eo)
+{
+   Evas_Object_Protected_Data *obj = eo_data_scope_get(eo, EVAS_OBJECT_CLASS);
+   EVAS_OBJECT_LEGACY_API(eo, EINA_FALSE);
+   return obj->cur->snapshot;
+}
+
+EAPI Eina_Bool
+evas_object_image_source_set(Evas_Object *eo, Evas_Object *src)
+{
+   EVAS_OBJECT_LEGACY_API(eo, EINA_FALSE);
+   return efl_canvas_proxy_source_set(eo, src);
+}
+
+EAPI Evas_Object *
+evas_object_image_source_get(const Evas_Object *eo)
+{
+   EVAS_OBJECT_LEGACY_API(eo, NULL);
+   return efl_canvas_proxy_source_get(eo);
+}
+
+EAPI void
+evas_object_image_source_clip_set(Evas_Object *eo, Eina_Bool source_clip)
+{
+   EVAS_OBJECT_LEGACY_API(eo);
+   efl_canvas_proxy_source_clip_set(eo, source_clip);
+}
+
+EAPI Eina_Bool
+evas_object_image_source_clip_get(const Evas_Object *eo)
+{
+   EVAS_OBJECT_LEGACY_API(eo, EINA_FALSE);
+   return efl_canvas_proxy_source_clip_get(eo);
+}
+
+EAPI void
+evas_object_image_source_events_set(Evas_Object *eo, Eina_Bool repeat)
+{
+   EVAS_OBJECT_LEGACY_API(eo);
+   efl_canvas_proxy_source_events_set(eo, repeat);
+}
+
+EAPI Eina_Bool
+evas_object_image_source_events_get(const Evas_Object *eo)
+{
+   EVAS_OBJECT_LEGACY_API(eo, EINA_FALSE);
+   return efl_canvas_proxy_source_events_get(eo);
+}
+
+EAPI void
+evas_object_image_source_visible_set(Evas_Object *eo, Eina_Bool visible)
+{
+   /* FIXME: I'd love to remove this feature and replace by no_render.
+    * But they are not 100% equivalent: if all proxies are removed, then the
+    * source becomes visible again. This has some advantages for some apps but
+    * it's complete hell to handle in evas render side.
+    * -- jpeg, 2016/03/07
+    */
+
+   Evas_Object_Protected_Data *obj = eo_data_scope_get(eo, EVAS_OBJECT_CLASS);
+   Evas_Object_Protected_Data *src_obj;
+   Evas_Image_Data *o;
+
+   EVAS_OBJECT_LEGACY_API(eo);
+
+   o = eo_data_scope_get(eo, MY_CLASS);
+   if (!o->cur->source) return;
+
+   visible = !!visible;
+   src_obj = eo_data_scope_get(o->cur->source, EVAS_OBJECT_CLASS);
+   if (src_obj->proxy->src_invisible == !visible) return;
+
+   evas_object_async_block(obj);
+   EINA_COW_WRITE_BEGIN(evas_object_proxy_cow, src_obj->proxy, 
Evas_Object_Proxy_Data, proxy_write)
+     proxy_write->src_invisible = !visible;
+   EINA_COW_WRITE_END(evas_object_proxy_cow, src_obj->proxy, proxy_write);
+
+   src_obj->changed_src_visible = EINA_TRUE;
+   evas_object_smart_member_cache_invalidate(o->cur->source, EINA_FALSE,
+                                             EINA_FALSE, EINA_TRUE);
+   evas_object_change(o->cur->source, src_obj);
+   if ((!visible) || (!src_obj->proxy->src_events)) return;
+   //FIXME: Feed mouse events here.
+}
+
+EAPI Eina_Bool
+evas_object_image_source_visible_get(const Evas_Object *eo)
+{
+   /* FIXME: see evas_object_image_source_visible_set */
+
+   Evas_Object_Protected_Data *src_obj;
+   Evas_Image_Data *o;
+   Eina_Bool visible;
+
+   EVAS_OBJECT_LEGACY_API(eo, EINA_FALSE);
+
+   o = eo_data_scope_get(eo, MY_CLASS);
+   if (!o->cur->source) visible = EINA_FALSE;
+   src_obj = eo_data_scope_get(o->cur->source, EVAS_OBJECT_CLASS);
+   if (src_obj) visible = !src_obj->proxy->src_invisible;
+   else visible = EINA_FALSE;
+
+   return visible;
+}
+
+EAPI Eina_Bool
+evas_object_image_source_unset(Evas_Object *eo_obj)
+{
+   return efl_canvas_proxy_source_set(eo_obj, NULL);
+}
+
 #include "canvas/evas_image.eo.c"
 
 /* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/
diff --git a/src/lib/evas/canvas/evas_object_main.c 
b/src/lib/evas/canvas/evas_object_main.c
index f18df18..26959bf 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
    return EVAS_BIDI_DIRECTION_NEUTRAL;
 }
 
+EOLIAN static void
+_evas_object_legacy_ctor(Eo *eo_obj, Evas_Object_Protected_Data *obj)
+{
+   EINA_SAFETY_ON_FALSE_RETURN(!eo_finalized_get(eo_obj));
+   obj->legacy = EINA_TRUE;
+}
+
 #include "canvas/evas_object.eo.c"
 
diff --git a/src/lib/evas/canvas/evas_render.c 
b/src/lib/evas/canvas/evas_render.c
index bc59739..2eb3bff 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_
         ENFN->context_free(ENDT, ctx);
 
         if (eo_isa(eo_proxy, EVAS_IMAGE_CLASS))
-          source_clip = evas_obj_image_source_clip_get(eo_proxy);
+          source_clip = efl_canvas_proxy_source_clip_get(eo_proxy);
 
         Evas_Proxy_Render_Data proxy_render_data = {
              .eo_proxy = eo_proxy,
diff --git a/src/tests/edje/edje_test_edje.c b/src/tests/edje/edje_test_edje.c
index f8aea4a..9772128 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)
 
    /* check value of no_render flag as seen from evas land */
    sub = edje_object_part_object_get(obj, "snap");
-   fail_if(!evas_obj_image_snapshot_get(sub));
+   fail_if(!eo_isa(sub, EFL_CANVAS_SNAPSHOT_CLASS));
 
    // TODO: Verify that evas snapshot actually works (and has a filter)
 

-- 


Reply via email to