diff options
author | Jaehyun Cho <jae_hyun.cho@samsung.com> | 2014-11-28 13:18:16 +0900 |
---|---|---|
committer | ChunEon Park <hermet@hermet.pe.kr> | 2014-11-28 13:18:16 +0900 |
commit | 30623aea9ebb1b3923bed51a7c42c55cb8602ef0 (patch) | |
tree | da956e4c4dd31cebc664f2fcf1ec7e223336b787 /src/lib/evas/canvas | |
parent | 5b9ece9c85b020d9d43274b3b245bcdcdf5b6502 (diff) |
evas_object_main: Keep map effect after evas object move
Summary:
Keep map effect after evas object move
@feature
Reviewers: raster, cedric, Hermet
Subscribers: raster, cedric
Differential Revision: https://phab.enlightenment.org/D1678
Diffstat (limited to 'src/lib/evas/canvas')
-rw-r--r-- | src/lib/evas/canvas/evas_map.c | 77 | ||||
-rw-r--r-- | src/lib/evas/canvas/evas_object_main.c | 8 |
2 files changed, 85 insertions, 0 deletions
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 | ||
655 | EAPI void | ||
656 | evas_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 | |||
670 | EAPI Eina_Bool | ||
671 | evas_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 | |||
653 | EAPI Evas_Map * | 680 | EAPI Evas_Map * |
654 | evas_map_dup(const Evas_Map *m) | 681 | evas_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 | ||
1314 | void | ||
1315 | evas_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 | |||
1327 | void | ||
1328 | evas_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); |