efl.gfx: remove Efl.Gfx.Image_Load_Error
authorMike Blumenkrantz <zmike@samsung.com>
Mon, 4 Mar 2019 18:36:57 +0000 (13:36 -0500)
committerJunsuChoi <jsuya.choi@samsung.com>
Thu, 14 Mar 2019 05:46:26 +0000 (14:46 +0900)
Summary:
this is now implemented through Eina.Error

ref T7718

Depends on D8066

Reviewers: cedric

Reviewed By: cedric

Subscribers: cedric, #reviewers, #committers

Tags: #efl_api

Maniphest Tasks: T7718

Differential Revision: https://phab.enlightenment.org/D8067

Change-Id: I042e92fda899cfb76f04ba07a62adc00e0d66d34

17 files changed:
src/lib/edje/edje_load.c
src/lib/edje/efl_canvas_layout.eo
src/lib/efl/interfaces/efl_gfx_image.eo
src/lib/efl/interfaces/efl_gfx_image_load_controller.eo
src/lib/efl/interfaces/efl_gfx_types.eot
src/lib/evas/canvas/efl_canvas_image.c
src/lib/evas/canvas/efl_canvas_proxy.c
src/lib/evas/canvas/efl_canvas_scene3d.c
src/lib/evas/canvas/evas_image_legacy.c
src/lib/evas/canvas/evas_image_private.h
src/lib/evas/canvas/evas_main.c
src/lib/evas/canvas/evas_object_image.c
src/lib/evas/include/evas_common_private.h
src/lib/evas/include/evas_private.h
src/lib/evas/vg/evas_vg_cache.c
src/modules/evas/vg_savers/eet/evas_vg_save_eet.c
src/modules/evas/vg_savers/svg/evas_vg_save_svg.c

index 7c50de6..c7a00f1 100644 (file)
@@ -173,7 +173,7 @@ _efl_canvas_layout_efl_file_group_get(Eo *obj EINA_UNUSED, Edje *ed)
    return ed->group;
 }
 
-EOLIAN Efl_Gfx_Image_Load_Error
+EOLIAN Eina_Error
 _efl_canvas_layout_layout_load_error_get(const Eo *obj EINA_UNUSED, Edje *ed)
 {
    switch (ed->load_error)
index c427657..6c230aa 100644 (file)
@@ -79,7 +79,7 @@ class @beta Efl.Canvas.Layout extends Efl.Canvas.Group implements Efl.File, Efl.
               [[Gets the (last) file loading error for a given object.]]
           }
           values {
-             error: Efl.Gfx.Image_Load_Error(Efl.Gfx.Image_Load_Error.none); [[The load error code.]]
+             error: Eina.Error; [[The load error code.]]
           }
       }
       content_remove {
index eb23f3f..5d42432 100644 (file)
@@ -208,7 +208,7 @@ interface @beta Efl.Gfx.Image
              [[Gets the (last) file loading error for a given object.]]
          }
          values {
-            error: Efl.Gfx.Image_Load_Error(Efl.Gfx.Image_Load_Error.none); [[The load error code.]]
+            error: Eina.Error; [[The load error code.]]
          }
       }
    }
index 4771be1..1727e57 100644 (file)
@@ -180,6 +180,6 @@ interface @beta Efl.Gfx.Image_Load_Controller
    }
    events {
       load,done: void; [[Called when he image was loaded]]
-      load,error: Efl.Gfx.Image_Load_Error; [[Called when an error happened during image loading]]
+      load,error: Eina.Error; [[Called when an error happened during image loading]]
    }
 }
index 15f94f7..3ca4abb 100644 (file)
@@ -189,22 +189,6 @@ enum Efl.Gfx.Hint_Aspect
               aspect.]]
 }
 
