evas: fix evas map life cycle.

SVN revision: 73963
This commit is contained in:
Cedric BAIL 2012-07-17 09:09:45 +00:00
parent 6facf35bb7
commit 7f1e95afc8
13 changed files with 79 additions and 32 deletions

View File

@ -888,4 +888,5 @@
2012-07-17 Cedric Bail
* Fix garbage left by mapped smart object when they fly away from the canvas.
* Fix map life cycle.

View File

@ -22,6 +22,7 @@ Fixes:
* Add svg rendering with Esvg
* Don't accept broken map.
* Fix garbage left by mapped smart object when they fly away from the canvas.
* Fix map life cycle.
Removal:
* Remove EVAS_FRAME_QUEUING, EVAS_SLI, METRIC_CACHE and WORD_CACHE.

View File

@ -42,36 +42,46 @@ _evas_map_calc_map_geometry(Evas_Object *obj)
// It has an infinite loop bug.
if (obj->prev.map)
{
// FIXME: this causes an infinite loop somewhere... hard to debug
if (obj->prev.map->count == obj->cur.map->count)
if (obj->prev.map != obj->cur.map)
{
const Evas_Map_Point *p2;
p = obj->cur.map->points;
p_end = p + obj->cur.map->count;
p2 = obj->prev.map->points;
for (; p < p_end; p++, p2++)
// FIXME: this causes an infinite loop somewhere... hard to debug
if (obj->prev.map->count == obj->cur.map->count)
{
if ((p->a != p2->a) ||
(p->r != p2->r) ||
(p->g != p2->g) ||
(p->b != p2->b))
const Evas_Map_Point *p2;
p = obj->cur.map->points;
p_end = p + obj->cur.map->count;
p2 = obj->prev.map->points;
for (; p < p_end; p++, p2++)
{
ch = 1;
break;
if ((p->a != p2->a) ||
(p->r != p2->r) ||
(p->g != p2->g) ||
(p->b != p2->b))
{
ch = 1;
break;
}
if ((p->x != p2->x) ||
(p->y != p2->y) ||
(p->z != p2->z))
{
ch = 1;
break;
}
}
if ((p->x != p2->x) ||
(p->y != p2->y) ||
(p->z != p2->z))
if (!ch)
{
ch = 1;
break;
if (obj->cache_map) evas_map_free(obj->cache_map);
obj->cache_map = obj->cur.map;
obj->cur.map = obj->prev.map;
}
}
else
ch = 1;
}
else
ch = 1;
}
else
ch = 1;
@ -468,8 +478,19 @@ evas_object_map_set(Evas_Object *obj, const Evas_Map *map)
obj->cur.map->surface = NULL;
}
obj->prev.geometry = obj->cur.map->normal_geometry;
_evas_map_free(obj, obj->cur.map);
obj->cur.map = NULL;
if (obj->prev.map == obj->cur.map)
obj->cur.map = NULL;
else if (!obj->cache_map)
{
obj->cache_map = obj->cur.map;
obj->cur.map = NULL;
}
else
{
_evas_map_free(obj, obj->cur.map);
obj->cur.map = NULL;
}
if (!obj->prev.map)
{
@ -485,6 +506,15 @@ evas_object_map_set(Evas_Object *obj, const Evas_Map *map)
return;
}
if (obj->prev.map == obj->cur.map)
obj->cur.map = NULL;
if (!obj->cur.map)
{
obj->cur.map = obj->cache_map;
obj->cache_map = NULL;
}
// We do have the same exact count of point in this map, so just copy it
if ((obj->cur.map) && (obj->cur.map->count == map->count))
_evas_map_copy(obj->cur.map, map);

View File

@ -3456,7 +3456,7 @@ evas_object_image_render_post(Evas_Object *obj)
EINA_LIST_FREE(o->pixel_updates, r)
eina_rectangle_free(r);
/* move cur to prev safely for object data */
obj->prev = obj->cur;
evas_object_cur_prev(obj);
o->prev = o->cur;
o->changed = 0;
/* FIXME: copy strings across */

