cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=0ff7429ea741ad651acf9cb6cc79b7529ab19b9d

commit 0ff7429ea741ad651acf9cb6cc79b7529ab19b9d
Author: Cedric BAIL <ced...@osg.samsung.com>
Date:   Mon Mar 14 14:59:33 2016 -0700

    evas: move Evas_Polygon to become Efl_Canvas_Polygon.
    
    TODO: add support for 2 points (aka line).
---
 src/Makefile_Evas.am                               |  2 +-
 src/lib/edje/edje_util.c                           |  2 +-
 src/lib/evas/Evas_Eo.h                             |  2 +-
 src/lib/evas/Evas_Legacy.h                         | 16 +++++-
 .../{evas_polygon.eo => efl_canvas_polygon.eo}     |  5 +-
 src/lib/evas/canvas/evas_object_polygon.c          | 66 ++++++++++++----------
 6 files changed, 57 insertions(+), 36 deletions(-)

diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am
index 09d5d51..e4fd440 100644
--- a/src/Makefile_Evas.am
+++ b/src/Makefile_Evas.am
@@ -4,7 +4,7 @@
 evas_eolian_pub_files = \
        lib/evas/canvas/evas_object.eo \
        lib/evas/canvas/evas_line.eo \
-       lib/evas/canvas/evas_polygon.eo \
+       lib/evas/canvas/efl_canvas_polygon.eo \
        lib/evas/canvas/evas_rectangle.eo \
        lib/evas/canvas/evas_text.eo \
        lib/evas/canvas/evas_textblock.eo \
