forked from enlightenment/efl
evas: move Evas_Polygon to become Efl_Canvas_Polygon.
TODO: add support for 2 points (aka line).
This commit is contained in:
parent
e6a27e13b5
commit
0ff7429ea7
|
@ -4,7 +4,7 @@
|
||||||
evas_eolian_pub_files = \
|
evas_eolian_pub_files = \
|
||||||
lib/evas/canvas/evas_object.eo \
|
lib/evas/canvas/evas_object.eo \
|
||||||
lib/evas/canvas/evas_line.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_rectangle.eo \
|
||||||
lib/evas/canvas/evas_text.eo \
|
lib/evas/canvas/evas_text.eo \
|
||||||
lib/evas/canvas/evas_textblock.eo \
|
lib/evas/canvas/evas_textblock.eo \
|
||||||
|
|
|
@ -6138,7 +6138,7 @@ _edje_real_part_swallow_hints_update(Edje_Real_Part *rp)
|
||||||
rp->typedata.swallow->swallow_params.max.h = h;
|
rp->typedata.swallow->swallow_params.max.h = h;
|
||||||
}
|
}
|
||||||
else if (eo_isa(rp->typedata.swallow->swallowed_object, EVAS_TEXT_CLASS) ||
|
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))
|
eo_isa(rp->typedata.swallow->swallowed_object, EVAS_LINE_CLASS))
|
||||||
{
|
{
|
||||||
Evas_Coord w = 0, h = 0;
|
Evas_Coord w = 0, h = 0;
|
||||||
|
|
|
@ -74,7 +74,7 @@
|
||||||
*
|
*
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#include "canvas/evas_polygon.eo.h"
|
#include "canvas/efl_canvas_polygon.eo.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;
|
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);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
class Evas.Polygon (Evas.Object)
|
class Efl.Canvas.Polygon (Evas.Object)
|
||||||
{
|
{
|
||||||
legacy_prefix: evas_object_polygon;
|
legacy_prefix: null;
|
||||||
eo_prefix: evas_obj_polygon;
|
|
||||||
methods {
|
methods {
|
||||||
point_add {
|
point_add {
|
||||||
[[Adds the given point to the given evas polygon object.]]
|
[[Adds the given point to the given evas polygon object.]]
|
|
@ -1,16 +1,16 @@
|
||||||
#include "evas_common_private.h"
|
#include "evas_common_private.h"
|
||||||
#include "evas_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 */
|
/* private magic number for polygon objects */
|
||||||
static const char o_type[] = "polygon";
|
static const char o_type[] = "polygon";
|
||||||
|
|
||||||
/* private struct for line object internal data */
|
/* private struct for line object internal data */
|
||||||
typedef struct _Evas_Polygon_Data Evas_Polygon_Data;
|
typedef struct _Efl_Canvas_Polygon_Data Efl_Canvas_Polygon_Data;
|
||||||
typedef struct _Evas_Polygon_Point Evas_Polygon_Point;
|
typedef struct _Efl_Canvas_Polygon_Point Efl_Canvas_Polygon_Point;
|
||||||
|
|
||||||
struct _Evas_Polygon_Data
|
struct _Efl_Canvas_Polygon_Data
|
||||||
{
|
{
|
||||||
Eina_List *points;
|
Eina_List *points;
|
||||||
void *engine_data;
|
void *engine_data;
|
||||||
|
@ -21,7 +21,7 @@ struct _Evas_Polygon_Data
|
||||||
Eina_Bool changed : 1;
|
Eina_Bool changed : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _Evas_Polygon_Point
|
struct _Efl_Canvas_Polygon_Point
|
||||||
{
|
{
|
||||||
Evas_Coord x, y;
|
Evas_Coord x, y;
|
||||||
};
|
};
|
||||||
|
@ -95,15 +95,11 @@ static const Evas_Object_Func object_func =
|
||||||
EAPI Evas_Object *
|
EAPI Evas_Object *
|
||||||
evas_object_polygon_add(Evas *e)
|
evas_object_polygon_add(Evas *e)
|
||||||
{
|
{
|
||||||
MAGIC_CHECK(e, Evas, MAGIC_EVAS);
|
return eo_add(MY_CLASS, e);
|
||||||
return NULL;
|
|
||||||
MAGIC_CHECK_END();
|
|
||||||
Evas_Object *eo_obj = eo_add(EVAS_POLYGON_CLASS, e);
|
|
||||||
return eo_obj;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static Eo *
|
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));
|
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
|
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_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
||||||
Evas_Polygon_Data *o = _pd;
|
Efl_Canvas_Polygon_Data *o = _pd;
|
||||||
Evas_Polygon_Point *p;
|
Efl_Canvas_Polygon_Point *p;
|
||||||
Evas_Coord min_x, max_x, min_y, max_y;
|
Evas_Coord min_x, max_x, min_y, max_y;
|
||||||
int is, was = 0;
|
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;
|
if (!p) return;
|
||||||
p->x = x + o->offset.x;
|
p->x = x + o->offset.x;
|
||||||
p->y = y + o->offset.y;
|
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
|
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_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;
|
void *list_data;
|
||||||
int is, was;
|
int is, was;
|
||||||
|
|
||||||
|
@ -275,7 +271,7 @@ evas_object_polygon_init(Evas_Object *eo_obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
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);
|
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,
|
Evas_Object_Protected_Data *obj,
|
||||||
void *type_private_data)
|
void *type_private_data)
|
||||||
{
|
{
|
||||||
Evas_Polygon_Data *o = type_private_data;
|
Efl_Canvas_Polygon_Data *o = type_private_data;
|
||||||
void *list_data;
|
void *list_data;
|
||||||
/* free obj */
|
/* free obj */
|
||||||
EINA_LIST_FREE(o->points, list_data)
|
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 *type_private_data,
|
||||||
void *output, void *context, void *surface, int x, int y, Eina_Bool do_async)
|
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;
|
Eina_List *l;
|
||||||
Evas_Polygon_Point *p;
|
Efl_Canvas_Polygon_Point *p;
|
||||||
|
|
||||||
/* render object to surface with context, and offxet by x,y */
|
/* render object to surface with context, and offxet by x,y */
|
||||||
obj->layer->evas->engine.func->context_color_set(output,
|
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,
|
Evas_Object_Protected_Data *obj,
|
||||||
void *type_private_data)
|
void *type_private_data)
|
||||||
{
|
{
|
||||||
Evas_Polygon_Data *o = type_private_data;
|
Efl_Canvas_Polygon_Data *o = type_private_data;
|
||||||
int is_v, was_v;
|
int is_v, was_v;
|
||||||
|
|
||||||
/* dont pre-render the obj twice! */
|
/* 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)
|
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;
|
if (!o) return 0;
|
||||||
return MAGIC_OBJ_POLYGON;
|
return MAGIC_OBJ_POLYGON;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned int evas_object_polygon_visual_id_get(Evas_Object *eo_obj)
|
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;
|
if (!o) return 0;
|
||||||
return MAGIC_OBJ_SHAPE;
|
return MAGIC_OBJ_SHAPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *evas_object_polygon_engine_data_get(Evas_Object *eo_obj)
|
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;
|
return o->engine_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -503,10 +499,10 @@ evas_object_polygon_is_inside(Evas_Object *eo_obj EINA_UNUSED,
|
||||||
void *type_private_data,
|
void *type_private_data,
|
||||||
Evas_Coord x, Evas_Coord y)
|
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 */
|
int num_edges = 0; /* Number of edges we crossed */
|
||||||
Eina_List *itr;
|
Eina_List *itr;
|
||||||
Evas_Polygon_Point *p;
|
Efl_Canvas_Polygon_Point *p;
|
||||||
|
|
||||||
if (!o->points) return 0;
|
if (!o->points) return 0;
|
||||||
|
|
||||||
|
@ -524,7 +520,7 @@ evas_object_polygon_is_inside(Evas_Object *eo_obj EINA_UNUSED,
|
||||||
{
|
{
|
||||||
Evas_Coord line_y;
|
Evas_Coord line_y;
|
||||||
Eina_List *next = eina_list_next(itr);
|
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 */
|
/* Get the next, or if there's no next, take the first */
|
||||||
if (next)
|
if (next)
|
||||||
{
|
{
|
||||||
|
@ -565,4 +561,16 @@ evas_object_polygon_was_inside(Evas_Object *eo_obj EINA_UNUSED,
|
||||||
return 1;
|
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"
|
||||||
|
|
Loading…
Reference in New Issue