View File

@ -379,7 +379,7 @@ evas_object_line_render_post(Evas_Object *obj)
/* remove those pesky changes */
evas_object_clip_changes_clean(obj);
/* move cur to prev safely for object data */
obj->prev = obj->cur;
evas_object_cur_prev(obj);
o->prev = o->cur;
o->changed = EINA_FALSE;
}

View File

@ -40,6 +40,17 @@ evas_object_change_reset(Evas_Object *obj)
obj->changed_pchange = EINA_FALSE;
}
void
evas_object_cur_prev(Evas_Object *obj)
{
if (obj->cur.map != obj->prev.map)
{
if (obj->cache_map) evas_map_free(obj->cache_map);
obj->cache_map = obj->prev.map;
}
obj->prev = obj->cur;
}
void
evas_object_free(Evas_Object *obj, int clean_layer)
{
@ -50,6 +61,8 @@ evas_object_free(Evas_Object *obj, int clean_layer)
#endif
if (!strcmp(obj->type, "image")) evas_object_image_video_surface_set(obj, NULL);
evas_object_map_set(obj, NULL);
if (obj->prev.map) evas_map_free(obj->prev.map);
if (obj->cache_map) evas_map_free(obj->cache_map);
evas_object_grabs_cleanup(obj);
evas_object_intercept_cleanup(obj);
if (obj->smart.parent) was_smart_child = 1;

View File

@ -439,7 +439,7 @@ evas_object_polygon_render_post(Evas_Object *obj)
/* remove those pesky changes */
evas_object_clip_changes_clean(obj);
/* move cur to prev safely for object data */
obj->prev = obj->cur;
evas_object_cur_prev(obj);
o->changed = 0;
}

View File

@ -279,7 +279,7 @@ evas_object_rectangle_render_post(Evas_Object *obj)
/* remove those pesky changes */
evas_object_clip_changes_clean(obj);
/* move cur to prev safely for object data */
obj->prev = obj->cur;
evas_object_cur_prev(obj);
}
static int

View File

@ -1234,7 +1234,7 @@ evas_object_smart_render_pre(Evas_Object *obj)
static void
evas_object_smart_render_post(Evas_Object *obj)
{
obj->prev = obj->cur;
evas_object_cur_prev(obj);
}
static unsigned int evas_object_smart_id_get(Evas_Object *obj)

View File

@ -1795,7 +1795,7 @@ evas_object_text_render_post(Evas_Object *obj)
/* remove those pesky changes */
evas_object_clip_changes_clean(obj);
/* move cur to prev safely for object data */
obj->prev = obj->cur;
evas_object_cur_prev(obj);
o->prev = o->cur;
o->changed = 0;
}

View File

@ -9869,7 +9869,7 @@ evas_object_textblock_render_post(Evas_Object *obj)
/* remove those pesky changes */
evas_object_clip_changes_clean(obj);
/* move cur to prev safely for object data */
obj->prev = obj->cur;
evas_object_cur_prev(obj);
/* o->prev = o->cur; */
/* o->changed = 0; */
}

View File

@ -841,7 +841,7 @@ evas_object_textgrid_render_post(Evas_Object *obj)
/* remove those pesky changes */
evas_object_clip_changes_clean(obj);
/* move cur to prev safely for object data */
obj->prev = obj->cur;
evas_object_cur_prev(obj);
o->prev = o->cur;
o->changed = 0;

View File

@ -543,6 +543,7 @@ struct _Evas_Object
Eina_Bool parent_cached_surface : 1;
} cur, prev;
Evas_Map *cache_map;
char *name;
Evas_Intercept_Func *interceptors;
@ -911,6 +912,7 @@ extern "C" {
Evas_Object *evas_object_new(Evas *e);
void evas_object_change_reset(Evas_Object *obj);
void evas_object_cur_prev(Evas_Object *obj);
void evas_object_free(Evas_Object *obj, int clean_layer);
void evas_object_update_bounding_box(Evas_Object *obj);
void evas_object_inject(Evas_Object *obj, Evas *e);