summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/evas/Evas_Common.h27
-rw-r--r--src/lib/evas/canvas/evas_map.c77
-rw-r--r--src/lib/evas/canvas/evas_object_main.c8
-rw-r--r--src/lib/evas/include/evas_private.h6
4 files changed, 118 insertions, 0 deletions
diff --git a/src/lib/evas/Evas_Common.h b/src/lib/evas/Evas_Common.h
index ed336c23cf..dfffa14a9b 100644
--- a/src/lib/evas/Evas_Common.h
+++ b/src/lib/evas/Evas_Common.h
@@ -2406,6 +2406,33 @@ EAPI void evas_map_alpha_set(Evas_Map *m, Eina_Bool enabled);
2406EAPI Eina_Bool evas_map_alpha_get(const Evas_Map *m); 2406EAPI Eina_Bool evas_map_alpha_get(const Evas_Map *m);
2407 2407
2408/** 2408/**
2409 * Set the flag of the object move synchronization for map rendering
2410 *
2411 * This sets the flag of the object move synchronization for map rendering.
2412 * If the flag is set as enabled, the map will be moved as the object of the map
2413 * is moved. By default, the flag of the object move synchronization is not
2414 * enabled.
2415 *
2416 * @param m map to modify. Must not be NULL.
2417 * @param enabled enable or disable the object move synchronization for map
2418 * rendering.
2419 * @since 1.13
2420 */
2421EAPI void evas_map_util_object_move_sync_set(Evas_Map *m, Eina_Bool enabled);
2422
2423/**
2424 * Get the flag of the object move synchronization for map rendering
2425 *
2426 * This gets the flag of the object move synchronization for map rendering.
2427 *
2428 * @param m map to get the flag of the object move synchronization from. Must
2429 * not be NULL.
2430 * @return EINA_FALSE if map is NULL EINA_TRUE otherwise.
2431 * @since 1.13
2432 */
2433EAPI Eina_Bool evas_map_util_object_move_sync_get(const Evas_Map *m);
2434
2435/**
2409 * Copy a previously allocated map. 2436 * Copy a previously allocated map.
2410 * 2437 *
2411 * This makes a duplicate of the @p m object and returns it. 2438 * This makes a duplicate of the @p m object and returns it.
diff --git a/src/lib/evas/canvas/evas_map.c b/src/lib/evas/canvas/evas_map.c
index 7b4f5778bb..4680828cbc 100644
--- a/src/lib/evas/canvas/evas_map.c
+++ b/src/lib/evas/canvas/evas_map.c
@@ -152,6 +152,7 @@ _evas_map_copy(Evas_Map *dst, const Evas_Map *src)
152 memcpy(dst->points, src->points, src->count * sizeof(Evas_Map_Point)); 152 memcpy(dst->points, src->points, src->count * sizeof(Evas_Map_Point));
153 dst->smooth = src->smooth; 153 dst->smooth = src->smooth;
154 dst->alpha = src->alpha; 154 dst->alpha = src->alpha;
155 dst->move_sync = src->move_sync;
155 dst->persp = src->persp; 156 dst->persp = src->persp;
156 return EINA_TRUE; 157 return EINA_TRUE;
157} 158}
@@ -164,6 +165,7 @@ _evas_map_dup(const Evas_Map *orig)
164 memcpy(copy->points, orig->points, orig->count * sizeof(Evas_Map_Point)); 165 memcpy(copy->points, orig->points, orig->count * sizeof(Evas_Map_Point));
165 copy->smooth = orig->smooth; 166 copy->smooth = orig->smooth;
166 copy->alpha = orig->alpha; 167 copy->alpha = orig->alpha;
168 copy->move_sync = orig->move_sync;
167 copy->persp = orig->persp; 169 copy->persp = orig->persp;
168 return copy; 170 return copy;
169} 171}
@@ -650,6 +652,31 @@ evas_map_alpha_get(const Evas_Map *m)
650 return m->alpha; 652 return m->alpha;
651} 653}
652 654
655EAPI void
656evas_map_util_object_move_sync_set(Evas_Map *m, Eina_Bool enabled)
657{
658 MAGIC_CHECK(m, Evas_Map, MAGIC_MAP);
659 return;
660 MAGIC_CHECK_END();
661
662 if (!enabled)
663 {
664 m->move_sync.diff_x = 0;
665 m->move_sync.diff_y = 0;
666 }
667 m->move_sync.enabled = !!enabled;
668}
669
670EAPI Eina_Bool
671evas_map_util_object_move_sync_get(const Evas_Map *m)
672{
673 MAGIC_CHECK(m, Evas_Map, MAGIC_MAP);
674 return EINA_FALSE;
675 MAGIC_CHECK_END();
676
677 return m->move_sync.enabled;
678}
679
653EAPI Evas_Map * 680EAPI Evas_Map *
654evas_map_dup(const Evas_Map *m) 681evas_map_dup(const Evas_Map *m)
655{ 682{
@@ -1199,6 +1226,8 @@ evas_object_map_update(Evas_Object *eo_obj,
1199 obj->changed_map = EINA_TRUE; 1226 obj->changed_map = EINA_TRUE;
1200 } 1227 }
1201 1228
1229 evas_object_map_move_sync(eo_obj);
1230
1202 if (!obj->changed_map) return EINA_FALSE; 1231 if (!obj->changed_map) return EINA_FALSE;
1203 1232
1204 if (obj->map->cur.map && obj->map->spans && obj->map->cur.map->count != obj->map->spans->count) 1233 if (obj->map->cur.map && obj->map->spans && obj->map->cur.map->count != obj->map->spans->count)
@@ -1282,3 +1311,51 @@ evas_object_map_update(Evas_Object *eo_obj,
1282 return obj->changed_pchange; 1311 return obj->changed_pchange;
1283} 1312}
1284 1313
1314void
1315evas_map_object_move_diff_set(Evas_Map *m,
1316 Evas_Coord diff_x,
1317 Evas_Coord diff_y)
1318{
1319 MAGIC_CHECK(m, Evas_Map, MAGIC_MAP);
1320 return;
1321 MAGIC_CHECK_END();
1322
1323 m->move_sync.diff_x += diff_x;
1324 m->move_sync.diff_y += diff_y;
1325}
1326
1327void
1328evas_object_map_move_sync(Evas_Object *eo_obj)
1329{
1330 Evas_Object_Protected_Data *obj;
1331 Evas_Map *m;
1332 Evas_Map_Point *p;
1333 Evas_Coord diff_x, diff_y;
1334 int i, count;
1335
1336 obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
1337 if (!obj) return;
1338
1339 if ((!obj->map->cur.map->move_sync.enabled) ||
1340 ((obj->map->cur.map->move_sync.diff_x == 0) &&
1341 (obj->map->cur.map->move_sync.diff_y == 0)))
1342 return;
1343
1344 m = obj->map->cur.map;
1345 p = m->points;
1346 count = m->count;
1347 diff_x = m->move_sync.diff_x;
1348 diff_y = m->move_sync.diff_y;
1349
1350 for (i = 0; i < count; i++, p++)
1351 {
1352 p->px += diff_x;
1353 p->py += diff_y;
1354 p->x += diff_x;
1355 p->y += diff_y;
1356 }
1357 m->move_sync.diff_x = 0;
1358 m->move_sync.diff_y = 0;
1359
1360 _evas_map_calc_map_geometry(eo_obj);
1361}
diff --git a/src/lib/evas/canvas/evas_object_main.c b/src/lib/evas/canvas/evas_object_main.c
index ac1f53eac2..f1459f5d59 100644
--- a/src/lib/evas/canvas/evas_object_main.c
+++ b/src/lib/evas/canvas/evas_object_main.c
@@ -750,6 +750,14 @@ _evas_object_position_set(Eo *eo_obj, Evas_Object_Protected_Data *obj, Evas_Coor
750 750
751 if ((obj->cur->geometry.x == x) && (obj->cur->geometry.y == y)) return; 751 if ((obj->cur->geometry.x == x) && (obj->cur->geometry.y == y)) return;
752 752
753 Evas_Map *map = eo_do(eo_obj, evas_obj_map_get());
754 if (map && map->move_sync.enabled)
755 {
756 Evas_Coord diff_x = x - obj->cur->geometry.x;
757 Evas_Coord diff_y = y - obj->cur->geometry.y;
758 evas_map_object_move_diff_set(map, diff_x, diff_y);
759 }
760
753 if (!(obj->layer->evas->is_frozen)) 761 if (!(obj->layer->evas->is_frozen))
754 { 762 {
755 pass = evas_event_passes_through(eo_obj, obj); 763 pass = evas_event_passes_through(eo_obj, obj);
diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h
index aa9c85210f..50f9fa5c7b 100644
--- a/src/lib/evas/include/evas_private.h
+++ b/src/lib/evas/include/evas_private.h
@@ -843,6 +843,10 @@ struct _Evas_Map
843 } persp; 843 } persp;
844 Eina_Bool alpha : 1; 844 Eina_Bool alpha : 1;
845 Eina_Bool smooth : 1; 845 Eina_Bool smooth : 1;
846 struct {
847 Eina_Bool enabled : 1;
848 Evas_Coord diff_x, diff_y;
849 } move_sync;
846 Evas_Map_Point points[]; // actual points 850 Evas_Map_Point points[]; // actual points
847}; 851};
848 852
@@ -1693,6 +1697,8 @@ void evas_render_proxy_subrender(Evas *eo_e, Evas_Object *eo_source, Evas_Object
1693Eina_Bool evas_map_inside_get(const Evas_Map *m, Evas_Coord x, Evas_Coord y); 1697Eina_Bool evas_map_inside_get(const Evas_Map *m, Evas_Coord x, Evas_Coord y);
1694Eina_Bool evas_map_coords_get(const Evas_Map *m, Evas_Coord x, Evas_Coord y, Evas_Coord *mx, Evas_Coord *my, int grab); 1698Eina_Bool evas_map_coords_get(const Evas_Map *m, Evas_Coord x, Evas_Coord y, Evas_Coord *mx, Evas_Coord *my, int grab);
1695Eina_Bool evas_object_map_update(Evas_Object *obj, int x, int y, int imagew, int imageh, int uvw, int uvh); 1699Eina_Bool evas_object_map_update(Evas_Object *obj, int x, int y, int imagew, int imageh, int uvw, int uvh);
1700void evas_map_object_move_diff_set(Evas_Map *m, Evas_Coord diff_x, Evas_Coord diff_y);
1701void evas_object_map_move_sync(Evas_Object *obj);
1696 1702
1697Eina_List *evas_module_engine_list(void); 1703Eina_List *evas_module_engine_list(void);
1698 1704