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)
[[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 {
[[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.]]
}
}
}
}
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]]
}
}
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]]
}
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]]
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);
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;
(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));
}
}
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)
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);
{
//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
{
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;
}
}
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;
void *pixels = NULL;
int stride = 0;
DATA32 *data;
+ int load_error;
if (!o->engine_data) return NULL;
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;
void *engine_data;
DATA32 *data;
void* result = NULL;
+ int load_error;
static int warned = 0;
if (!warned)
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);
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)
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)
{
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)
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;
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)
{
_efl_gfx_mapping_init();
evas_focus_init();
+ _efl_gfx_image_load_error_init();
+
return _evas_init_count;
//TIZEN_ONLY(20171114) : support evas gl thread
}
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;
}
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)
{
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;
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)
{
_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;
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)
{
}
else
{
- o->load_error = EVAS_LOAD_ERROR_GENERIC;
+ o->load_error = EFL_GFX_IMAGE_LOAD_ERROR_GENERIC;
}
}
//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;
}
}
int server_id;
int connect_num;
int channel;
- int load_error;
- int num_palette;
+ Evas_Load_Error load_error;
};
struct _Engine_Image_Entry
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
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)
{
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;
#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;
}
}
-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;
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);