evas: image obj - use vath to find images (sync not async)

This commit is contained in:
Carsten Haitzler 2016-04-04 21:50:30 +09:00
parent 0c91f39db6
commit 776f4cb112
4 changed files with 50 additions and 2 deletions

View File

@ -57,6 +57,7 @@ _evas_image_file_set(Eo *eo_obj, const char *file, const char *key)
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
Evas_Image_Data *o = eo_data_scope_get(eo_obj, EVAS_IMAGE_CLASS);
Evas_Image_Load_Opts lo;
const char *file2;
if ((o->cur->u.file) && (file) && (!strcmp(o->cur->u.file, file)))
{
@ -68,7 +69,16 @@ _evas_image_file_set(Eo *eo_obj, const char *file, const char *key)
evas_object_async_block(obj);
_evas_image_init_set(NULL, file, key, eo_obj, obj, o, &lo);
o->engine_data = ENFN->image_load(ENDT, o->cur->u.file, o->cur->key, &o->load_error, &lo);
file2 = o->cur->u.file;
if (file2)
{
o->file_obj = efl_vpath_manager_fetch(EFL_VPATH_MANAGER_CLASS, file2);
efl_vpath_file_do(o->file_obj);
// XXX:FIXME: allow this to be async
efl_vpath_file_wait(o->file_obj);
file2 = efl_vpath_file_result_get(o->file_obj);
}
o->engine_data = ENFN->image_load(ENDT, file2, o->cur->key, &o->load_error, &lo);
o->buffer_data_set = EINA_FALSE;
_evas_image_done_set(eo_obj, obj, o);
@ -611,6 +621,11 @@ _image_pixels_set(Evas_Object_Protected_Data *obj,
ENFN->image_free(ENDT, o->engine_data);
o->engine_data = NULL;
}
if (o->file_obj)
{
eo_del(o->file_obj);
o->file_obj = NULL;
}
switch (cspace)
{

View File

@ -577,6 +577,11 @@ evas_object_image_data_set(Eo *eo_obj, void *data)
EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
o->engine_data = NULL;
if (o->file_obj)
{
eo_del(o->file_obj);
o->file_obj = NULL;
}
}
/* FIXME - in engine call above
if (o->engine_data)
@ -652,6 +657,11 @@ evas_object_image_data_copy_set(Eo *eo_obj, void *data)
(o->cur->image.h <= 0)) return;
if (o->engine_data)
ENFN->image_free(ENDT, o->engine_data);
if (o->file_obj)
{
eo_del(o->file_obj);
o->file_obj = NULL;
}
o->engine_data = ENFN->image_new_from_copied_data(ENDT,
o->cur->image.w,
o->cur->image.h,

View File

@ -107,6 +107,7 @@ struct _Evas_Image_Data
const Evas_Object_Image_Pixels *pixels;
void *engine_data;
Efl_Vpath_File *file_obj;
int pixels_checked_out;
int load_error;

View File

@ -260,6 +260,11 @@ _evas_image_init_set(const Eina_File *f, const char *file, const char *key,
}
ENFN->image_free(ENDT, o->engine_data);
}
if (o->file_obj)
{
eo_del(o->file_obj);
o->file_obj = NULL;
}
o->load_error = EVAS_LOAD_ERROR_NONE;
lo->scale_down_by = o->load_opts->scale_down_by;
lo->dpi = o->load_opts->dpi;
@ -1191,7 +1196,19 @@ _evas_image_load(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Evas_Imag
if (o->cur->mmaped_source)
o->engine_data = ENFN->image_mmap(ENDT, o->cur->u.f, o->cur->key, &o->load_error, &lo);
else
o->engine_data = ENFN->image_load(ENDT, o->cur->u.file, o->cur->key, &o->load_error, &lo);
{
const char *file2 = o->cur->u.file;
if (file2)
{
o->file_obj = efl_vpath_manager_fetch(EFL_VPATH_MANAGER_CLASS, file2);
efl_vpath_file_do(o->file_obj);
// XXX:FIXME: allow this to be async
efl_vpath_file_wait(o->file_obj);
file2 = efl_vpath_file_result_get(o->file_obj);
}
o->engine_data = ENFN->image_load(ENDT, file2, o->cur->key, &o->load_error, &lo);
}
if (o->engine_data)
{
@ -1341,6 +1358,11 @@ evas_object_image_free(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj)
}
}
o->engine_data = NULL;
if (o->file_obj)
{
eo_del(o->file_obj);
o->file_obj = NULL;
}
if (o->pixels->pixel_updates)
{
EINA_COW_PIXEL_WRITE_BEGIN(o, pixi_write)