diff --git a/src/lib/evas/common/evas_image_load.c b/src/lib/evas/common/evas_image_load.c index 4ed3624e8c..a505bc99f6 100644 --- a/src/lib/evas/common/evas_image_load.c +++ b/src/lib/evas/common/evas_image_load.c @@ -150,18 +150,25 @@ _evas_image_file_header(Evas_Module *em, Image_Entry *ie, int *error) if (evas_image_load_func) { Evas_Image_Property property; - Eina_File *f; - f = eina_file_open(ie->file, EINA_FALSE); - if (!f) + if (!ie->f) ie->f = eina_file_open(ie->file, EINA_FALSE); + if (!ie->f) { *error = EVAS_LOAD_ERROR_DOES_NOT_EXIST; - return EINA_TRUE; + goto load_error; } + ie->loader_data = evas_image_load_func->file_open(ie->f, ie->key, + &ie->load_opts, + &ie->animated, + error); + if (!ie->loader_data) + { + goto load_error; + } + memset(&property, 0, sizeof (Evas_Image_Property)); - if (evas_image_load_func->file_head(f, ie->key, &property, - &ie->load_opts, &ie->animated, + if (evas_image_load_func->file_head(ie->loader_data, &property, error) && (*error == EVAS_LOAD_ERROR_NONE)) { @@ -184,7 +191,6 @@ _evas_image_file_header(Evas_Module *em, Image_Entry *ie, int *error) "%s (%s)", em->definition->name, em, ie->file, evas_load_error_str(*error)); } - eina_file_close(f); } else { @@ -327,7 +333,6 @@ EAPI int evas_common_load_rgba_image_data_from_file(Image_Entry *ie) { void *pixels; - Eina_File *f; Evas_Image_Load_Func *evas_image_load_func = NULL; Evas_Image_Property property; int ret = EVAS_LOAD_ERROR_NONE; @@ -363,39 +368,23 @@ evas_common_load_rgba_image_data_from_file(Image_Entry *ie) evas_image_load_func = ie->info.loader; evas_module_use((Evas_Module*) ie->info.module); - f = eina_file_open(ie->file, EINA_FALSE); - if (!f) return EVAS_LOAD_ERROR_DOES_NOT_EXIST; + if (!ie->f) return EVAS_LOAD_ERROR_DOES_NOT_EXIST; memset(&property, 0, sizeof (Evas_Image_Property)); - if (!(evas_image_load_func->file_head(f, ie->key, &property, - &ie->load_opts, &ie->animated, - &ret) && - (ret == EVAS_LOAD_ERROR_NONE))) - goto on_error; - - ie->w = property.w; - ie->h = property.h; - ie->scale = property.scale; - ie->flags.alpha = property.alpha; - if (ie->load_opts.orientation && - ie->load_opts.degree != 0) - ie->flags.rotated = EINA_TRUE; + property.w = ie->w; + property.h = ie->h; + property.scale = property.scale; + property.rotated = ie->flags.rotated; + property.premul = EINA_FALSE; + property.alpha_sparse = EINA_FALSE; evas_cache_image_surface_alloc(ie, ie->w, ie->h); pixels = evas_cache_image_pixels(ie); if (!pixels) - { - ret = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED; - goto on_error; - } + return EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED; - evas_image_load_func->file_data(f, ie->key, - &property, - &ie->load_opts, - &ie->animated, - pixels, - &ret); + evas_image_load_func->file_data(ie->loader_data, &property, pixels, &ret); ie->flags.alpha_sparse = property.alpha_sparse; @@ -404,9 +393,6 @@ evas_common_load_rgba_image_data_from_file(Image_Entry *ie) // evas_module_unref((Evas_Module*) ie->info.module); // ie->info.module = NULL; - on_error: - eina_file_close(f); - return ret; } @@ -421,17 +407,9 @@ evas_common_load_rgba_image_frame_duration_from_file(Image_Entry *ie, const int evas_module_use((Evas_Module*) ie->info.module); if (evas_image_load_func->frame_duration) { - Eina_File *f; - double r; + if (!ie->f) return -1; - f = eina_file_open(ie->file, EINA_FALSE); - if (!f) return -1; - - r = evas_image_load_func->frame_duration(f, &ie->animated, start, frame_num); - - eina_file_close(f); - - return r; + return evas_image_load_func->frame_duration(ie->loader_data, start, frame_num); } return -1; } diff --git a/src/lib/evas/common/evas_image_main.c b/src/lib/evas/common/evas_image_main.c index 3a81e2a0d1..0668979860 100644 --- a/src/lib/evas/common/evas_image_main.c +++ b/src/lib/evas/common/evas_image_main.c @@ -217,6 +217,14 @@ _evas_common_rgba_image_delete(Image_Entry *ie) } } } + if (ie->loader_data) + { + Evas_Image_Load_Func *evas_image_load_func = NULL; + + evas_image_load_func = ie->info.loader; + evas_image_load_func->file_close(ie->loader_data); + } + if (ie->f) eina_file_close(ie->f); free(im); } diff --git a/src/lib/evas/include/evas_common.h b/src/lib/evas/include/evas_common.h index 1991b6b413..a1b94fcc20 100644 --- a/src/lib/evas/include/evas_common.h +++ b/src/lib/evas/include/evas_common.h @@ -633,6 +633,13 @@ struct _Image_Entry LK(lock); LK(lock_cancel); + /* for animation feature */ + Image_Entry_Animated animated; + + /* Reference to the file */ + Eina_File *f; + void *loader_data; + Image_Entry_Flags flags; Evas_Image_Scale_Hint scale_hint; void *data1, *data2; @@ -643,9 +650,6 @@ struct _Image_Entry int connect_num; int channel; int load_error; - - /* for animation feature */ - Image_Entry_Animated animated; }; struct _Engine_Image_Entry diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h index 1adb15b016..bc3805e7cf 100644 --- a/src/lib/evas/include/evas_private.h +++ b/src/lib/evas/include/evas_private.h @@ -903,20 +903,21 @@ struct _Evas_Func struct _Evas_Image_Load_Func { Eina_Bool threadable; - Eina_Bool (*file_head) (Eina_File *f, const char *key, - Evas_Image_Property *prop, + void *(*file_open) (Eina_File *f, const char *key, Evas_Image_Load_Opts *opts, Evas_Image_Animated *animated, int *error); - Eina_Bool (*file_data) (Eina_File *f, const char *key, + void (*file_close) (void *loader_data); + + Eina_Bool (*file_head) (void *loader_data, Evas_Image_Property *prop, - Evas_Image_Load_Opts *opts, - Evas_Image_Animated *animated, - void *pixels, int *error); - double (*frame_duration) (Eina_File *f, - Evas_Image_Animated *animated, + Eina_Bool (*file_data) (void *loader_data, + Evas_Image_Property *prop, + void *pixels, int *error); + double (*frame_duration) (void *loader_data, int start, int frame_num); + Eina_Bool do_region; }; diff --git a/src/modules/evas/loaders/bmp/evas_image_load_bmp.c b/src/modules/evas/loaders/bmp/evas_image_load_bmp.c index 9acf545df7..981937cab4 100644 --- a/src/modules/evas/loaders/bmp/evas_image_load_bmp.c +++ b/src/modules/evas/loaders/bmp/evas_image_load_bmp.c @@ -38,6 +38,13 @@ struct _BMP_Header Eina_Bool hasa; }; +typedef struct _Evas_Loader_Internal Evas_Loader_Internal; +struct _Evas_Loader_Internal +{ + Eina_File *f; + Evas_Image_Load_Opts *opts; +}; + static Eina_Bool read_short(unsigned char *map, size_t length, size_t *position, short *ret) { @@ -287,13 +294,41 @@ _evas_image_load_file_header(void *map, size_t fsize, size_t *position, int *ima return EINA_TRUE; } -static Eina_Bool -evas_image_load_file_head_bmp(Eina_File *f, const char *key EINA_UNUSED, - Evas_Image_Property *prop, - Evas_Image_Load_Opts *load_opts, +static void * +evas_image_load_file_open_bmp(Eina_File *f, const char *key EINA_UNUSED, + Evas_Image_Load_Opts *opts, Evas_Image_Animated *animated EINA_UNUSED, int *error) { + Evas_Loader_Internal *loader; + + loader = calloc(1, sizeof (Evas_Loader_Internal)); + if (!loader) + { + *error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED; + return NULL; + } + + loader->f = f; + loader->opts = opts; + + return loader; +} + +static void +evas_image_load_file_close_bmp(void *loader_data) +{ + free(loader_data); +} + +static Eina_Bool +evas_image_load_file_head_bmp(void *loader_data, + Evas_Image_Property *prop, + int *error) +{ + Evas_Loader_Internal *loader; + Evas_Image_Load_Opts *load_opts; + Eina_File *f; void *map = NULL; size_t position = 0; BMP_Header header; @@ -301,6 +336,10 @@ evas_image_load_file_head_bmp(Eina_File *f, const char *key EINA_UNUSED, size_t fsize; Eina_Bool r = EINA_FALSE; + loader = loader_data; + f = loader->f; + load_opts = loader->opts; + *error = EVAS_LOAD_ERROR_UNKNOWN_FORMAT; fsize = eina_file_size_get(f); if (fsize < 2) goto close_file; @@ -405,13 +444,14 @@ evas_image_load_file_head_bmp(Eina_File *f, const char *key EINA_UNUSED, } static Eina_Bool -evas_image_load_file_data_bmp(Eina_File *f, const char *key EINA_UNUSED, +evas_image_load_file_data_bmp(void *loader_data, Evas_Image_Property *prop, - Evas_Image_Load_Opts *opts, - Evas_Image_Animated *animated EINA_UNUSED, void *pixels, int *error) { + Evas_Loader_Internal *loader; + Evas_Image_Load_Opts *opts; + Eina_File *f; BMP_Header header; void *map = NULL; size_t position = 0; @@ -428,6 +468,10 @@ evas_image_load_file_data_bmp(Eina_File *f, const char *key EINA_UNUSED, int row_size = 0; /* Row size is rounded up to a multiple of 4bytes */ int read_line = 0; /* total read line */ + loader = loader_data; + f = loader->f; + opts = loader->opts; + *error = EVAS_LOAD_ERROR_UNKNOWN_FORMAT; fsize = eina_file_size_get(f); if (fsize < 2) goto close_file; @@ -1328,6 +1372,8 @@ evas_image_load_file_data_bmp(Eina_File *f, const char *key EINA_UNUSED, static Evas_Image_Load_Func evas_image_load_bmp_func = { EINA_TRUE, + evas_image_load_file_open_bmp, + evas_image_load_file_close_bmp, evas_image_load_file_head_bmp, evas_image_load_file_data_bmp, NULL, diff --git a/src/modules/evas/loaders/eet/evas_image_load_eet.c b/src/modules/evas/loaders/eet/evas_image_load_eet.c index fed0083002..ec1368cc59 100644 --- a/src/modules/evas/loaders/eet/evas_image_load_eet.c +++ b/src/modules/evas/loaders/eet/evas_image_load_eet.c @@ -7,17 +7,20 @@ #include "evas_common.h" #include "evas_private.h" -static Eina_Bool -evas_image_load_file_head_eet(Eina_File *f, const char *key, - Evas_Image_Property *prop, - Evas_Image_Load_Opts *opts EINA_UNUSED, - Evas_Image_Animated *animated EINA_UNUSED, - int *error) +typedef struct _Evas_Loader_Internal Evas_Loader_Internal; +struct _Evas_Loader_Internal { - Eet_File *ef = NULL; - int a, compression, quality, lossy; - int ok; - Eina_Bool res = EINA_FALSE; + Eet_File *ef; + const char *key; +}; + +static void * +evas_image_load_file_open_eet(Eina_File *f, const char *key, + Evas_Image_Load_Opts *opts EINA_UNUSED, + Evas_Image_Animated *animated EINA_UNUSED, + int *error) +{ + Evas_Loader_Internal *loader; if (!key) { @@ -25,66 +28,80 @@ evas_image_load_file_head_eet(Eina_File *f, const char *key, return EINA_FALSE; } - ef = eet_mmap(f); - if (!ef) + loader = calloc(1, sizeof (Evas_Loader_Internal)); + if (!loader) { - *error = EVAS_LOAD_ERROR_CORRUPT_FILE; - goto on_error; + *error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED; + return NULL; } - ok = eet_data_image_header_read(ef, key, + + loader->ef = eet_mmap(f); + if (!loader->ef) + { + free(loader); + *error = EVAS_LOAD_ERROR_CORRUPT_FILE; + return NULL; + } + + loader->key = eina_stringshare_ref(key); + return loader; +} + +static void +evas_image_load_file_close_eet(void *loader_data) +{ + Evas_Loader_Internal *loader = loader_data; + + eet_close(loader->ef); + eina_stringshare_del(loader->key); + free(loader); +} + +static inline Eina_Bool +_evas_image_load_return_error(int err, int *error) +{ + *error = err; + return EINA_FALSE; +} + +static Eina_Bool +evas_image_load_file_head_eet(void *loader_data, + Evas_Image_Property *prop, + int *error) +{ + Evas_Loader_Internal *loader = loader_data; + int a, compression, quality, lossy; + int ok; + + ok = eet_data_image_header_read(loader->ef, loader->key, &prop->w, &prop->h, &a, &compression, &quality, &lossy); if (!ok) - { - *error = EVAS_LOAD_ERROR_DOES_NOT_EXIST; - goto on_error; - } + return _evas_image_load_return_error(EVAS_LOAD_ERROR_DOES_NOT_EXIST, error); if (IMG_TOO_BIG(prop->w, prop->h)) - { - *error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED; - goto on_error; - } + return _evas_image_load_return_error(EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED, error); + prop->alpha = !!a; - res = EINA_TRUE; *error = EVAS_LOAD_ERROR_NONE; - on_error: - if (ef) eet_close(ef); - return res; + return EINA_TRUE; } Eina_Bool -evas_image_load_file_data_eet(Eina_File *f, const char *key, - Evas_Image_Property *prop, - Evas_Image_Load_Opts *opts EINA_UNUSED, - Evas_Image_Animated *animated EINA_UNUSED, - void *pixels, +evas_image_load_file_data_eet(void *loader_data, + Evas_Image_Property *prop, + void *pixels, int *error) { + Evas_Loader_Internal *loader = loader_data; int alpha, compression, quality, lossy, ok; - Eet_File *ef; DATA32 *body, *p, *end; DATA32 nas = 0; - Eina_Bool res = EINA_FALSE; - if (!key) - { - *error = EVAS_LOAD_ERROR_DOES_NOT_EXIST; - return EINA_FALSE; - } - ef = eet_mmap(f); - if (!ef) - { - *error = EVAS_LOAD_ERROR_CORRUPT_FILE; - goto on_error; - } - ok = eet_data_image_read_to_surface(ef, key, 0, 0, + ok = eet_data_image_read_to_surface(loader->ef, loader->key, 0, 0, pixels, prop->w, prop->h, prop->w * 4, &alpha, &compression, &quality, &lossy); if (!ok) - { - *error = EVAS_LOAD_ERROR_GENERIC; - goto on_error; - } + return _evas_image_load_return_error(EVAS_LOAD_ERROR_GENERIC, error); if (alpha) { @@ -112,16 +129,15 @@ evas_image_load_file_data_eet(Eina_File *f, const char *key, // result is already premultiplied now if u compile with edje // evas_common_image_premul(im); *error = EVAS_LOAD_ERROR_NONE; - res = EINA_TRUE; - on_error: - if (ef) eet_close(ef); - return res; + return EINA_TRUE; } Evas_Image_Load_Func evas_image_load_eet_func = { EINA_TRUE, + evas_image_load_file_open_eet, + evas_image_load_file_close_eet, evas_image_load_file_head_eet, evas_image_load_file_data_eet, NULL, diff --git a/src/modules/evas/loaders/generic/evas_image_load_generic.c b/src/modules/evas/loaders/generic/evas_image_load_generic.c index a65c91fc03..d057741377 100644 --- a/src/modules/evas/loaders/generic/evas_image_load_generic.c +++ b/src/modules/evas/loaders/generic/evas_image_load_generic.c @@ -16,6 +16,14 @@ #include #include +typedef struct _Evas_Loader_Internal Evas_Loader_Internal; +struct _Evas_Loader_Internal +{ + Eina_File *f; + const char *key; + Evas_Image_Load_Opts *opts; +}; + static Eina_Bool illegal_char(const char *str) { @@ -372,30 +380,62 @@ getdata: return res; } -static Eina_Bool -evas_image_load_file_head_generic(Eina_File *f, const char *key, - Evas_Image_Property *prop, - Evas_Image_Load_Opts *opts, - Evas_Image_Animated *animated EINA_UNUSED, - int *error) +static void * +evas_image_load_file_open_generic(Eina_File *f, const char *key, + Evas_Image_Load_Opts *opts, + Evas_Image_Animated *animated EINA_UNUSED, + int *error) { - return _load(f, key, prop, opts, NULL, error, EINA_FALSE); + Evas_Loader_Internal *loader; + + loader = calloc(1, sizeof (Evas_Loader_Internal)); + if (!loader) + { + *error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED; + return NULL; + } + + loader->f = f; + loader->key = eina_stringshare_ref(key); + loader->opts = opts; + return loader; +} + +static void +evas_image_load_file_close_generic(void *loader_data) +{ + Evas_Loader_Internal *loader = loader_data; + + eina_stringshare_del(loader->key); + free(loader); } static Eina_Bool -evas_image_load_file_data_generic(Eina_File *f, const char *key, +evas_image_load_file_head_generic(void *loader_data, + Evas_Image_Property *prop, + int *error) +{ + Evas_Loader_Internal *loader = loader_data; + + return _load(loader->f, loader->key, prop, loader->opts, NULL, error, EINA_FALSE); +} + +static Eina_Bool +evas_image_load_file_data_generic(void *loader_data, Evas_Image_Property *prop, - Evas_Image_Load_Opts *opts, - Evas_Image_Animated *animated EINA_UNUSED, void *pixels, int *error) { - return _load(f, key, prop, opts, pixels, error, EINA_TRUE); + Evas_Loader_Internal *loader = loader_data; + + return _load(loader->f, loader->key, prop, loader->opts, pixels, error, EINA_TRUE); } Evas_Image_Load_Func evas_image_load_generic_func = { EINA_TRUE, + evas_image_load_file_open_generic, + evas_image_load_file_close_generic, evas_image_load_file_head_generic, evas_image_load_file_data_generic, NULL, diff --git a/src/modules/evas/loaders/gif/evas_image_load_gif.c b/src/modules/evas/loaders/gif/evas_image_load_gif.c index 5997aad55b..0132b06a89 100644 --- a/src/modules/evas/loaders/gif/evas_image_load_gif.c +++ b/src/modules/evas/loaders/gif/evas_image_load_gif.c @@ -43,6 +43,14 @@ struct _Gif_Frame int bg_val; }; +typedef struct _Evas_Loader_Internal Evas_Loader_Internal; +struct _Evas_Loader_Internal +{ + Eina_File *f; + Evas_Image_Load_Opts *opts; + Evas_Image_Animated *animated; +}; + static Eina_Bool evas_image_load_specific_frame(Eina_File *f, const Evas_Image_Load_Opts *opts, Evas_Image_Property *prop, Evas_Image_Animated *animated, int frame_index, int *error); #define byte2_to_int(a,b) (((b)<<8)|(a)) @@ -655,14 +663,44 @@ _evas_image_load_file_read(GifFileType* gft, GifByteType *buf,int length) return length; } +static void * +evas_image_load_file_open_gif(Eina_File *f, const char *key EINA_UNUSED, + Evas_Image_Load_Opts *opts, + Evas_Image_Animated *animated, + int *error) +{ + Evas_Loader_Internal *loader; + + loader = calloc(1, sizeof (Evas_Loader_Internal)); + if (!loader) + { + *error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED; + return NULL; + } + + loader->f = f; + loader->opts = opts; + loader->animated = animated; + + return loader; +} + +static void +evas_image_load_file_close_gif(void *loader_data) +{ + free(loader_data); +} static Eina_Bool -evas_image_load_file_head_gif(Eina_File *f, const char *key EINA_UNUSED, +evas_image_load_file_head_gif(void *loader_data, Evas_Image_Property *prop, - Evas_Image_Load_Opts *load_opts, - Evas_Image_Animated *animated, int *error) { + Evas_Loader_Internal *loader = loader_data; + Evas_Image_Load_Opts *load_opts; + Evas_Image_Animated *animated; + Eina_File *f; + Evas_GIF_Info egi; GifRecordType rec; GifFileType *gif = NULL; @@ -673,6 +711,10 @@ evas_image_load_file_head_gif(Eina_File *f, const char *key EINA_UNUSED, //in that case we should play gif file until meet error frame. int image_count = 0; + f = loader->f; + load_opts = loader->opts; + animated = loader->animated; + prop->w = 0; prop->h = 0; a = 0; @@ -871,17 +913,23 @@ evas_image_load_specific_frame(Eina_File *f, } static Eina_Bool -evas_image_load_file_data_gif(Eina_File *f, const char *key EINA_UNUSED, - Evas_Image_Property *prop, - Evas_Image_Load_Opts *opts, - Evas_Image_Animated *animated, - void *pixels, - int *error) +evas_image_load_file_data_gif(void *loader_data, + Evas_Image_Property *prop, + void *pixels, int *error) { + Evas_Loader_Internal *loader = loader_data; + Evas_Image_Load_Opts *opts; + Evas_Image_Animated *animated; + Eina_File *f; + Image_Entry_Frame *frame = NULL; int cur_frame_index; Eina_Bool hit; + opts = loader->opts; + animated = loader->animated; + f = loader->f; + if(!animated->animated) cur_frame_index = 1; else @@ -968,9 +1016,13 @@ evas_image_load_file_data_gif(Eina_File *f, const char *key EINA_UNUSED, } static double -evas_image_load_frame_duration_gif(Eina_File *f, Evas_Image_Animated *animated, +evas_image_load_frame_duration_gif(void *loader_data, int start_frame, int frame_num) { + Evas_Loader_Internal *loader = loader_data; + Evas_Image_Animated *animated; + Eina_File *f; + Evas_GIF_Info egi; GifFileType *gif = NULL; GifRecordType rec; @@ -979,6 +1031,8 @@ evas_image_load_frame_duration_gif(Eina_File *f, Evas_Image_Animated *animated, double duration = -1; int frame_count = 0; + animated = loader->animated; + f = loader->f; frame_count = animated->frame_count; if (!animated->animated) return -1; @@ -1060,7 +1114,9 @@ evas_image_load_frame_duration_gif(Eina_File *f, Evas_Image_Animated *animated, static Evas_Image_Load_Func evas_image_load_gif_func = { EINA_TRUE, - evas_image_load_file_head_gif, + evas_image_load_file_open_gif, + evas_image_load_file_close_gif, + evas_image_load_file_head_gif, evas_image_load_file_data_gif, evas_image_load_frame_duration_gif, EINA_FALSE diff --git a/src/modules/evas/loaders/ico/evas_image_load_ico.c b/src/modules/evas/loaders/ico/evas_image_load_ico.c index 98f1e94793..121d3b6b84 100644 --- a/src/modules/evas/loaders/ico/evas_image_load_ico.c +++ b/src/modules/evas/loaders/ico/evas_image_load_ico.c @@ -11,6 +11,14 @@ #include "evas_common.h" #include "evas_private.h" +typedef struct _Evas_Loader_Internal Evas_Loader_Internal; +struct _Evas_Loader_Internal +{ + Eina_File *f; + const char *key; + Evas_Image_Load_Opts *opts; +}; + static Eina_Bool read_ushort(unsigned char *map, size_t length, size_t *position, unsigned short *ret) { @@ -67,13 +75,47 @@ enum CURSOR = 2 }; +static void * +evas_image_load_file_open_ico(Eina_File *f, const char *key, + Evas_Image_Load_Opts *opts, + Evas_Image_Animated *animated EINA_UNUSED, + int *error) +{ + Evas_Loader_Internal *loader; + + loader = calloc(1, sizeof (Evas_Loader_Internal)); + if (!loader) + { + *error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED; + return NULL; + } + + loader->f = f; + loader->key = eina_stringshare_ref(key); + loader->opts = opts; + + return loader; +} + +static void +evas_image_load_file_close_ico(void *loader_data) +{ + Evas_Loader_Internal *loader = loader_data; + + eina_stringshare_del(loader->key); + free(loader); +} + static Eina_Bool -evas_image_load_file_head_ico(Eina_File *f, const char *key, +evas_image_load_file_head_ico(void *loader_data, Evas_Image_Property *prop, - Evas_Image_Load_Opts *opts, - Evas_Image_Animated *animated EINA_UNUSED, int *error) { + Evas_Loader_Internal *loader = loader_data; + Evas_Image_Load_Opts *opts; + const char *key; + Eina_File *f; + void *map = NULL; size_t position = 0; unsigned short word; @@ -94,6 +136,10 @@ evas_image_load_file_head_ico(Eina_File *f, const char *key, } chosen = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; Eina_Bool r = EINA_FALSE; + opts = loader->opts; + f = loader->f; + key = loader->key; + *error = EVAS_LOAD_ERROR_UNKNOWN_FORMAT; fsize = eina_file_size_get(f); if (fsize < (6 + 16 + 40)) goto close_file; @@ -288,13 +334,16 @@ evas_image_load_file_head_ico(Eina_File *f, const char *key, } static Eina_Bool -evas_image_load_file_data_ico(Eina_File *f, const char *key, - Evas_Image_Property *prop, - Evas_Image_Load_Opts *opts, - Evas_Image_Animated *animated EINA_UNUSED, - void *pixels, +evas_image_load_file_data_ico(void *loader_data, + Evas_Image_Property *prop, + void *pixels, int *error) { + Evas_Loader_Internal *loader = loader_data; + Evas_Image_Load_Opts *opts; + const char *key; + Eina_File *f; + void *map = NULL; size_t position = 0; unsigned short word; @@ -317,6 +366,10 @@ evas_image_load_file_data_ico(Eina_File *f, const char *key, } chosen = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; Eina_Bool res = EINA_FALSE; + opts = loader->opts; + key = loader->key; + f = loader->f; + *error = EVAS_LOAD_ERROR_UNKNOWN_FORMAT; fsize = eina_file_size_get(f); if (fsize < (6 + 16 + 40)) goto close_file; @@ -753,6 +806,8 @@ evas_image_load_file_data_ico(Eina_File *f, const char *key, static Evas_Image_Load_Func evas_image_load_ico_func = { EINA_TRUE, + evas_image_load_file_open_ico, + evas_image_load_file_close_ico, evas_image_load_file_head_ico, evas_image_load_file_data_ico, NULL, diff --git a/src/modules/evas/loaders/jpeg/evas_image_load_jpeg.c b/src/modules/evas/loaders/jpeg/evas_image_load_jpeg.c index 5417e4aa2d..6a440842e5 100644 --- a/src/modules/evas/loaders/jpeg/evas_image_load_jpeg.c +++ b/src/modules/evas/loaders/jpeg/evas_image_load_jpeg.c @@ -14,7 +14,6 @@ #include "evas_common.h" #include "evas_private.h" - typedef struct _JPEG_error_mgr *emptr; struct _JPEG_error_mgr { @@ -22,6 +21,14 @@ struct _JPEG_error_mgr jmp_buf setjmp_buffer; }; +typedef struct _Evas_Loader_Internal Evas_Loader_Internal; +struct _Evas_Loader_Internal +{ + Eina_File *f; + Evas_Image_Load_Opts *opts; +}; + + static void _JPEGFatalErrorHandler(j_common_ptr cinfo); static void _JPEGErrorHandler(j_common_ptr cinfo); static void _JPEGErrorHandler2(j_common_ptr cinfo, int msg_level); @@ -1213,17 +1220,52 @@ evas_image_load_file_data_jpeg_alpha_internal(Image_Entry *ie, FILE *f, int *err } #endif -static Eina_Bool -evas_image_load_file_head_jpeg(Eina_File *f, const char *key EINA_UNUSED, Evas_Image_Property *prop, Evas_Image_Load_Opts *opts, Evas_Image_Animated *animated EINA_UNUSED, int *error) +static void * +evas_image_load_file_open_jpeg(Eina_File *f, const char *key EINA_UNUSED, + Evas_Image_Load_Opts *opts, + Evas_Image_Animated *animated EINA_UNUSED, + int *error) { + Evas_Loader_Internal *loader; + + loader = calloc(1, sizeof (Evas_Loader_Internal)); + if (!loader) + { + *error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED; + return NULL; + } + + loader->f = f; + loader->opts = opts; + + return loader; +} + +static void +evas_image_load_file_close_jpeg(void *loader_data) +{ + free(loader_data); +} + +static Eina_Bool +evas_image_load_file_head_jpeg(void *loader_data, + Evas_Image_Property *prop, + int *error) +{ + Evas_Loader_Internal *loader = loader_data; + Evas_Image_Load_Opts *opts; + Eina_File *f; void *map; - Eina_Bool val = EINA_FALSE; + Eina_Bool val; + + opts = loader->opts; + f = loader->f; map = eina_file_map_all(f, EINA_FILE_WILLNEED); if (!map) { *error = EVAS_LOAD_ERROR_DOES_NOT_EXIST; - goto on_error; + return EINA_FALSE; } val = evas_image_load_file_head_jpeg_internal(&prop->w, &prop->h, @@ -1234,21 +1276,24 @@ evas_image_load_file_head_jpeg(Eina_File *f, const char *key EINA_UNUSED, Evas_I eina_file_map_free(f, map); - on_error: return val; } static Eina_Bool -evas_image_load_file_data_jpeg(Eina_File *f, const char *key EINA_UNUSED, - Evas_Image_Property *prop, - Evas_Image_Load_Opts *opts, - Evas_Image_Animated *animated EINA_UNUSED, +evas_image_load_file_data_jpeg(void *loader_data, + Evas_Image_Property *prop, void *pixels, int *error) { + Evas_Loader_Internal *loader = loader_data; + Evas_Image_Load_Opts *opts; + Eina_File *f; void *map; Eina_Bool val = EINA_FALSE; + f = loader->f; + opts = loader->opts; + map = eina_file_map_all(f, EINA_FILE_WILLNEED); if (!map) { @@ -1269,6 +1314,8 @@ evas_image_load_file_data_jpeg(Eina_File *f, const char *key EINA_UNUSED, static Evas_Image_Load_Func evas_image_load_jpeg_func = { EINA_TRUE, + evas_image_load_file_open_jpeg, + evas_image_load_file_close_jpeg, evas_image_load_file_head_jpeg, evas_image_load_file_data_jpeg, NULL, diff --git a/src/modules/evas/loaders/pmaps/evas_image_load_pmaps.c b/src/modules/evas/loaders/pmaps/evas_image_load_pmaps.c index 01eeb4125b..877b6ee5f7 100644 --- a/src/modules/evas/loaders/pmaps/evas_image_load_pmaps.c +++ b/src/modules/evas/loaders/pmaps/evas_image_load_pmaps.c @@ -55,13 +55,26 @@ static size_t pmaps_buffer_plain_update(Pmaps_Buffer *b); static size_t pmaps_buffer_raw_update(Pmaps_Buffer *b); static int pmaps_buffer_comment_skip(Pmaps_Buffer *b); +static void * +evas_image_load_file_open_pmaps(Eina_File *f, const char *key EINA_UNUSED, + Evas_Image_Load_Opts *opts EINA_UNUSED, + Evas_Image_Animated *animated EINA_UNUSED, + int *error EINA_UNUSED) +{ + return f; +} + +static void +evas_image_load_file_close_pmaps(void *loader_data EINA_UNUSED) +{ +} + static Eina_Bool -evas_image_load_file_head_pmaps(Eina_File *f, const char *key EINA_UNUSED, +evas_image_load_file_head_pmaps(void *loader_data, Evas_Image_Property *prop, - Evas_Image_Load_Opts *opts EINA_UNUSED, - Evas_Image_Animated *animated EINA_UNUSED, int *error) { + Eina_File *f = loader_data; Pmaps_Buffer b; if (!pmaps_buffer_open(&b, f, error)) @@ -85,13 +98,12 @@ evas_image_load_file_head_pmaps(Eina_File *f, const char *key EINA_UNUSED, } static Eina_Bool -evas_image_load_file_data_pmaps(Eina_File *f, const char *key EINA_UNUSED, +evas_image_load_file_data_pmaps(void *loader_data, Evas_Image_Property *prop, - Evas_Image_Load_Opts *opts EINA_UNUSED, - Evas_Image_Animated *animated EINA_UNUSED, void *pixels, int *error) { + Eina_File *f = loader_data; Pmaps_Buffer b; int size; DATA32 *ptr; @@ -544,6 +556,8 @@ pmaps_buffer_plain_bw_get(Pmaps_Buffer *b, DATA32 *val) /* external functions */ Evas_Image_Load_Func evas_image_load_pmaps_func = { EINA_TRUE, + evas_image_load_file_open_pmaps, + evas_image_load_file_close_pmaps, evas_image_load_file_head_pmaps, evas_image_load_file_data_pmaps, NULL, diff --git a/src/modules/evas/loaders/png/evas_image_load_png.c b/src/modules/evas/loaders/png/evas_image_load_png.c index 9ea8077a1c..306a373011 100644 --- a/src/modules/evas/loaders/png/evas_image_load_png.c +++ b/src/modules/evas/loaders/png/evas_image_load_png.c @@ -23,6 +23,13 @@ struct _Evas_PNG_Info size_t position; }; +typedef struct _Evas_Loader_Internal Evas_Loader_Internal; +struct _Evas_Loader_Internal +{ + Eina_File *f; + Evas_Image_Load_Opts *opts; +}; + static void _evas_image_png_read(png_structp png_ptr, png_bytep out, png_size_t count) { @@ -36,13 +43,41 @@ _evas_image_png_read(png_structp png_ptr, png_bytep out, png_size_t count) epi->position += count; } -static Eina_Bool -evas_image_load_file_head_png(Eina_File *f, const char *key EINA_UNUSED, - Evas_Image_Property *prop, - Evas_Image_Load_Opts *opts, - Evas_Image_Animated *animated EINA_UNUSED, - int *error) +static void * +evas_image_load_file_open_png(Eina_File *f, const char *key EINA_UNUSED, + Evas_Image_Load_Opts *opts, + Evas_Image_Animated *animated EINA_UNUSED, + int *error) { + Evas_Loader_Internal *loader; + + loader = calloc(1, sizeof (Evas_Loader_Internal)); + if (!loader) + { + *error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED; + return NULL; + } + + loader->f = f; + loader->opts = opts; + return loader; +} + +static void +evas_image_load_file_close_png(void *loader_data) +{ + free(loader_data); +} + +static Eina_Bool +evas_image_load_file_head_png(void *loader_data, + Evas_Image_Property *prop, + int *error) +{ + Evas_Loader_Internal *loader = loader_data; + Evas_Image_Load_Opts *opts; + Eina_File *f; + Evas_PNG_Info epi; png_structp png_ptr = NULL; png_infop info_ptr = NULL; @@ -51,6 +86,9 @@ evas_image_load_file_head_png(Eina_File *f, const char *key EINA_UNUSED, char hasa; Eina_Bool r = EINA_FALSE; + opts = loader->opts; + f = loader->f; + hasa = 0; epi.map = eina_file_map_all(f, EINA_FILE_SEQUENTIAL); if (!epi.map) @@ -141,13 +179,15 @@ evas_image_load_file_head_png(Eina_File *f, const char *key EINA_UNUSED, } static Eina_Bool -evas_image_load_file_data_png(Eina_File *f, const char *key EINA_UNUSED, - Evas_Image_Property *prop, - Evas_Image_Load_Opts *opts, - Evas_Image_Animated *animated EINA_UNUSED, - void *pixels, +evas_image_load_file_data_png(void *loader_data, + Evas_Image_Property *prop, + void *pixels, int *error) { + Evas_Loader_Internal *loader = loader_data; + Evas_Image_Load_Opts *opts; + Eina_File *f; + unsigned char *surface; unsigned char **lines; unsigned char *tmp_line; @@ -163,6 +203,9 @@ evas_image_load_file_data_png(Eina_File *f, const char *key EINA_UNUSED, int scale_ratio = 1, image_w = 0; Eina_Bool r = EINA_FALSE; + opts = loader->opts; + f = loader->f; + hasa = 0; epi.map = eina_file_map_all(f, EINA_FILE_SEQUENTIAL); @@ -309,6 +352,8 @@ evas_image_load_file_data_png(Eina_File *f, const char *key EINA_UNUSED, static Evas_Image_Load_Func evas_image_load_png_func = { EINA_TRUE, + evas_image_load_file_open_png, + evas_image_load_file_close_png, evas_image_load_file_head_png, evas_image_load_file_data_png, NULL, diff --git a/src/modules/evas/loaders/psd/evas_image_load_psd.c b/src/modules/evas/loaders/psd/evas_image_load_psd.c index ebb592ac73..b064217290 100644 --- a/src/modules/evas/loaders/psd/evas_image_load_psd.c +++ b/src/modules/evas/loaders/psd/evas_image_load_psd.c @@ -146,13 +146,26 @@ is_psd(PSD_Header *header) return EINA_TRUE; } -static Eina_Bool -evas_image_load_file_head_psd(Eina_File *f, const char *key EINA_UNUSED, - Evas_Image_Property *prop, +static void * +evas_image_load_file_open_psd(Eina_File *f, const char *key EINA_UNUSED, Evas_Image_Load_Opts *opts EINA_UNUSED, Evas_Image_Animated *animated EINA_UNUSED, + int *error EINA_UNUSED) +{ + return f; +} + +static void +evas_image_load_file_close_psd(void *loader_data EINA_UNUSED) +{ +} + +static Eina_Bool +evas_image_load_file_head_psd(void *loader_data, + Evas_Image_Property *prop, int *error) { + Eina_File *f = loader_data; void *map; size_t length; size_t position; @@ -797,13 +810,13 @@ read_psd_cmyk(Evas_Image_Property *prop, void *pixels, PSD_Header *head, const u } static Eina_Bool -evas_image_load_file_data_psd(Eina_File *f, const char *key EINA_UNUSED, +evas_image_load_file_data_psd(void *loader_data, Evas_Image_Property *prop, - Evas_Image_Load_Opts *opts EINA_UNUSED, - Evas_Image_Animated *animated EINA_UNUSED, void *pixels, int *error) { + Eina_File *f = loader_data; + void *map; size_t length; size_t position; @@ -884,6 +897,8 @@ get_compressed_channels_length(PSD_Header *head, static const Evas_Image_Load_Func evas_image_load_psd_func = { EINA_TRUE, + evas_image_load_file_open_psd, + evas_image_load_file_close_psd, evas_image_load_file_head_psd, evas_image_load_file_data_psd, NULL, diff --git a/src/modules/evas/loaders/tga/evas_image_load_tga.c b/src/modules/evas/loaders/tga/evas_image_load_tga.c index 8998efc6df..acc527d3b1 100644 --- a/src/modules/evas/loaders/tga/evas_image_load_tga.c +++ b/src/modules/evas/loaders/tga/evas_image_load_tga.c @@ -56,13 +56,26 @@ struct _tga_footer char null; } __attribute__((packed)); -static Eina_Bool -evas_image_load_file_head_tga(Eina_File *f, const char *key EINA_UNUSED, - Evas_Image_Property *prop, +static void * +evas_image_load_file_open_tga(Eina_File *f, const char *key EINA_UNUSED, Evas_Image_Load_Opts *opts EINA_UNUSED, Evas_Image_Animated *animated EINA_UNUSED, + int *error EINA_UNUSED) +{ + return f; +} + +static void +evas_image_load_file_close_tga(void *loader_data EINA_UNUSED) +{ +} + +static Eina_Bool +evas_image_load_file_head_tga(void *loader_data, + Evas_Image_Property *prop, int *error) { + Eina_File *f = loader_data; unsigned char *seg = NULL, *filedata; tga_header *header; tga_footer *footer, tfooter; @@ -153,13 +166,12 @@ close_file: } static Eina_Bool -evas_image_load_file_data_tga(Eina_File *f, const char *key EINA_UNUSED, +evas_image_load_file_data_tga(void *loader_data, Evas_Image_Property *prop, - Evas_Image_Load_Opts *opts EINA_UNUSED, - Evas_Image_Animated *animated EINA_UNUSED, void *pixels, int *error) { + Eina_File *f = loader_data; unsigned char *seg = NULL, *filedata; tga_header *header; tga_footer *footer, tfooter; @@ -540,6 +552,8 @@ evas_image_load_file_data_tga(Eina_File *f, const char *key EINA_UNUSED, static Evas_Image_Load_Func evas_image_load_tga_func = { EINA_TRUE, + evas_image_load_file_open_tga, + evas_image_load_file_close_tga, evas_image_load_file_head_tga, evas_image_load_file_data_tga, NULL, diff --git a/src/modules/evas/loaders/tiff/evas_image_load_tiff.c b/src/modules/evas/loaders/tiff/evas_image_load_tiff.c index 9462b390e5..03f253c051 100644 --- a/src/modules/evas/loaders/tiff/evas_image_load_tiff.c +++ b/src/modules/evas/loaders/tiff/evas_image_load_tiff.c @@ -84,13 +84,26 @@ _evas_tiff_UnmapProc(thandle_t handle, tdata_t data, toff_t size EINA_UNUSED) eina_file_map_free(f, data); } -static Eina_Bool -evas_image_load_file_head_tiff(Eina_File *f, const char *key EINA_UNUSED, - Evas_Image_Property *prop, +static void * +evas_image_load_file_open_tiff(Eina_File *f, const char *key EINA_UNUSED, Evas_Image_Load_Opts *opts EINA_UNUSED, Evas_Image_Animated *animated EINA_UNUSED, + int *error EINA_UNUSED) +{ + return f; +} + +static void +evas_image_load_file_close_tiff(void *loader_data EINA_UNUSED) +{ +} + +static Eina_Bool +evas_image_load_file_head_tiff(void *loader_data, + Evas_Image_Property *prop, int *error) { + Eina_File *f = loader_data; char txt[1024]; TIFFRGBAImage tiff_image; TIFF *tif = NULL; @@ -165,13 +178,12 @@ evas_image_load_file_head_tiff(Eina_File *f, const char *key EINA_UNUSED, } static Eina_Bool -evas_image_load_file_data_tiff(Eina_File *f, const char *key EINA_UNUSED, +evas_image_load_file_data_tiff(void *loader_data, Evas_Image_Property *prop, - Evas_Image_Load_Opts *opts EINA_UNUSED, - Evas_Image_Animated *animated EINA_UNUSED, - void *pixels, + void *pixels, int *error) { + Eina_File *f = loader_data; char txt[1024]; TIFFRGBAImage_Extra rgba_image; TIFF *tif = NULL; @@ -310,6 +322,8 @@ evas_image_load_file_data_tiff(Eina_File *f, const char *key EINA_UNUSED, static Evas_Image_Load_Func evas_image_load_tiff_func = { EINA_TRUE, + evas_image_load_file_open_tiff, + evas_image_load_file_close_tiff, evas_image_load_file_head_tiff, evas_image_load_file_data_tiff, NULL, diff --git a/src/modules/evas/loaders/wbmp/evas_image_load_wbmp.c b/src/modules/evas/loaders/wbmp/evas_image_load_wbmp.c index b06aa043a9..1f014a904d 100644 --- a/src/modules/evas/loaders/wbmp/evas_image_load_wbmp.c +++ b/src/modules/evas/loaders/wbmp/evas_image_load_wbmp.c @@ -29,13 +29,26 @@ read_mb(unsigned int *data, void *map, size_t length, size_t *position) return 0; } -static Eina_Bool -evas_image_load_file_head_wbmp(Eina_File *f, const char *key EINA_UNUSED, - Evas_Image_Property *prop, +static void * +evas_image_load_file_open_wbmp(Eina_File *f, const char *key EINA_UNUSED, Evas_Image_Load_Opts *opts EINA_UNUSED, Evas_Image_Animated *animated EINA_UNUSED, + int *error EINA_UNUSED) +{ + return f; +} + +static void +evas_image_load_file_close_wbmp(void *loader_data EINA_UNUSED) +{ +} + +static Eina_Bool +evas_image_load_file_head_wbmp(void *loader_data, + Evas_Image_Property *prop, int *error) { + Eina_File *f = loader_data; void *map = NULL; size_t position = 0; size_t length; @@ -79,13 +92,12 @@ evas_image_load_file_head_wbmp(Eina_File *f, const char *key EINA_UNUSED, } static Eina_Bool -evas_image_load_file_data_wbmp(Eina_File *f, const char *key EINA_UNUSED, +evas_image_load_file_data_wbmp(void *loader_data, Evas_Image_Property *prop, - Evas_Image_Load_Opts *opts EINA_UNUSED, - Evas_Image_Animated *animated EINA_UNUSED, void *pixels, int *error) { + Eina_File *f = loader_data; void *map = NULL; size_t position = 0; size_t length; @@ -157,6 +169,8 @@ evas_image_load_file_data_wbmp(Eina_File *f, const char *key EINA_UNUSED, static Evas_Image_Load_Func evas_image_load_wbmp_func = { EINA_TRUE, + evas_image_load_file_open_wbmp, + evas_image_load_file_close_wbmp, evas_image_load_file_head_wbmp, evas_image_load_file_data_wbmp, NULL, diff --git a/src/modules/evas/loaders/webp/evas_image_load_webp.c b/src/modules/evas/loaders/webp/evas_image_load_webp.c index ab4eb27f1b..28a28a3b59 100644 --- a/src/modules/evas/loaders/webp/evas_image_load_webp.c +++ b/src/modules/evas/loaders/webp/evas_image_load_webp.c @@ -40,13 +40,26 @@ evas_image_load_file_check(Eina_File *f, void *map, return EINA_TRUE; } -static Eina_Bool -evas_image_load_file_head_webp(Eina_File *f, const char *key EINA_UNUSED, - Evas_Image_Property *prop, +static void * +evas_image_load_file_open_webp(Eina_File *f, const char *key EINA_UNUSED, Evas_Image_Load_Opts *opts EINA_UNUSED, Evas_Image_Animated *animated EINA_UNUSED, + int *error EINA_UNUSED) +{ + return f; +} + +static void +evas_image_load_file_close_webp(void *loader_data EINA_UNUSED) +{ +} + +static Eina_Bool +evas_image_load_file_head_webp(void *loader_data, + Evas_Image_Property *prop, int *error) { + Eina_File *f = loader_data; Eina_Bool r; void *data; @@ -63,13 +76,12 @@ evas_image_load_file_head_webp(Eina_File *f, const char *key EINA_UNUSED, } static Eina_Bool -evas_image_load_file_data_webp(Eina_File *f, const char *key EINA_UNUSED, +evas_image_load_file_data_webp(void *loader_data, Evas_Image_Property *prop, - Evas_Image_Load_Opts *opts EINA_UNUSED, - Evas_Image_Animated *animated EINA_UNUSED, void *pixels, int *error) { + Eina_File *f = loader_data; void *data = NULL; void *decoded = NULL; void *surface = NULL; @@ -105,6 +117,8 @@ evas_image_load_file_data_webp(Eina_File *f, const char *key EINA_UNUSED, static Evas_Image_Load_Func evas_image_load_webp_func = { EINA_TRUE, + evas_image_load_file_open_webp, + evas_image_load_file_close_webp, evas_image_load_file_head_webp, evas_image_load_file_data_webp, NULL, diff --git a/src/modules/evas/loaders/xpm/evas_image_load_xpm.c b/src/modules/evas/loaders/xpm/evas_image_load_xpm.c index 0f8b917306..301fa90efe 100644 --- a/src/modules/evas/loaders/xpm/evas_image_load_xpm.c +++ b/src/modules/evas/loaders/xpm/evas_image_load_xpm.c @@ -648,30 +648,46 @@ evas_image_load_file_xpm(Eina_File *f, Evas_Image_Property *prop, void *pixels, return res; } -static Eina_Bool -evas_image_load_file_head_xpm(Eina_File *f, const char *key EINA_UNUSED, - Evas_Image_Property *prop, +static void * +evas_image_load_file_open_xpm(Eina_File *f, const char *key EINA_UNUSED, Evas_Image_Load_Opts *opts EINA_UNUSED, Evas_Image_Animated *animated EINA_UNUSED, + int *error EINA_UNUSED) +{ + return f; +} + +static void +evas_image_load_file_close_xpm(void *loader_data EINA_UNUSED) +{ +} + +static Eina_Bool +evas_image_load_file_head_xpm(void *loader_data, + Evas_Image_Property *prop, int *error) { + Eina_File *f = loader_data; + return evas_image_load_file_xpm(f, prop, NULL, 0, error); } static Eina_Bool -evas_image_load_file_data_xpm(Eina_File *f, const char *key EINA_UNUSED, +evas_image_load_file_data_xpm(void *loader_data, Evas_Image_Property *prop, - Evas_Image_Load_Opts *opts EINA_UNUSED, - Evas_Image_Animated *animated EINA_UNUSED, void *pixels, int *error) { + Eina_File *f = loader_data; + return evas_image_load_file_xpm(f, prop, pixels, 1, error); } static Evas_Image_Load_Func evas_image_load_xpm_func = { EINA_FALSE, + evas_image_load_file_open_xpm, + evas_image_load_file_close_xpm, evas_image_load_file_head_xpm, evas_image_load_file_data_xpm, NULL,