efl: cleanup Evas_Object_Protected_Data.

SVN revision: 83028
This commit is contained in:
Cedric BAIL 2013-01-21 03:51:58 +00:00
parent 01739d4cc1
commit 380aea9e91
5 changed files with 42 additions and 54 deletions

View File

@ -58,8 +58,8 @@ _evas_map_calc_map_geometry(Evas_Object *eo_obj)
ch = EINA_TRUE;
if (!ch)
{
if (obj->cache_map) evas_map_free(obj->cache_map);
obj->cache_map = obj->cur.map;
if (obj->map.cache_map) evas_map_free(obj->map.cache_map);
obj->map.cache_map = obj->cur.map;
obj->cur.map = obj->prev.map;
}
}
@ -170,11 +170,11 @@ _evas_map_free(Evas_Object *eo_obj, Evas_Map *m)
if (eo_obj)
{
Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
if ((obj) && (obj->spans))
if ((obj) && (obj->map.spans))
{
obj->layer->evas->engine.func->image_map_clean(obj->layer->evas->engine.data.output, obj->spans);
free(obj->spans);
obj->spans = NULL;
obj->layer->evas->engine.func->image_map_clean(obj->layer->evas->engine.data.output, obj->map.spans);
free(obj->map.spans);
obj->map.spans = NULL;
}
}
m->magic = 0;
@ -537,9 +537,9 @@ _map_set(Eo *eo_obj, void *_pd, va_list *list)
if (obj->prev.map == obj->cur.map)
obj->cur.map = NULL;
else if (!obj->cache_map)
else if (!obj->map.cache_map)
{
obj->cache_map = obj->cur.map;
obj->map.cache_map = obj->cur.map;
obj->cur.map = NULL;
}
else
@ -567,8 +567,8 @@ _map_set(Eo *eo_obj, void *_pd, va_list *list)
if (!obj->cur.map)
{
obj->cur.map = obj->cache_map;
obj->cache_map = NULL;
obj->cur.map = obj->map.cache_map;
obj->map.cache_map = NULL;
}
// We do have the same exact count of point in this map, so just copy it
@ -1184,11 +1184,11 @@ evas_object_map_update(Evas_Object *eo_obj,
RGBA_Map_Point *pts, *pt;
if (!obj) return;
if (obj->spans)
if (obj->map.spans)
{
if (obj->spans->x != x || obj->spans->y != y ||
obj->spans->image.w != imagew || obj->spans->image.h != imageh ||
obj->spans->uv.w != uvw || obj->spans->uv.h != uvh)
if (obj->map.spans->x != x || obj->map.spans->y != y ||
obj->map.spans->image.w != imagew || obj->map.spans->image.h != imageh ||
obj->map.spans->uv.w != uvw || obj->map.spans->uv.h != uvh)
obj->changed_map = EINA_TRUE;
}
else
@ -1198,31 +1198,31 @@ evas_object_map_update(Evas_Object *eo_obj,
if (!obj->changed_map) return ;
if (obj->cur.map && obj->spans && obj->cur.map->count != obj->spans->count)
if (obj->cur.map && obj->map.spans && obj->cur.map->count != obj->map.spans->count)
{
if (obj->spans)
if (obj->map.spans)
{
// Destroy engine side spans
free(obj->spans);
free(obj->map.spans);
}
obj->spans = NULL;
obj->map.spans = NULL;
}
if (!obj->spans)
obj->spans = calloc(1, sizeof (RGBA_Map) +
if (!obj->map.spans)
obj->map.spans = calloc(1, sizeof (RGBA_Map) +
sizeof (RGBA_Map_Point) * (obj->cur.map->count - 1));
if (!obj->spans) return ;
if (!obj->map.spans) return ;
obj->spans->count = obj->cur.map->count;
obj->spans->x = x;
obj->spans->y = y;
obj->spans->uv.w = uvw;
obj->spans->uv.h = uvh;
obj->spans->image.w = imagew;
obj->spans->image.h = imageh;
obj->map.spans->count = obj->cur.map->count;
obj->map.spans->x = x;
obj->map.spans->y = y;
obj->map.spans->uv.w = uvw;
obj->map.spans->uv.h = uvh;
obj->map.spans->image.w = imagew;
obj->map.spans->image.h = imageh;
pts = obj->spans->pts;
pts = obj->map.spans->pts;
p = obj->cur.map->points;
p_end = p + obj->cur.map->count;

View File

@ -3374,7 +3374,7 @@ evas_object_image_render(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, v
evas_object_map_update(eo_obj, x, y, imagew, imageh, uvw, uvh);
evas_draw_image_map_async_check(
obj, output, context, surface, pixels, obj->spans,
obj, output, context, surface, pixels, obj->map.spans,
o->cur.smooth_scale | obj->cur.map->smooth, 0, do_async);
}
else

View File

@ -83,15 +83,15 @@ evas_object_cur_prev(Evas_Object *eo_obj)
{
if (obj->prev.map != obj->cur.map)
evas_map_free(obj->prev.map);
if (obj->cache_map == obj->prev.map)
obj->cache_map = NULL;
if (obj->map.cache_map == obj->prev.map)
obj->map.cache_map = NULL;
obj->prev.map = NULL;
}
if (obj->cur.map != obj->prev.map)
{
if (obj->cache_map) evas_map_free(obj->cache_map);
obj->cache_map = obj->prev.map;
if (obj->map.cache_map) evas_map_free(obj->map.cache_map);
obj->map.cache_map = obj->prev.map;
}
obj->prev = obj->cur;
}
@ -108,7 +108,7 @@ evas_object_free(Evas_Object *eo_obj, int clean_layer)
if (!strcmp(obj->type, "image")) evas_object_image_video_surface_set(eo_obj, NULL);
evas_object_map_set(eo_obj, NULL);
if (obj->prev.map) evas_map_free(obj->prev.map);
if (obj->cache_map) evas_map_free(obj->cache_map);
if (obj->map.cache_map) evas_map_free(obj->map.cache_map);
if (obj->map.surface)
{
if (obj->layer)
@ -133,18 +133,10 @@ evas_object_free(Evas_Object *eo_obj, int clean_layer)
evas_object_clip_changes_clean(eo_obj);
evas_object_event_callback_all_del(eo_obj);
evas_object_event_callback_cleanup(eo_obj);
if (obj->spans)
if (obj->map.spans)
{
free(obj->spans);
obj->spans = NULL;
}
while (obj->data.elements)
{
Evas_Data_Node *node;
node = obj->data.elements->data;
obj->data.elements = eina_list_remove(obj->data.elements, node);
free(node);
free(obj->map.spans);
obj->map.spans = NULL;
}
if (obj->size_hints)
{

View File

@ -1180,7 +1180,7 @@ evas_render_mapped(Evas_Public_Data *e, Evas_Object *eo_obj,
(e->engine.data.output, context);
evas_draw_image_map_async_check
(obj, e->engine.data.output, context, surface,
obj->map.surface, obj->spans,
obj->map.surface, obj->map.spans,
obj->cur.map->smooth, 0, do_async);
}
// FIXME: needs to cache these maps and

View File

@ -555,17 +555,15 @@ struct _Evas_Object_Protected_Data
struct {
void *surface; // surface holding map if needed
int surface_w, surface_h; // current surface w & h alloc
Evas_Map *cache_map;
RGBA_Map *spans;
} map;
Evas_Map *cache_map;
char *name;
Evas_Intercept_Func *interceptors;
struct {
Eina_List *elements;
} data;
Eina_List *grabs;
Evas_Callbacks *callbacks;
@ -589,8 +587,6 @@ struct _Evas_Object_Protected_Data
Evas_Size_Hints *size_hints;
RGBA_Map *spans;
int last_mouse_down_counter;
int last_mouse_up_counter;
int mouse_grabbed;