raster pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=776f4cb112449c24fa333b30afb88847fb9cbc15

commit 776f4cb112449c24fa333b30afb88847fb9cbc15
Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com>
Date:   Mon Apr 4 21:50:30 2016 +0900

    evas: image obj - use vath to find images (sync not async)
---
 src/lib/evas/canvas/efl_canvas_image.c   | 17 ++++++++++++++++-
 src/lib/evas/canvas/evas_image_legacy.c  | 10 ++++++++++
 src/lib/evas/canvas/evas_image_private.h |  1 +
 src/lib/evas/canvas/evas_object_image.c  | 24 +++++++++++++++++++++++-
 4 files changed, 50 insertions(+), 2 deletions(-)

diff --git a/src/lib/evas/canvas/efl_canvas_image.c 
b/src/lib/evas/canvas/efl_canvas_image.c
index d6fb366..e799773 100644
--- a/src/lib/evas/canvas/efl_canvas_image.c
+++ b/src/lib/evas/canvas/efl_canvas_image.c
@@ -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)
      {
diff --git a/src/lib/evas/canvas/evas_image_legacy.c 
b/src/lib/evas/canvas/evas_image_legacy.c
index 6d719e9..02843de 100644
--- a/src/lib/evas/canvas/evas_image_legacy.c
+++ b/src/lib/evas/canvas/evas_image_legacy.c
@@ -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,
diff --git a/src/lib/evas/canvas/evas_image_private.h 
b/src/lib/evas/canvas/evas_image_private.h
index 0fee726..407537c 100644
--- a/src/lib/evas/canvas/evas_image_private.h
+++ b/src/lib/evas/canvas/evas_image_private.h
@@ -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;
diff --git a/src/lib/evas/canvas/evas_object_image.c 
b/src/lib/evas/canvas/evas_object_image.c
index 8678e48..04a6a79 100644
--- a/src/lib/evas/canvas/evas_object_image.c
+++ b/src/lib/evas/canvas/evas_object_image.c
@@ -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)

-- 


Reply via email to