jpeg pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=6b8228ffbde5bbe9b8c53a46ae226946ae7afb70

commit 6b8228ffbde5bbe9b8c53a46ae226946ae7afb70
Author: Jean-Philippe Andre <[email protected]>
Date:   Tue Jun 28 14:12:17 2016 +0900

    evas: Move map to a separate mixin
    
    Evas map is not translated to proper eo apis yet.
    Efl.Canvas.Map will be a mixin implementing the evas map
    API in a bindable API.
---
 src/Makefile_Evas.am                     |  1 +
 src/lib/edje/edje_calc.c                 | 12 ++--
 src/lib/ephysics/ephysics_body.cpp       |  8 +--
 src/lib/evas/Evas_Eo.h                   |  1 +
 src/lib/evas/Evas_Legacy.h               | 39 +++++++++++++
 src/lib/evas/canvas/efl_canvas_object.eo | 99 ++------------------------------
 src/lib/evas/canvas/efl_canvas_proxy.eo  |  2 +-
 src/lib/evas/canvas/efl_gfx_map.eo       | 41 +++++++++++++
 src/lib/evas/canvas/evas_map.c           | 20 +++++--
 src/lib/evas/canvas/evas_object_main.c   |  2 +-
 10 files changed, 112 insertions(+), 113 deletions(-)

diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am
index 70a7c70..0560f93 100644
--- a/src/Makefile_Evas.am
+++ b/src/Makefile_Evas.am
@@ -46,6 +46,7 @@ evas_eolian_pub_files = \
        lib/evas/canvas/efl_event_key.eo \
        lib/evas/canvas/efl_event_pointer.eo \
        lib/evas/canvas/efl_event_hold.eo \
+       lib/evas/canvas/efl_gfx_map.eo \
        $(NULL)
 
 evas_eolian_legacy_files = \
diff --git a/src/lib/edje/edje_calc.c b/src/lib/edje/edje_calc.c
index 2bf8204..c0df2fd 100644
--- a/src/lib/edje/edje_calc.c
+++ b/src/lib/edje/edje_calc.c
@@ -5015,8 +5015,8 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int 
flags, Edje_Calc_Params *sta
              else map_obj = mo;
              if (map_obj)
                {
-                  efl_canvas_object_map_set(map_obj, map);
-                  efl_canvas_object_map_enable_set(map_obj, EINA_TRUE);
+                  evas_object_map_set(map_obj, map);
+                  evas_object_map_enable_set(map_obj, EINA_TRUE);
                }
           }
         else
@@ -5027,8 +5027,8 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int 
flags, Edje_Calc_Params *sta
                {
                   if (ep->nested_smart) /* Cancel map of smart obj holding 
nested parts */
                     {
-                       efl_canvas_object_map_enable_set(ep->nested_smart, 
EINA_FALSE);
-                       efl_canvas_object_map_set(ep->nested_smart, NULL);
+                       evas_object_map_enable_set(ep->nested_smart, 
EINA_FALSE);
+                       evas_object_map_set(ep->nested_smart, NULL);
                     }
                   else
                     {
@@ -5038,8 +5038,8 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int 
flags, Edje_Calc_Params *sta
 #endif
                             if (mo)
                               {
-                                 efl_canvas_object_map_enable_set(mo, 0);
-                                 efl_canvas_object_map_set(mo, NULL);
+                                 evas_object_map_enable_set(mo, 0);
+                                 evas_object_map_set(mo, NULL);
                               }
 #ifdef HAVE_EPHYSICS
                          }
diff --git a/src/lib/ephysics/ephysics_body.cpp 
b/src/lib/ephysics/ephysics_body.cpp
index 98da084..7c4754b 100644
--- a/src/lib/ephysics/ephysics_body.cpp
+++ b/src/lib/ephysics/ephysics_body.cpp
@@ -1372,7 +1372,7 @@ _ephysics_body_del(EPhysics_Body *body)
 }
 
 static void