-enum Efl.Gfx.Image_Load_Error
-{
-   [[Image or Edje load error type]]
-   none = 0,                       [[No error on load]]
-   generic = 1,                    [[A non-specific error occurred]]
-   does_not_exist = 2,             [[File (or file path) does not exist]]
-   permission_denied = 3,          [[Permission denied to an existing file (or path)]]
-   resource_allocation_failed = 4, [[Allocation of resources failure prevented load]]
-   corrupt_file = 5,               [[File corrupt (but was detected as a known format)]]
-   unknown_format = 6,             [[File is not a known format]]
-   cancelled = 7,                  [[Reading operation has been cancelled during decoding]]
-   incompatible_file = 8,          [[(Edje only) The file pointed to is incompatible, i.e., it doesn't match the library's current version's format.]]
-   unknown_collection = 9,         [[(Edje only) The group/collection set to load from was not found in the file]]
-   recursive_reference = 10        [[(Edje only) The group/collection set to load from had recursive references on its components]]
-}
-
 enum Efl.Gfx.Color_Class_Layer {
    [[Efl Gfx Color Class layer enum]]
    normal = 0, [[Default color]]
@@ -213,3 +197,15 @@ enum Efl.Gfx.Color_Class_Layer {
 }
 
 type Efl.Font.Size: int; [[Efl font size type]]
+
+var Efl.Gfx.Image.Load_Error.NONE: Eina.Error; [[No error on load]]
+var Efl.Gfx.Image.Load_Error.GENERIC: Eina.Error; [[A non-specific error occurred]]
+var Efl.Gfx.Image.Load_Error.DOES_NOT_EXIST: Eina.Error; [[File (or file path) does not exist]]
+var Efl.Gfx.Image.Load_Error.PERMISSION_DENIED: Eina.Error; [[Permission denied to an existing file (or path)]]
+var Efl.Gfx.Image.Load_Error.RESOURCE_ALLOCATION_FAILED: Eina.Error; [[Allocation of resources failure prevented load]]
+var Efl.Gfx.Image.Load_Error.CORRUPT_FILE: Eina.Error; [[File corrupt (but was detected as a known format)]]
+var Efl.Gfx.Image.Load_Error.UNKNOWN_FORMAT: Eina.Error; [[File is not a known format]]
+var Efl.Gfx.Image.Load_Error.CANCELLED: Eina.Error; [[Reading operation has been cancelled during decoding]]
+var Efl.Gfx.Image.Load_Error.INCOMPATIBLE_FILE: Eina.Error; [[(Edje only) The file pointed to is incompatible, i.e., it doesn't match the library's current version's format.]]
+var Efl.Gfx.Image.Load_Error.UNKNOWN_COLLECTION: Eina.Error; [[(Edje only) The group/collection set to load from was not found in the file]]
+var Efl.Gfx.Image.Load_Error.RECURSIVE_REFERENCE: Eina.Error; [[(Edje only) The group/collection set to load from had recursive references on its components]]
index 0d95f2f..c89ee21 100644 (file)
@@ -12,6 +12,7 @@ _evas_image_file_load(Eo *eo_obj)
    Evas_Image_Load_Opts lo;
    const Eina_File *f = efl_file_mmap_get(eo_obj);
    const char *key = efl_file_key_get(eo_obj);
+   int load_error;
 
    EINA_SAFETY_ON_NULL_RETURN_VAL(f, EINA_FALSE);
 
@@ -26,7 +27,8 @@ _evas_image_file_load(Eo *eo_obj)
    obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
    evas_object_async_block(obj);
    _evas_image_init_set(f, key, eo_obj, obj, o, &lo);
-   o->engine_data = ENFN->image_mmap(ENC, o->cur->f, o->cur->key, &o->load_error, &lo);
+   o->engine_data = ENFN->image_mmap(ENC, o->cur->f, o->cur->key, &load_error, &lo);
+   o->load_error = _evas_load_error_to_efl_gfx_image_load_error(load_error);
    o->buffer_data_set = EINA_FALSE;
    _evas_image_done_set(eo_obj, obj, o);
    o->file_size.w = o->cur->image.w;
@@ -787,11 +789,11 @@ _efl_canvas_image_efl_object_dbg_info_get(Eo *obj, void *pd EINA_UNUSED, Efl_Dbg
        (root))
      {
         Efl_Dbg_Info *group = EFL_DBG_INFO_LIST_APPEND(root, MY_CLASS_NAME);
-        Evas_Load_Error error = EVAS_LOAD_ERROR_GENERIC;
+        Eina_Error error = EFL_GFX_IMAGE_LOAD_ERROR_GENERIC;
 
-        error = (Evas_Load_Error) efl_gfx_image_load_error_get(obj);
+        error = efl_gfx_image_load_error_get(obj);
         EFL_DBG_INFO_APPEND(group, "Load Error", EINA_VALUE_TYPE_STRING,
-                            evas_load_error_str(error));
+                            eina_error_msg_get(error));
      }
 }
 
index 734b8bc..c8368ea 100644 (file)
@@ -229,7 +229,7 @@ _evas_image_proxy_set(Evas_Object *eo_proxy, Evas_Object *eo_src)
    EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
      state_write->source = eo_src;
    EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
-   o->load_error = EVAS_LOAD_ERROR_NONE;
+   o->load_error = EFL_GFX_IMAGE_LOAD_ERROR_NONE;;
    o->proxyerror = 0;
 
    EINA_COW_WRITE_BEGIN(evas_object_proxy_cow, src->proxy, Evas_Object_Proxy_Data, proxy_src_write)
index 3dff897..513a68b 100644 (file)
@@ -9,12 +9,14 @@ _efl_canvas_scene3d_scene3d_set(Eo *eo_obj, void *pd EINA_UNUSED, Evas_Canvas3D_
    Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
    Evas_Image_Data *o = efl_data_scope_get(eo_obj, EFL_CANVAS_IMAGE_INTERNAL_CLASS);
    Evas_Image_Load_Opts lo;
+   int load_error;
 
    if (o->cur->scene == scene) return;
 
    evas_object_async_block(obj);
    _evas_image_init_set(NULL, NULL, eo_obj, obj, o, &lo);
-   o->engine_data = ENFN->image_mmap(ENC, o->cur->f, o->cur->key, &o->load_error, &lo);
+   o->engine_data = ENFN->image_mmap(ENC, o->cur->f, o->cur->key, &load_error, &lo);
+   o->load_error = _evas_load_error_to_efl_gfx_image_load_error(load_error);
    _evas_image_done_set(eo_obj, obj, o);
 
    if (scene) _evas_image_3d_set(eo_obj, scene);
index d14986b..5443d4b 100755 (executable)
@@ -397,8 +397,7 @@ evas_object_image_load_error_get(const Evas_Object *obj)
 {
    //TIZEN_ONLY(20180515): keep compatibility
    //EVAS_IMAGE_API(obj, EVAS_LOAD_ERROR_GENERIC);
-   EVAS_IMAGE_API(obj, EVAS_LOAD_ERROR_NONE);
-   return efl_gfx_image_load_error_get(obj);
+   return _efl_gfx_image_load_error_to_evas_load_error(efl_gfx_image_load_error_get(obj));
 }
 
 EAPI void
@@ -547,7 +546,7 @@ evas_object_image_native_surface_set(Evas_Object *eo_obj, Evas_Native_Surface *s
      {
         Evas_Image_Data *o = efl_data_scope_get(eo_obj, EFL_CANVAS_IMAGE_INTERNAL_CLASS);
 
-        o->load_error = EVAS_LOAD_ERROR_GENERIC;
+        o->load_error = EFL_GFX_IMAGE_LOAD_ERROR_GENERIC;
      }
 }
 
@@ -696,7 +695,7 @@ evas_object_image_data_set(Eo *eo_obj, void *data)
              o->changed = EINA_TRUE;
              evas_object_change(eo_obj, obj);
           }
-        o->load_error = EVAS_LOAD_ERROR_NONE;
+        o->load_error = EFL_GFX_IMAGE_LOAD_ERROR_NONE;
         if ((o->cur->image.w != 0) || (o->cur->image.h != 0))
           resize_call = EINA_TRUE;
 
@@ -745,6 +744,7 @@ evas_object_image_data_get(const Eo *eo_obj, Eina_Bool for_writing)
    void *pixels = NULL;
    int stride = 0;
    DATA32 *data;
+   int load_error;
 
    if (!o->engine_data) return NULL;
 
@@ -758,7 +758,8 @@ evas_object_image_data_get(const Eo *eo_obj, Eina_Bool for_writing)
      ENFN->image_scale_hint_set(ENC, o->engine_data, o->scale_hint);
    if (ENFN->image_content_hint_set)
      ENFN->image_content_hint_set(ENC, o->engine_data, o->content_hint);
-   pixels = ENFN->image_data_get(ENC, o->engine_data, for_writing, &data, &o->load_error, &tofree);
+   pixels = ENFN->image_data_get(ENC, o->engine_data, for_writing, &data, &load_error, &tofree);
+   o->load_error = _evas_load_error_to_efl_gfx_image_load_error(load_error);
 
    /* if we fail to get engine_data, we have to return NULL */
    if (!pixels || !data) goto error;
@@ -1202,6 +1203,7 @@ evas_object_image_data_convert(Evas_Object *eo_obj, Evas_Colorspace to_cspace)
    void *engine_data;
    DATA32 *data;
    void* result = NULL;
+   int load_error;
 
    static int warned = 0;
    if (!warned)
@@ -1222,7 +1224,8 @@ evas_object_image_data_convert(Evas_Object *eo_obj, Evas_Colorspace to_cspace)
         ENFN->image_data_preload_cancel(ENC, o->engine_data, eo_obj, EINA_TRUE);
      }
    data = NULL;
-   engine_data = ENFN->image_data_get(ENC, o->engine_data, 0, &data, &o->load_error, NULL);
+   engine_data = ENFN->image_data_get(ENC, o->engine_data, 0, &data, &load_error, NULL);
+   o->load_error = _evas_load_error_to_efl_gfx_image_load_error(load_error);
    result = _evas_image_data_convert_internal(o, data, to_cspace);
    if (engine_data)
      o->engine_data = ENFN->image_data_put(ENC, engine_data, data);
@@ -1276,6 +1279,7 @@ evas_object_image_pixels_import(Evas_Object *eo_obj, Evas_Pixel_Import_Source *p
 
    Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
    Evas_Image_Data *o;
+   int load_error;
 
    static int warned = 0;
    if (!warned)
@@ -1303,7 +1307,8 @@ evas_object_image_pixels_import(Evas_Object *eo_obj, Evas_Pixel_Import_Source *p
                                          o->engine_data,
                                          1,
                                          &image_pixels,
-                                         &o->load_error);
+                                         &load_error);
+                  o->load_error = _evas_load_error_to_efl_gfx_image_load_error(load_error);
 /* FIXME: need to actualyl support this */
 /*               memcpy(image_pixels, pixels->rows, o->cur->image.w * o->cur->image.h * 4);*/
                   if (o->engine_data)
@@ -1324,7 +1329,8 @@ evas_object_image_pixels_import(Evas_Object *eo_obj, Evas_Pixel_Import_Source *p
                {
                   DATA32 *image_pixels = NULL;
 
-                  o->engine_data = ENFN->image_data_get(ENC, o->engine_data, 1, &image_pixels,&o->load_error, NULL);
+                  o->engine_data = ENFN->image_data_get(ENC, o->engine_data, 1, &image_pixels, &load_error, NULL);
+                  o->load_error = _evas_load_error_to_efl_gfx_image_load_error(load_error);
                   if (image_pixels)
                     evas_common_convert_yuv_422p_601_rgba((DATA8 **) pixels->rows, (DATA8 *) image_pixels, o->cur->image.w, o->cur->image.h);
                   if (o->engine_data)
index fbada80..903188d 100755 (executable)
@@ -118,7 +118,7 @@ struct _Evas_Image_Data
    void             *plane;
 
    int               pixels_checked_out;
-   int               load_error;
+   Eina_Error        load_error; /* Efl.Gfx.Image.Load_Error */
 
    Efl_Gfx_Image_Scale_Hint   scale_hint;
    Efl_Gfx_Image_Content_Hint content_hint;
index b699cf7..d4fd530 100644 (file)
@@ -25,6 +25,101 @@ EAPI int lockmax = 0;
 static int _evas_init_count = 0;
 int _evas_log_dom_global = -1;
 
+EAPI Eina_Error EFL_GFX_IMAGE_LOAD_ERROR_NONE = 0;
+EAPI Eina_Error EFL_GFX_IMAGE_LOAD_ERROR_GENERIC = 0;
+EAPI Eina_Error EFL_GFX_IMAGE_LOAD_ERROR_DOES_NOT_EXIST = 0;
+EAPI Eina_Error EFL_GFX_IMAGE_LOAD_ERROR_PERMISSION_DENIED = 0;
+EAPI Eina_Error EFL_GFX_IMAGE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED = 0;
+EAPI Eina_Error EFL_GFX_IMAGE_LOAD_ERROR_CORRUPT_FILE = 0;
+EAPI Eina_Error EFL_GFX_IMAGE_LOAD_ERROR_UNKNOWN_FORMAT = 0;
+EAPI Eina_Error EFL_GFX_IMAGE_LOAD_ERROR_CANCELLED = 0;
+EAPI Eina_Error EFL_GFX_IMAGE_LOAD_ERROR_INCOMPATIBLE_FILE = 0;
+EAPI Eina_Error EFL_GFX_IMAGE_LOAD_ERROR_UNKNOWN_COLLECTION = 0;
+EAPI Eina_Error EFL_GFX_IMAGE_LOAD_ERROR_RECURSIVE_REFERENCE = 0;
+
+#define NUM_ERRORS 11
+
+const char *efl_gfx_image_load_error_msgs[] = {
+ "No error on load" ,
+ "A non-specific error occurred" ,
+ "File (or file path) does not exist" ,
+ "Permission denied to an existing file (or path)" ,
+ "Allocation of resources failure prevented load" ,
+ "File corrupt (but was detected as a known format)" ,
+ "File is not a known format" ,
+ "Reading operation has been cancelled during decoding" ,
+ "(Edje only) The file pointed to is incompatible, i.e., it doesn't match the library's current version's format." ,
+ "(Edje only) The group/collection set to load from was not found in the file" ,
+ "(Edje only) The group/collection set to load from had recursive references on its components" 
+};
+
+static void
+_efl_gfx_image_load_error_init(void)
+{
+   Eina_Error *table[] = {
+     &EFL_GFX_IMAGE_LOAD_ERROR_NONE,
+     &EFL_GFX_IMAGE_LOAD_ERROR_GENERIC,
+     &EFL_GFX_IMAGE_LOAD_ERROR_DOES_NOT_EXIST,
+     &EFL_GFX_IMAGE_LOAD_ERROR_PERMISSION_DENIED,
+     &EFL_GFX_IMAGE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED,
+     &EFL_GFX_IMAGE_LOAD_ERROR_CORRUPT_FILE,
+     &EFL_GFX_IMAGE_LOAD_ERROR_UNKNOWN_FORMAT,
+     &EFL_GFX_IMAGE_LOAD_ERROR_CANCELLED,
+     &EFL_GFX_IMAGE_LOAD_ERROR_INCOMPATIBLE_FILE,
+     &EFL_GFX_IMAGE_LOAD_ERROR_UNKNOWN_COLLECTION,
+     &EFL_GFX_IMAGE_LOAD_ERROR_RECURSIVE_REFERENCE
+     };
+   unsigned int i;
+
+   if (EFL_GFX_IMAGE_LOAD_ERROR_GENERIC) return;
+   /* skip EFL_GFX_IMAGE_LOAD_ERROR_NONE: this should always be 0 */
+   for (i = 1; i < NUM_ERRORS; i++)
+     *(table[i]) = eina_error_msg_static_register(efl_gfx_image_load_error_msgs[i]);
+#undef TABLE_ENTRY
+}
+
+Eina_Error
+_evas_load_error_to_efl_gfx_image_load_error(Evas_Load_Error err)
+{
+#define TABLE_ENTRY(NAME) [EVAS_LOAD_ERROR_##NAME] = &EFL_GFX_IMAGE_LOAD_ERROR_##NAME
+   Eina_Error *table[] = {
+     TABLE_ENTRY(NONE),
+     TABLE_ENTRY(GENERIC),
+     TABLE_ENTRY(DOES_NOT_EXIST),
+     TABLE_ENTRY(PERMISSION_DENIED),
+     TABLE_ENTRY(RESOURCE_ALLOCATION_FAILED),
+     TABLE_ENTRY(CORRUPT_FILE),
+     TABLE_ENTRY(UNKNOWN_FORMAT),
+     TABLE_ENTRY(CANCELLED),
+     //TABLE_ENTRY(INCOMPATIBLE_FILE),
+     //TABLE_ENTRY(UNKNOWN_COLLECTION),
+     //TABLE_ENTRY(RECURSIVE_REFERENCE)
+     };
+   if (err > EVAS_LOAD_ERROR_CANCELLED) return err;
+   return *table[err];
+#undef TABLE_ENTRY
+}
+
+Evas_Load_Error
+_efl_gfx_image_load_error_to_evas_load_error(Eina_Error err)
+{
+    if (err && (err < EFL_GFX_IMAGE_LOAD_ERROR_GENERIC)) return EVAS_LOAD_ERROR_GENERIC;
+#define CONVERT_ERR(NAME) if (err == EFL_GFX_IMAGE_LOAD_ERROR_##NAME) return EVAS_LOAD_ERROR_##NAME
+   CONVERT_ERR(NONE);
+   CONVERT_ERR(GENERIC);
+   CONVERT_ERR(DOES_NOT_EXIST);
+   CONVERT_ERR(PERMISSION_DENIED);
+   CONVERT_ERR(RESOURCE_ALLOCATION_FAILED);
+   CONVERT_ERR(CORRUPT_FILE);
+   CONVERT_ERR(UNKNOWN_FORMAT);
+   CONVERT_ERR(CANCELLED);
+   //CONVERT_ERR(INCOMPATIBLE_FILE);
+   //CONVERT_ERR(UNKNOWN_COLLECTION);
+   //CONVERT_ERR(RECURSIVE_REFERENCE);
+   return EVAS_LOAD_ERROR_GENERIC;
+}
+
+
 EAPI int
 evas_init(void)
 {
@@ -83,6 +178,8 @@ evas_init(void)
    _efl_gfx_mapping_init();
    evas_focus_init();
 
+   _efl_gfx_image_load_error_init();
+
    return _evas_init_count;
 
 //TIZEN_ONLY(20171114) : support evas gl thread
index dd91fb8..87aab38 100755 (executable)
@@ -295,7 +295,7 @@ _evas_image_init_set(const Eina_File *f, const char *key,
           }
         ENFN->image_free(ENC, o->engine_data);
      }
-   o->load_error = EVAS_LOAD_ERROR_NONE;
+   o->load_error = EFL_GFX_IMAGE_LOAD_ERROR_NONE;
    lo->emile.scale_down_by = o->load_opts->scale_down_by;
    lo->emile.dpi = o->load_opts->dpi;
    lo->emile.w = o->load_opts->w;
@@ -353,8 +353,8 @@ _evas_image_done_set(Eo *eo_obj, Evas_Object_Protected_Data *obj, Evas_Image_Dat
      }
    else
      {
-        if (o->load_error == EVAS_LOAD_ERROR_NONE)
-          o->load_error = EVAS_LOAD_ERROR_GENERIC;
+        if (o->load_error == EFL_GFX_IMAGE_LOAD_ERROR_NONE)
+          o->load_error = EFL_GFX_IMAGE_LOAD_ERROR_GENERIC;
 
         EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
         {
@@ -867,7 +867,7 @@ _efl_canvas_image_internal_efl_gfx_image_ratio_get(const Eo *eo_obj EINA_UNUSED,
    return (double)o->cur->image.w / (double)o->cur->image.h;
 }
 
-EOLIAN static Efl_Gfx_Image_Load_Error
+EOLIAN static Eina_Error
 _efl_canvas_image_internal_efl_gfx_image_image_load_error_get(const Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o)
 {
    return o->load_error;
@@ -1139,7 +1139,7 @@ _evas_image_unload(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Eina_Bo
         ENFN->image_free(ENC, o->engine_data);
      }
    o->engine_data = NULL;
-   o->load_error = EVAS_LOAD_ERROR_NONE;
+   o->load_error = EFL_GFX_IMAGE_LOAD_ERROR_NONE;
 
    EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
    {
@@ -1158,6 +1158,7 @@ void
 _evas_image_load(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Evas_Image_Data *o)
 {
    Evas_Image_Load_Opts lo;
+   int load_error = 0;
 
    if (o->engine_data) return;
 
@@ -1181,7 +1182,8 @@ _evas_image_load(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Evas_Imag
    lo.emile.degree = 0;
    lo.emile.can_load_colormap = o->load_opts->can_load_colormap;
    lo.skip_head = o->skip_head;
-   o->engine_data = ENFN->image_mmap(ENC, o->cur->f, o->cur->key, &o->load_error, &lo);
+   o->engine_data = ENFN->image_mmap(ENC, o->cur->f, o->cur->key, &load_error, &lo);
+   o->load_error = _evas_load_error_to_efl_gfx_image_load_error(load_error);
 
    if (o->engine_data)
      {
@@ -1210,7 +1212,7 @@ _evas_image_load(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Evas_Imag
      }
    else
      {
-        o->load_error = EVAS_LOAD_ERROR_GENERIC;
+        o->load_error = EFL_GFX_IMAGE_LOAD_ERROR_GENERIC;
      }
 }
 
@@ -1249,12 +1251,12 @@ _evas_image_load_post_update(Evas_Object *eo_obj, Evas_Object_Protected_Data *ob
 
         //preloading error check
         if (ENFN->image_load_error_get)
-          o->load_error = ENFN->image_load_error_get(ENC, o->engine_data);
+          o->load_error = _evas_load_error_to_efl_gfx_image_load_error(ENFN->image_load_error_get(ENC, o->engine_data));
      }
    else
      {
         o->preload = EVAS_IMAGE_PRELOAD_NONE;
-        o->load_error = EVAS_LOAD_ERROR_GENERIC;
+        o->load_error = EFL_GFX_IMAGE_LOAD_ERROR_GENERIC;
      }
 }
 
index 18ac67b..0b0d8bc 100755 (executable)
@@ -676,8 +676,7 @@ struct _Image_Entry
    int                    server_id;
    int                    connect_num;
    int                    channel;
-   int                    load_error;
-   int                    num_palette;
+   Evas_Load_Error        load_error;
 };
 
 struct _Engine_Image_Entry
index f535499..1ee2bf2 100755 (executable)
@@ -1550,7 +1550,7 @@ struct _Evas_Vg_Load_Func
 
 struct _Evas_Vg_Save_Func
 {
-   int (*file_save) (Vg_File_Data *vfd, const char *file, const char *key, int compress);
+   Evas_Load_Error (*file_save) (Vg_File_Data *vfd, const char *file, const char *key, int compress);
 };
 
 #ifdef __cplusplus
@@ -1938,6 +1938,9 @@ extern Eina_Cow *evas_object_image_state_cow;
 extern Eina_Cow *evas_object_mask_cow;
 extern Eina_Cow *evas_object_events_cow;
 
+Eina_Error _evas_load_error_to_efl_gfx_image_load_error(Evas_Load_Error err);
+Evas_Load_Error _efl_gfx_image_load_error_to_evas_load_error(Eina_Error err);
+
 # define EINA_COW_STATE_WRITE_BEGIN(Obj, Write, State)          \
   EINA_COW_WRITE_BEGIN(evas_object_state_cow, Obj->State, \
                        Evas_Object_Protected_State, Write)
index 83b58e2..dd85349 100644 (file)
@@ -181,7 +181,7 @@ _vg_file_save(Vg_File_Data *vfd, const char *file, const char *key, const Efl_Fi
 {
    Evas_Module       *em;
    Evas_Vg_Save_Func *saver;
-   int                error = EVAS_LOAD_ERROR_GENERIC;
+   Evas_Load_Error    error = EVAS_LOAD_ERROR_GENERIC;
    int                compress = 9;
 
    if (!file) return EINA_FALSE;
index 54f35e1..a7a1bf3 100644 (file)
@@ -12,7 +12,7 @@ static int _evas_vg_saver_eet_log_dom = -1;
 #endif
 #define INF(...) EINA_LOG_DOM_INFO(_evas_vg_saver_eet_log_dom, __VA_ARGS__)
 
-int
+Evas_Load_Error
 evas_vg_save_file_eet(Vg_File_Data *evg_data, const char *file, const char *key, int compress)
 {
    Eet_Data_Descriptor *svg_node_eet;
index cf7854d..e900432 100644 (file)
@@ -129,7 +129,7 @@ _svg_node_printf(Svg_Node *parent, Eina_Strbuf *buf)
      }
 }
 
-int
+Evas_Load_Error
 evas_vg_save_file_svg(Vg_File_Data *evg_data, const char *file, const char *key EINA_UNUSED, int compress EINA_UNUSED)
 {
    Eina_Strbuf *buf = NULL;
@@ -138,7 +138,7 @@ evas_vg_save_file_svg(Vg_File_Data *evg_data, const char *file, const char *key
    if (!f)
      {
         ERR("Cannot open file '%s' for SVG save", file);
-        return EFL_GFX_IMAGE_LOAD_ERROR_GENERIC;
+        return EVAS_LOAD_ERROR_GENERIC;
      }
 
    root = vg_common_svg_create_svg_node(evg_data);