diff --git a/src/lib/evas/canvas/evas_map.c b/src/lib/evas/canvas/evas_map.c index 5f05263676..2b31ffc97a 100644 --- a/src/lib/evas/canvas/evas_map.c +++ b/src/lib/evas/canvas/evas_map.c @@ -153,6 +153,7 @@ _evas_map_copy(Evas_Map *dst, const Evas_Map *src) dst->smooth = src->smooth; dst->alpha = src->alpha; dst->persp = src->persp; + dst->offset_applied = src->offset_applied; return EINA_TRUE; } @@ -165,6 +166,7 @@ _evas_map_dup(const Evas_Map *orig) copy->smooth = orig->smooth; copy->alpha = orig->alpha; copy->persp = orig->persp; + copy->offset_applied = orig->offset_applied; return copy; } @@ -535,6 +537,31 @@ evas_object_map_set(Evas_Object *eo_obj, const Evas_Map *map) eo_do(eo_obj, evas_obj_map_set(map)); } +static void +_evas_map_coord_offset_update(Eo *eo_obj, Evas_Object_Protected_Data *obj, Evas_Map *m) +{ + Evas_Public_Data *evas; + Evas_Map_Point *p, *p_end; + + if (m->offset_applied) + return; + + evas = obj->layer->evas; + + if (obj->is_frame || (eo_obj == evas->framespace.clip)) + return; + + p = m->points; + p_end = p + m->count; + for (; p < p_end; p++) + { + p->x += evas->framespace.x; + p->px += evas->framespace.x; + p->y += evas->framespace.y; + p->py += evas->framespace.y; + } +} + void _map_set(Eo *eo_obj, void *_pd, va_list *list) { @@ -615,12 +642,18 @@ _map_set(Eo *eo_obj, void *_pd, va_list *list) // We do have the same exact count of point in this map, so just copy it if ((obj->map->cur.map) && (obj->map->cur.map->count == map->count)) - _evas_map_copy(obj->map->cur.map, map); + { + _evas_map_copy(obj->map->cur.map, map); + _evas_map_coord_offset_update(eo_obj, obj, obj->map->cur.map); + } else { + Evas_Map *m; if (obj->map->cur.map) _evas_map_free(eo_obj, obj->map->cur.map); + m = _evas_map_dup(map); + _evas_map_coord_offset_update(eo_obj, obj, m); EINA_COW_WRITE_BEGIN(evas_object_map_cow, obj->map, Evas_Object_Map_Data, map_write) - map_write->cur.map = _evas_map_dup(map); + map_write->cur.map = m; EINA_COW_WRITE_END(evas_object_map_cow, obj->map, map_write); if (obj->map->cur.usemap) evas_object_mapped_clip_across_mark(eo_obj, obj); @@ -859,6 +892,7 @@ evas_map_util_points_populate_from_object_full(Evas_Map *m, const Evas_Object *e EAPI void evas_map_util_points_populate_from_object(Evas_Map *m, const Evas_Object *eo_obj) { + Evas_Coord x, y, w, h; MAGIC_CHECK(m, Evas_Map, MAGIC_MAP); return; MAGIC_CHECK_END(); @@ -874,8 +908,9 @@ evas_map_util_points_populate_from_object(Evas_Map *m, const Evas_Object *eo_obj ERR("map has count=%d where 4 was expected.", m->count); return; } - _evas_map_util_points_populate(m, obj->cur->geometry.x, obj->cur->geometry.y, - obj->cur->geometry.w, obj->cur->geometry.h, 0); + + evas_object_geometry_get(eo_obj, &x, &y, &w, &h); + _evas_map_util_points_populate(m, x, y, w, h, 0); } EAPI void diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h index e3270b9900..82443319a8 100644 --- a/src/lib/evas/include/evas_private.h +++ b/src/lib/evas/include/evas_private.h @@ -499,6 +499,7 @@ struct _Evas_Map } persp; Eina_Bool alpha : 1; Eina_Bool smooth : 1; + Eina_Bool offset_applied : 1; // whether the framespace offset was applied already or not. Evas_Map_Point points[]; // actual points };