diff --git a/src/lib/edje/edje_util.c b/src/lib/edje/edje_util.c
index d1add9b..d8a2371 100644
--- a/src/lib/edje/edje_util.c
+++ b/src/lib/edje/edje_util.c
@@ -6138,7 +6138,7 @@ _edje_real_part_swallow_hints_update(Edje_Real_Part *rp)
         rp->typedata.swallow->swallow_params.max.h = h;
      }
    else if (eo_isa(rp->typedata.swallow->swallowed_object, EVAS_TEXT_CLASS) ||
-            eo_isa(rp->typedata.swallow->swallowed_object, EVAS_POLYGON_CLASS) 
||
+            eo_isa(rp->typedata.swallow->swallowed_object, 
EFL_CANVAS_POLYGON_CLASS) ||
             eo_isa(rp->typedata.swallow->swallowed_object, EVAS_LINE_CLASS))
      {
         Evas_Coord w = 0, h = 0;
diff --git a/src/lib/evas/Evas_Eo.h b/src/lib/evas/Evas_Eo.h
index a56a5e7..29d1a95 100644
--- a/src/lib/evas/Evas_Eo.h
+++ b/src/lib/evas/Evas_Eo.h
@@ -74,7 +74,7 @@
  *
  * @{
  */
-#include "canvas/evas_polygon.eo.h"
+#include "canvas/efl_canvas_polygon.eo.h"
 /**
  * @}
  */
diff --git a/src/lib/evas/Evas_Legacy.h b/src/lib/evas/Evas_Legacy.h
index 6f2108f..91c9d73 100644
--- a/src/lib/evas/Evas_Legacy.h
+++ b/src/lib/evas/Evas_Legacy.h
@@ -3275,7 +3275,21 @@ EAPI Evas_Object *evas_object_line_add(Evas *e) 
EINA_WARN_UNUSED_RESULT EINA_ARG
  */
 EAPI Evas_Object *evas_object_polygon_add(Evas *e) EINA_WARN_UNUSED_RESULT 
EINA_ARG_NONNULL(1) EINA_MALLOC;
 
-#include "canvas/evas_polygon.eo.legacy.h"
+/**
+ * @brief Adds the given point to the given evas polygon object.
+ *
+ * @param[in] y The Y coordinate of the given point.
+ *
+ * @ingroup Evas_Polygon
+ */
+EAPI void evas_object_polygon_point_add(Evas_Object *obj, Evas_Coord x, 
Evas_Coord y);
+
+/** Removes all of the points from the given evas polygon object.
+ *
+ * @ingroup Evas_Polygon
+ */
+EAPI void evas_object_polygon_points_clear(Evas_Object *obj);
+
 /**
  * @}
  */
diff --git a/src/lib/evas/canvas/evas_polygon.eo 
b/src/lib/evas/canvas/efl_canvas_polygon.eo
similarity index 81%
rename from src/lib/evas/canvas/evas_polygon.eo
rename to src/lib/evas/canvas/efl_canvas_polygon.eo
index 4a7357a..38f5762 100644
--- a/src/lib/evas/canvas/evas_polygon.eo
+++ b/src/lib/evas/canvas/efl_canvas_polygon.eo
@@ -1,7 +1,6 @@
-class Evas.Polygon (Evas.Object)
+class Efl.Canvas.Polygon (Evas.Object)
 {
-   legacy_prefix: evas_object_polygon;
-   eo_prefix: evas_obj_polygon;
+   legacy_prefix: null;
    methods {
       point_add {
          [[Adds the given point to the given evas polygon object.]]
diff --git a/src/lib/evas/canvas/evas_object_polygon.c 
b/src/lib/evas/canvas/evas_object_polygon.c
index a154e37..d5cfe7a 100644
--- a/src/lib/evas/canvas/evas_object_polygon.c
+++ b/src/lib/evas/canvas/evas_object_polygon.c
@@ -1,16 +1,16 @@
 #include "evas_common_private.h"
 #include "evas_private.h"
 
-#define MY_CLASS EVAS_POLYGON_CLASS
+#define MY_CLASS EFL_CANVAS_POLYGON_CLASS
 
 /* private magic number for polygon objects */
 static const char o_type[] = "polygon";
 
 /* private struct for line object internal data */
-typedef struct _Evas_Polygon_Data      Evas_Polygon_Data;
-typedef struct _Evas_Polygon_Point       Evas_Polygon_Point;
+typedef struct _Efl_Canvas_Polygon_Data      Efl_Canvas_Polygon_Data;
+typedef struct _Efl_Canvas_Polygon_Point       Efl_Canvas_Polygon_Point;
 
-struct _Evas_Polygon_Data
+struct _Efl_Canvas_Polygon_Data
 {
    Eina_List           *points;
    void                *engine_data;
@@ -21,7 +21,7 @@ struct _Evas_Polygon_Data
    Eina_Bool            changed : 1;
 };
 
-struct _Evas_Polygon_Point
+struct _Efl_Canvas_Polygon_Point
 {
    Evas_Coord x, y;
 };
@@ -95,15 +95,11 @@ static const Evas_Object_Func object_func =
 EAPI Evas_Object *
 evas_object_polygon_add(Evas *e)
 {
-   MAGIC_CHECK(e, Evas, MAGIC_EVAS);
-   return NULL;
-   MAGIC_CHECK_END();
-   Evas_Object *eo_obj = eo_add(EVAS_POLYGON_CLASS, e);
-   return eo_obj;
+   return eo_add(MY_CLASS, e);
 }
 
 EOLIAN static Eo *
-_evas_polygon_eo_base_constructor(Eo *eo_obj, Evas_Polygon_Data *class_data 
EINA_UNUSED)
+_efl_canvas_polygon_eo_base_constructor(Eo *eo_obj, Efl_Canvas_Polygon_Data 
*class_data EINA_UNUSED)
 {
    eo_obj = eo_constructor(eo_super(eo_obj, MY_CLASS));
 
@@ -113,11 +109,11 @@ _evas_polygon_eo_base_constructor(Eo *eo_obj, 
Evas_Polygon_Data *class_data EINA
 }
 
 EOLIAN static void
-_evas_polygon_point_add(Eo *eo_obj, Evas_Polygon_Data *_pd, Evas_Coord x, 
Evas_Coord y)
+_efl_canvas_polygon_point_add(Eo *eo_obj, Efl_Canvas_Polygon_Data *_pd, 
Evas_Coord x, Evas_Coord y)
 {
    Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, 
EVAS_OBJECT_CLASS);
-   Evas_Polygon_Data *o = _pd;
-   Evas_Polygon_Point *p;
+   Efl_Canvas_Polygon_Data *o = _pd;
+   Efl_Canvas_Polygon_Point *p;
    Evas_Coord min_x, max_x, min_y, max_y;
    int is, was = 0;
 
@@ -149,7 +145,7 @@ _evas_polygon_point_add(Eo *eo_obj, Evas_Polygon_Data *_pd, 
Evas_Coord x, Evas_C
           }
      }
 
-   p = malloc(sizeof(Evas_Polygon_Point));
+   p = malloc(sizeof(Efl_Canvas_Polygon_Point));
    if (!p) return;
    p->x = x + o->offset.x;
    p->y = y + o->offset.y;
@@ -220,10 +216,10 @@ _evas_polygon_point_add(Eo *eo_obj, Evas_Polygon_Data 
*_pd, Evas_Coord x, Evas_C
 }
 
 EOLIAN static void
-_evas_polygon_points_clear(Eo *eo_obj, Evas_Polygon_Data *_pd)
+_efl_canvas_polygon_points_clear(Eo *eo_obj, Efl_Canvas_Polygon_Data *_pd)
 {
    Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, 
EVAS_OBJECT_CLASS);
-   Evas_Polygon_Data *o = _pd;
+   Efl_Canvas_Polygon_Data *o = _pd;
    void *list_data;
    int is, was;
 
@@ -275,7 +271,7 @@ evas_object_polygon_init(Evas_Object *eo_obj)
 }
 
 EOLIAN static void
-_evas_polygon_eo_base_destructor(Eo *eo_obj, Evas_Polygon_Data *_pd 
EINA_UNUSED)
+_efl_canvas_polygon_eo_base_destructor(Eo *eo_obj, Efl_Canvas_Polygon_Data 
*_pd EINA_UNUSED)
 {
    Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, 
EVAS_OBJECT_CLASS);
 
@@ -288,7 +284,7 @@ evas_object_polygon_free(Evas_Object *eo_obj EINA_UNUSED,
                          Evas_Object_Protected_Data *obj,
                          void *type_private_data)
 {
-   Evas_Polygon_Data *o = type_private_data;
+   Efl_Canvas_Polygon_Data *o = type_private_data;
    void *list_data;
    /* free obj */
    EINA_LIST_FREE(o->points, list_data)
@@ -306,9 +302,9 @@ evas_object_polygon_render(Evas_Object *eo_obj EINA_UNUSED,
                           void *type_private_data,
                           void *output, void *context, void *surface, int x, 
int y, Eina_Bool do_async)
 {
-   Evas_Polygon_Data *o = type_private_data;
+   Efl_Canvas_Polygon_Data *o = type_private_data;
    Eina_List *l;
-   Evas_Polygon_Point *p;
+   Efl_Canvas_Polygon_Point *p;
 
    /* render object to surface with context, and offxet by x,y */
    obj->layer->evas->engine.func->context_color_set(output,
@@ -351,7 +347,7 @@ evas_object_polygon_render_pre(Evas_Object *eo_obj,
                               Evas_Object_Protected_Data *obj,
                               void *type_private_data)
 {
-   Evas_Polygon_Data *o = type_private_data;
+   Efl_Canvas_Polygon_Data *o = type_private_data;
    int is_v, was_v;
 
    /* dont pre-render the obj twice! */
@@ -456,21 +452,21 @@ evas_object_polygon_render_post(Evas_Object *eo_obj,
 
 static unsigned int evas_object_polygon_id_get(Evas_Object *eo_obj)
 {
-   Evas_Polygon_Data *o = eo_data_scope_get(eo_obj, MY_CLASS);
+   Efl_Canvas_Polygon_Data *o = eo_data_scope_get(eo_obj, MY_CLASS);
    if (!o) return 0;
    return MAGIC_OBJ_POLYGON;
 }
 
 static unsigned int evas_object_polygon_visual_id_get(Evas_Object *eo_obj)
 {
-   Evas_Polygon_Data *o = eo_data_scope_get(eo_obj, MY_CLASS);
+   Efl_Canvas_Polygon_Data *o = eo_data_scope_get(eo_obj, MY_CLASS);
    if (!o) return 0;
    return MAGIC_OBJ_SHAPE;
 }
 
 static void *evas_object_polygon_engine_data_get(Evas_Object *eo_obj)
 {
-   Evas_Polygon_Data *o = eo_data_scope_get(eo_obj, MY_CLASS);
+   Efl_Canvas_Polygon_Data *o = eo_data_scope_get(eo_obj, MY_CLASS);
    return o->engine_data;
 }
 
@@ -503,10 +499,10 @@ evas_object_polygon_is_inside(Evas_Object *eo_obj 
EINA_UNUSED,
                              void *type_private_data,
                              Evas_Coord x, Evas_Coord y)
 {
-   Evas_Polygon_Data *o = type_private_data;
+   Efl_Canvas_Polygon_Data *o = type_private_data;
    int num_edges = 0; /* Number of edges we crossed */
    Eina_List *itr;
-   Evas_Polygon_Point *p;
+   Efl_Canvas_Polygon_Point *p;
 
    if (!o->points) return 0;
 
@@ -524,7 +520,7 @@ evas_object_polygon_is_inside(Evas_Object *eo_obj 
EINA_UNUSED,
      {
         Evas_Coord line_y;
         Eina_List *next = eina_list_next(itr);
-        Evas_Polygon_Point *p_next;
+        Efl_Canvas_Polygon_Point *p_next;
         /* Get the next, or if there's no next, take the first */
         if (next)
           {
@@ -565,4 +561,16 @@ evas_object_polygon_was_inside(Evas_Object *eo_obj 
EINA_UNUSED,
    return 1;
 }
 
-#include "canvas/evas_polygon.eo.c"
+EAPI void
+evas_object_polygon_point_add(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
+{
+   efl_canvas_polygon_point_add(obj, x, y);
+}
+
+EAPI void
+evas_object_polygon_points_clear(Evas_Object *obj)
+{
+   efl_canvas_polygon_points_clear(obj);
+}
+
+#include "canvas/efl_canvas_polygon.eo.c"

-- 


Reply via email to