aboutsummaryrefslogtreecommitdiffstats
path: root/legacy/evas/src/lib/canvas/evas_object_polygon.c
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2010-03-16 13:23:37 +0000
committerCedric BAIL <cedric.bail@free.fr>2010-03-16 13:23:37 +0000
commita859e60140ea130247ced25ca6e6022d2b429d3c (patch)
treefec7cc7516a8b828d1db86bf3582c5e88d5608fe /legacy/evas/src/lib/canvas/evas_object_polygon.c
parentonly send rend done if syncing. (diff)
downloadefl-a859e60140ea130247ced25ca6e6022d2b429d3c.tar.gz
* evas: Make evas_object_move on Evas_Object_Polygon work.
TODO: Make evas_object_resize work also. SVN revision: 47291
Diffstat (limited to 'legacy/evas/src/lib/canvas/evas_object_polygon.c')
-rw-r--r--legacy/evas/src/lib/canvas/evas_object_polygon.c75
1 files changed, 57 insertions, 18 deletions
diff --git a/legacy/evas/src/lib/canvas/evas_object_polygon.c b/legacy/evas/src/lib/canvas/evas_object_polygon.c
index 698316c2dc..e3eb7ff3c5 100644
--- a/legacy/evas/src/lib/canvas/evas_object_polygon.c
+++ b/legacy/evas/src/lib/canvas/evas_object_polygon.c
@@ -10,12 +10,18 @@ typedef struct _Evas_Polygon_Point Evas_Polygon_Point;
struct _Evas_Object_Polygon
{
- DATA32 magic;
- Eina_List *points;
+ DATA32 magic;
+ Eina_List *points;
- void *engine_data;
+ void *engine_data;
- char changed : 1;
+ struct {
+ int x, y;
+ } offset;
+
+ Evas_Coord_Rectangle geometry;
+
+ char changed : 1;
};
struct _Evas_Polygon_Point
@@ -114,6 +120,7 @@ evas_object_polygon_point_add(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
Evas_Polygon_Point *p;
Evas_Coord min_x, max_x, min_y, max_y;
int is, was = 0;
+ int off_x, off_y;
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
return;
@@ -129,10 +136,28 @@ evas_object_polygon_point_add(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1);
}
+
+ if (!o->points)
+ {
+ o->offset.x = obj->cur.geometry.x - obj->prev.geometry.x;
+ o->offset.y = obj->cur.geometry.y - obj->prev.geometry.y;
+ }
+ else
+ {
+ /* Update all points and take offset into account. */
+ Eina_List *over;
+
+ EINA_LIST_FOREACH(o->points, over, p)
+ {
+ p->x += o->offset.x;
+ p->y += o->offset.y;
+ }
+ }
+
p = malloc(sizeof(Evas_Polygon_Point));
if (!p) return;
- p->x = x;
- p->y = y;
+ p->x = x + o->offset.x;
+ p->y = y + o->offset.y;
if (!o->points)
{
@@ -158,6 +183,10 @@ evas_object_polygon_point_add(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
}
o->points = eina_list_append(o->points, p);
+ o->geometry = obj->cur.geometry;
+ o->offset.x = 0;
+ o->offset.y = 0;
+
//// obj->cur.cache.geometry.validity = 0;
o->changed = 1;
evas_object_change(obj);
@@ -307,24 +336,28 @@ evas_object_polygon_render(Evas_Object *obj, void *output, void *context, void *
context);
obj->layer->evas->engine.func->context_render_op_set(output, context,
obj->cur.render_op);
- o->engine_data = obj->layer->evas->engine.func->polygon_points_clear(obj->layer->evas->engine.data.output,
- obj->layer->evas->engine.data.context,
- o->engine_data);
- EINA_LIST_FOREACH(o->points, l, p)
+ if (o->changed)
{
- //int px, py;
- //px = evas_coord_world_x_to_screen(obj->layer->evas, p->x);
- //py = evas_coord_world_y_to_screen(obj->layer->evas, p->y);
- o->engine_data = obj->layer->evas->engine.func->polygon_point_add(obj->layer->evas->engine.data.output,
- obj->layer->evas->engine.data.context,
- o->engine_data,
- p->x + x, p->y + y);
+ o->engine_data = obj->layer->evas->engine.func->polygon_points_clear(obj->layer->evas->engine.data.output,
+ obj->layer->evas->engine.data.context,
+ o->engine_data);
+ EINA_LIST_FOREACH(o->points, l, p)
+ {
+ //px = evas_coord_world_x_to_screen(obj->layer->evas, p->x);
+ //py = evas_coord_world_y_to_screen(obj->layer->evas, p->y);
+ o->engine_data = obj->layer->evas->engine.func->polygon_point_add(obj->layer->evas->engine.data.output,
+ obj->layer->evas->engine.data.context,
+ o->engine_data,
+ p->x, p->y);
+ }
}
+
if (o->engine_data)
obj->layer->evas->engine.func->polygon_draw(output,
context,
surface,
- o->engine_data);
+ o->engine_data,
+ o->offset.x + x, o->offset.y + y);
}
static void
@@ -402,6 +435,12 @@ evas_object_polygon_render_pre(Evas_Object *obj)
goto done;
}
done:
+ if ((obj->cur.geometry.x != obj->prev.geometry.x) ||
+ (obj->cur.geometry.y != obj->prev.geometry.y))
+ {
+ o->offset.x += obj->cur.geometry.x - obj->prev.geometry.x;
+ o->offset.y += obj->cur.geometry.y - obj->prev.geometry.y;
+ }
evas_object_render_pre_effect_updates(&obj->layer->evas->clip_changes, obj, is_v, was_v);
}