-_ephysics_body_efl_canvas_object_map_apply(EPhysics_Body *body, Evas_Map *map, 
Evas_Object *obj, Eina_Bool bfc, Eina_Bool update_cw)
+_ephysics_body_evas_object_map_apply(EPhysics_Body *body, Evas_Map *map, 
Evas_Object *obj, Eina_Bool bfc, Eina_Bool update_cw)
 {
    EPhysics_Camera *camera = ephysics_world_camera_get(body->world);
 
@@ -1504,7 +1504,7 @@ _ephysics_cylinder_face_objs_update(EPhysics_Body *body)
         evas_map_util_quat_rotate(map, quat.x(), -quat.y(), quat.z(), 
-quat.w(),
                                   bx, by, z);
 
-        _ephysics_body_efl_canvas_object_map_apply(body, map, obj, EINA_TRUE,
+        _ephysics_body_evas_object_map_apply(body, map, obj, EINA_TRUE,
                                           EINA_FALSE);
      }
 }
@@ -1624,7 +1624,7 @@ _ephysics_box_face_objs_update(EPhysics_Body *body)
 
         evas_map_util_quat_rotate(map, quat.x(), -quat.y(), quat.z(), 
-quat.w(),
                                   x, y, z);
-        _ephysics_body_efl_canvas_object_map_apply(body, map, obj, EINA_TRUE,
+        _ephysics_body_evas_object_map_apply(body, map, obj, EINA_TRUE,
                                           EINA_FALSE);
      }
 }
@@ -1680,7 +1680,7 @@ _ephysics_body_evas_object_update(EPhysics_Body *body, 
Evas_Object *evas_obj)
    evas_map_util_quat_rotate(map, quat.x(), -quat.y(), quat.z(), -quat.w(),
                              bx, by, z);
 
-   _ephysics_body_efl_canvas_object_map_apply(body, map, evas_obj,
+   _ephysics_body_evas_object_map_apply(body, map, evas_obj,
                                      body->back_face_culling, EINA_TRUE);
 }
 
diff --git a/src/lib/evas/Evas_Eo.h b/src/lib/evas/Evas_Eo.h
index 37db8fb..cd9e217 100644
--- a/src/lib/evas/Evas_Eo.h
+++ b/src/lib/evas/Evas_Eo.h
@@ -278,6 +278,7 @@ typedef void (Evas_Canvas3D_Surface_Func)(Evas_Real *out_x,
 #include "canvas/efl_canvas_image.eo.h"
 #include "canvas/efl_canvas_snapshot.eo.h"
 #include "canvas/efl_canvas_proxy.eo.h"
+#include "canvas/efl_gfx_map.eo.h"
 #endif /* EFL_EO_API_SUPPORT */
 
 #ifdef EFL_BETA_API_SUPPORT
diff --git a/src/lib/evas/Evas_Legacy.h b/src/lib/evas/Evas_Legacy.h
index 4e75bff..7c59c26 100644
--- a/src/lib/evas/Evas_Legacy.h
+++ b/src/lib/evas/Evas_Legacy.h
@@ -5718,3 +5718,42 @@ EAPI void evas_output_size_set(Evas *e, int w, int h);
 EAPI void evas_output_size_get(const Evas *e, int *w, int *h);
 
 #include "canvas/evas_out.eo.legacy.h"
+
+/**
+ * @brief Set current object transformation map.
+ *
+ * This sets the map on a given object. It is copied from the @c map pointer,
+ * so there is no need to keep the @c map object if you don't need it anymore.
+ *
+ * A map is a set of 4 points which have canvas x, y coordinates per point,
+ * with an optional z point value as a hint for perspective correction, if it
+ * is available. As well each point has u and v coordinates. These are like
+ * "texture coordinates" in OpenGL in that they define a point in the source
+ * image that is mapped to that map vertex/point. The u corresponds to the x
+ * coordinate of this mapped point and v, the y coordinate. Note that these
+ * coordinates describe a bounding region to sample.
+ *
+ * @note The map points a uv coordinates match the image geometry. If the
+ * @c map parameter is @c null, the stored map will be freed and geometry prior
+ * to enabling/setting a map will be restored.
+ *
+ * @param[in] map The map.
+ *
+ * @ingroup Efl_Canvas_Object
+ */
+EAPI void evas_object_map_set(Evas_Object *obj, const Evas_Map *map);
+
+/**
+ * @brief Get current object transformation map.
+ *
+ * This returns the current internal map set on the indicated object. It is
+ * intended for read-only access and is only valid as long as the object is not
+ * deleted or the map on the object is not changed.
+ *
+ * @return The map.
+ *
+ * @ingroup Efl_Canvas_Object
+ */
+EAPI const Evas_Map *evas_object_map_get(const Evas_Object *obj);
+
+#include "canvas/efl_gfx_map.eo.legacy.h"
diff --git a/src/lib/evas/canvas/efl_canvas_object.eo 
b/src/lib/evas/canvas/efl_canvas_object.eo
index d9b7955..90d3c34 100644
--- a/src/lib/evas/canvas/efl_canvas_object.eo
+++ b/src/lib/evas/canvas/efl_canvas_object.eo
@@ -2,7 +2,8 @@ import evas_types;
 import efl_text_types;
 
 abstract Efl.Canvas.Object (Eo.Base, Efl.Gfx, Efl.Gfx.Stack, Efl.Animator,
-                            Efl.Input.Interface, Efl.Gfx.Size.Hint)
+                            Efl.Input.Interface, Efl.Gfx.Size.Hint,
+                            Efl.Gfx.Map)
 {
    legacy_prefix: evas_object;
    data: Evas_Object_Protected_Data;
@@ -95,73 +96,6 @@ abstract Efl.Canvas.Object (Eo.Base, Efl.Gfx, Efl.Gfx.Stack, 
Efl.Animator,
                             or not ($false).]]
          }
       }
