static inline Evas_Map * _evas_map_dup(const Evas_Map *orig) { Evas_Map *copy = _evas_map_new(orig->count); if (!copy) return NULL; memcpy(copy->points, orig->points, orig->count * sizeof(Evas_Map_Point)); copy->smooth = orig->smooth; copy->alpha = orig->alpha; copy->persp = orig->persp; return copy; }
EAPI Evas_Map * evas_map_new(int count) { if (count != 4) { ERR("map point count (%i) != 4 is unsupported!", count); return NULL; } return _evas_map_new(count); }
EAPI void evas_object_map_enable_set(Evas_Object *obj, Eina_Bool enabled) { MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); return; MAGIC_CHECK_END(); enabled = !!enabled; if (obj->cur.usemap == enabled) return; obj->cur.usemap = enabled; if (enabled) { if (!obj->cur.map) obj->cur.map = _evas_map_new(4); evas_object_mapped_clip_across_mark(obj); // obj->cur.map->normal_geometry = obj->cur.geometry; } else { if (obj->cur.map) { _evas_map_calc_geom_change(obj); evas_object_mapped_clip_across_mark(obj); //FIXME: Since the last frame is not updated when map is //disabled, afterimage problem is happened in s/w rendering. //Need to find out the fundamental reason then fix it. evas_damage_rectangle_add(obj->layer->evas, 0, 0, obj->layer->evas->output.w, obj->layer->evas->output.h); } } _evas_map_calc_map_geometry(obj); /* This is a bit heavy handed, but it fixes the case of same geometry, but * changed colour or UV settings. */ evas_object_change(obj); }
EAPI void evas_object_map_set(Evas_Object *obj, const Evas_Map *map) { MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); return; MAGIC_CHECK_END(); if (!map) { if (obj->cur.map) { if (obj->cur.map->surface) { obj->layer->evas->engine.func->image_map_surface_free (obj->layer->evas->engine.data.output, obj->cur.map->surface); obj->cur.map->surface = NULL; } obj->prev.geometry = obj->cur.map->normal_geometry; if (!obj->prev.map) { _evas_map_free(obj, obj->cur.map); obj->cur.map = NULL; evas_object_mapped_clip_across_mark(obj); return; } _evas_map_free(obj, obj->cur.map); obj->cur.map = NULL; if (!obj->cur.usemap) _evas_map_calc_geom_change(obj); else _evas_map_calc_map_geometry(obj); if (obj->cur.usemap) { evas_object_mapped_clip_across_mark(obj); //FIXME: Since the last frame is not updated when map is //disabled, afterimage problem is happened in s/w //rendering. Need to find out the fundamental reason //then fix it. evas_damage_rectangle_add(obj->layer->evas, 0, 0, obj->layer->evas->output.w, obj->layer->evas->output.h); } } return; } if ((obj->cur.map) && (obj->cur.map->count == map->count)) { Evas_Map *omap = obj->cur.map; obj->cur.map = _evas_map_new(map->count); memcpy(obj->cur.map, omap, sizeof(Evas_Map) + (map->count * sizeof(Evas_Map_Point))); _evas_map_copy(obj->cur.map, map); if (obj->prev.map == omap) obj->prev.map = NULL; free(omap); } else { if (obj->cur.map) evas_map_free(obj->cur.map); obj->cur.map = _evas_map_dup(map); if (obj->cur.usemap) evas_object_mapped_clip_across_mark(obj); } _evas_map_calc_map_geometry(obj); }