-      @property map {
-         set {
-            [[Set current object transformation map.
-
-              This sets the map on a given object. It is copied from the
-              $map pointer, so there is no need to keep the $map object if
-              you don't need it anymore.
-
-              A map is a set of 4 points which have canvas x, y coordinates
-              per point, with an optional z point value as a hint for
-              perspective correction, if it is available. As well each
-              point has u and v coordinates. These are like "texture
-              coordinates" in OpenGL in that they define a point in the
-              source image that is mapped to that map vertex/point. The u
-              corresponds to the x coordinate of this mapped point and v,
-              the y coordinate. Note that these coordinates describe a
-              bounding region to sample.
-
-              Note: The map points a uv coordinates match the image geometry.
-              If the $map parameter is $null, the stored map will be freed
-              and geometry prior to enabling/setting a map will be restored.
-            ]]
-            /* FIXME-doc
-              If you have a 200x100 source
-              image and want to display it at 200x100 with proper pixel
-              precision, then do:
-
-            @code
-            Evas_Map *m = evas_map_new(4);
-            evas_map_point_coord_set(m, 0,   0,   0, 0);
-            evas_map_point_coord_set(m, 1, 200,   0, 0);
-            evas_map_point_coord_set(m, 2, 200, 100, 0);
-            evas_map_point_coord_set(m, 3,   0, 100, 0);
-            evas_map_point_image_uv_set(m, 0,   0,   0);
-            evas_map_point_image_uv_set(m, 1, 200,   0);
-            evas_map_point_image_uv_set(m, 2, 200, 100);
-            evas_map_point_image_uv_set(m, 3,   0, 100);
-            evas_object_map_set(obj, m);
-            evas_map_free(m);
-            @endcode
-            */
-         }
-         get {
-            [[Get current object transformation map.
-
-              This returns the current internal map set on the indicated
-              object. It is intended for read-only access and is only
-              valid as long as the object is not deleted or the map on
-              the object is not changed. 
-            ]]
-            /* FIXME-doc
-              If you wish to modify the map
-              and set it back do the following:
-
-            @code
-            const Evas_Map *m = evas_object_map_get(obj);
-            Evas_Map *m2 = evas_map_dup(m);
-            evas_map_util_rotate(m2, 30.0, 0, 0);
-            evas_object_map_set(obj, m2);
-            evas_map_free(m2);
-            @endcode
-            */
-         }
-         values {
-            map: const(Evas.Map)*; [[The map.]]
-         }
-      }
       @property clip {
          set {
             [[Clip one object to another.
@@ -319,33 +253,6 @@ abstract Efl.Canvas.Object (Eo.Base, Efl.Gfx, 
Efl.Gfx.Stack, Efl.Animator,
             is_frame: bool;
          }
       }
-      @property map_enable {
-         set {
-            [[Enable or disable the map that is set.
-
-              Enable or disable the use of map for the object $obj. On
-              enable, the object geometry will be saved, and the new
-              geometry will change (position and size) to reflect the
-              map geometry set.
-
-              If the object doesn't have a map set (with
-              \@ref evas_object_map_set), the initial geometry will be
-              undefined. It is advised to always set a map to the object
-              first, and then call this function to enable its use.
-            ]]
-         }
-         get {
-            [[Get the map enabled state
-
-              This returns the currently enabled state of the map on the
-              object indicated. The default map enable state is off. You
-              can enable and disable it with @.map_enable.set.
-            ]]
-         }
-         values {
-            enabled: bool; [[Enabled state.]]
-         }
-      }
       @property precise_is_inside {
          set {
             [[Set whether to use precise (usually expensive) point collision
@@ -708,6 +615,8 @@ abstract Efl.Canvas.Object (Eo.Base, Efl.Gfx, 
Efl.Gfx.Stack, Efl.Animator,
       Efl.Gfx.Size.Hint.hint_request.get;
       Efl.Gfx.Size.Hint.hint_weight.set;
       Efl.Gfx.Size.Hint.hint_weight.get;
+      Efl.Gfx.Map.map_enable.set;
+      Efl.Gfx.Map.map_enable.get;
    }
    events {
        mouse,in @beta; [[Mouse In Event ]]
diff --git a/src/lib/evas/canvas/efl_canvas_proxy.eo 
b/src/lib/evas/canvas/efl_canvas_proxy.eo
index caae9e7..b8048fb 100644
--- a/src/lib/evas/canvas/efl_canvas_proxy.eo
+++ b/src/lib/evas/canvas/efl_canvas_proxy.eo
@@ -15,7 +15,7 @@ class Efl.Canvas.Proxy (Efl.Canvas.Image.Internal, 
Efl.Gfx.Buffer)
            source object in its drawing region, without affecting that
            source in any way. The source must be another valid 
@Efl.Canvas.Object.
            Other effects may be applied to the proxy, such as a map (see
-           @Efl.Canvas.Object.map) to create a reflection of the original 
object
+           @Efl.Gfx.Map) to create a reflection of the original object
            (for example).
 
            Any existing source object will be removed after this call.
diff --git a/src/lib/evas/canvas/efl_gfx_map.eo 
b/src/lib/evas/canvas/efl_gfx_map.eo
new file mode 100644
index 0000000..ea9e363
--- /dev/null
+++ b/src/lib/evas/canvas/efl_gfx_map.eo
@@ -0,0 +1,41 @@
+mixin Efl.Gfx.Map (Eo.Interface, Eo.Base)
+{
+   [[Texture UV mapping for all objects (rotation, perspective, 3d, ...).
+
+     Evas allows different transformations to be applied to all kinds of
+     objects. These are applied by means of UV mapping.
+
+     With UV mapping, one maps points in the source object to a 3D space
+     positioning at target. This allows rotation, perspective, scale and
+     lots of other effects, depending on the map that is used.
+
+     Each map point may carry a multiplier color. If properly
+     calculated, these can do shading effects on the object, producing
+     3D effects.
+   ]]
+   data: null;
+   methods {
+      @property map_enable @virtual_pure {
+         [[Whether map transformation is enabled on this object.
+
+           The default map enable state is off ($false).
+         ]]
+         set {
+            [[Enable or disable the use of map for this object. On
+              enable, the object geometry will be saved, and the new
+              geometry will change (position and size) to reflect the
+              map geometry set.
+            ]]
+            legacy: evas_object_map_enable_set;
+         }
+         get {
+            legacy: evas_object_map_enable_get;
+         }
+         values {
+            enabled: bool; [[Enabled state.]]
+         }
+      }
+   }
+   implements {
+   }
+}
diff --git a/src/lib/evas/canvas/evas_map.c b/src/lib/evas/canvas/evas_map.c
index 4873733..4f07bfb 100644
--- a/src/lib/evas/canvas/evas_map.c
+++ b/src/lib/evas/canvas/evas_map.c
@@ -464,8 +464,9 @@ _evas_object_map_parent_check(Evas_Object *eo_parent)
 }
 
 EOLIAN void
-_efl_canvas_object_map_enable_set(Eo *eo_obj, Evas_Object_Protected_Data *obj, 
Eina_Bool enabled)
+_efl_canvas_object_efl_gfx_map_map_enable_set(Eo *eo_obj, void *_pd 
EINA_UNUSED, Eina_Bool enabled)
 {
+   Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, 
EFL_CANVAS_OBJECT_CLASS);
    Eina_Bool pchange = EINA_FALSE;
 
    enabled = !!enabled;
@@ -533,14 +534,17 @@ _efl_canvas_object_map_enable_set(Eo *eo_obj, 
Evas_Object_Protected_Data *obj, E
 }
 
 EOLIAN Eina_Bool
-_efl_canvas_object_map_enable_get(Eo *eo_obj EINA_UNUSED, 
Evas_Object_Protected_Data *obj)
+_efl_canvas_object_efl_gfx_map_map_enable_get(Eo *eo_obj EINA_UNUSED, void 
*_pd EINA_UNUSED)
 {
+   Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, 
EFL_CANVAS_OBJECT_CLASS);
    return obj->map->cur.usemap;
 }
 
-EOLIAN void
-_efl_canvas_object_map_set(Eo *eo_obj, Evas_Object_Protected_Data *obj, const 
Evas_Map *map)
+EAPI void
+evas_object_map_set(Evas_Object *eo_obj, const Evas_Map *map)
 {
+   Evas_Object_Protected_Data *obj = EVAS_OBJ_GET_OR_RETURN(eo_obj);
+
    evas_object_async_block(obj);
    if ((!map) || (map->count < 4))
      {
@@ -630,9 +634,11 @@ _efl_canvas_object_map_set(Eo *eo_obj, 
Evas_Object_Protected_Data *obj, const Ev
    _evas_map_calc_map_geometry(eo_obj);
 }
 
-EOLIAN Evas_Map *
-_efl_canvas_object_map_get(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data 
*obj)
+EAPI const Evas_Map *
+evas_object_map_get(const Evas_Object *eo_obj)
 {
+   Evas_Object_Protected_Data *obj = EVAS_OBJ_GET_OR_RETURN((Eo *) eo_obj, 
NULL);
+
    evas_object_async_block(obj);
    return obj->map->cur.map;
 }
@@ -1358,3 +1364,5 @@ evas_map_object_move_diff_set(Evas_Map *m,
    m->move_sync.diff_x += diff_x;
    m->move_sync.diff_y += diff_y;
 }
+
+#include "canvas/efl_gfx_map.eo.c"
diff --git a/src/lib/evas/canvas/evas_object_main.c 
b/src/lib/evas/canvas/evas_object_main.c
index 6d26b77..0008a23 100644
--- a/src/lib/evas/canvas/evas_object_main.c
+++ b/src/lib/evas/canvas/evas_object_main.c
@@ -877,7 +877,7 @@ _efl_canvas_object_efl_gfx_position_set(Eo *eo_obj, 
Evas_Object_Protected_Data *
    if ((obj->cur->geometry.x == x) && (obj->cur->geometry.y == y)) return;
 
    Evas_Map *map;
-   map = (Evas_Map *) efl_canvas_object_map_get(eo_obj);
+   map = (Evas_Map *) evas_object_map_get(eo_obj);
    if (map && map->move_sync.enabled)
      {
         Evas_Coord diff_x = x - obj->cur->geometry.x;

-- 


Reply via email to