evas: Make Evas_Loader API public.

This commit is contained in:
Cedric Bail 2013-05-07 10:50:57 +09:00
parent 559b1b3301
commit c3f9d3b8b8
28 changed files with 118 additions and 108 deletions

View File

@ -10,7 +10,8 @@ lib/evas/Evas.h \
lib/evas/Evas_Common_Header.h \
lib/evas/Evas_Eo.h \
lib/evas/Evas_Legacy.h \
lib/evas/Evas_GL.h
lib/evas/Evas_GL.h \
lib/evas/Evas_Loader.h
noinst_HEADERS = \
lib/evas/include/evas_inline.x \

View File

@ -0,0 +1,77 @@
#ifndef _EVAS_LOADER_H
#define _EVAS_LOADER_H
#include <Eina.h>
typedef struct _Evas_Image_Load_Opts Evas_Image_Load_Opts;
typedef struct _Evas_Image_Animated Evas_Image_Animated;
typedef struct _Evas_Image_Property Evas_Image_Property;
typedef struct _Evas_Image_Load_Func Evas_Image_Load_Func;
struct _Evas_Image_Property
{
unsigned int w;
unsigned int h;
unsigned char scale;
Eina_Bool rotated;
Eina_Bool alpha;
Eina_Bool premul;
Eina_Bool alpha_sparse;
};
struct _Evas_Image_Animated
{
Eina_List *frames;
Evas_Image_Animated_Loop_Hint loop_hint;
int frame_count;
int loop_count;
int cur_frame;
Eina_Bool animated;
};
struct _Evas_Image_Load_Opts
{
struct {
unsigned int x, y, w, h;
} region;
struct {
int src_x, src_y, src_w, src_h;
int dst_w, dst_h;
int smooth;
Evas_Image_Scale_Hint scale_hint;
} scale_load;
double dpi; // if > 0.0 use this
unsigned int w, h; // if > 0 use this
unsigned int degree;//if>0 there is some info related with rotation
int scale_down_by; // if > 1 then use this
Eina_Bool orientation; // if EINA_TRUE => should honor orientation information provided by file (like jpeg exif info)
};
struct _Evas_Image_Load_Func
{
void *(*file_open) (Eina_File *f, const char *key,
Evas_Image_Load_Opts *opts,
Evas_Image_Animated *animated,
int *error);
void (*file_close) (void *loader_data);
Eina_Bool (*file_head) (void *loader_data,
Evas_Image_Property *prop,
int *error);
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 threadable;
Eina_Bool do_region;
};
#endif

View File

@ -65,7 +65,7 @@ struct _Evas_Cache_Image
struct _Evas_Cache_Engine_Image_Func
{
/* Must return a char* allocated with eina_stringshare_add. */
char* (*key)(Image_Entry *im, const char *file, const char *key, RGBA_Image_Loadopts *lo, int *error);
char* (*key)(Image_Entry *im, const char *file, const char *key, Evas_Image_Load_Opts *lo, int *error);
Engine_Image_Entry* (*alloc)(void);
void (*dealloc)(Engine_Image_Entry *eim);
@ -113,7 +113,7 @@ extern "C" {
EAPI Evas_Cache_Image* evas_cache_image_init(const Evas_Cache_Image_Func *cb);
EAPI void evas_cache_image_shutdown(Evas_Cache_Image *cache);
EAPI Image_Entry* evas_cache_image_request(Evas_Cache_Image *cache, const char *file, const char *key, RGBA_Image_Loadopts *lo, int *error);
EAPI Image_Entry* evas_cache_image_request(Evas_Cache_Image *cache, const char *file, const char *key, Evas_Image_Load_Opts *lo, int *error);
EAPI void evas_cache_image_ref(Image_Entry *im);
EAPI void evas_cache_image_drop(Image_Entry *im);
EAPI void evas_cache_image_data_not_needed(Image_Entry *im);
@ -147,7 +147,7 @@ EAPI int evas_cache_engine_image_usage_get(Evas_Cache_Engin
EAPI int evas_cache_engine_image_get(Evas_Cache_Engine_Image *cache);
EAPI void evas_cache_engine_image_set(Evas_Cache_Engine_Image *cache, int limit);
EAPI Engine_Image_Entry* evas_cache_engine_image_request(Evas_Cache_Engine_Image *cache, const char *file, const char *key, RGBA_Image_Loadopts *lo, void *engine_data, int *error);
EAPI Engine_Image_Entry* evas_cache_engine_image_request(Evas_Cache_Engine_Image *cache, const char *file, const char *key, Evas_Image_Load_Opts *lo, void *engine_data, int *error);
EAPI void evas_cache_engine_parent_not_needed(Engine_Image_Entry *eim);
EAPI Engine_Image_Entry* evas_cache_engine_image_engine(Evas_Cache_Engine_Image *cache, void *engine_data);
EAPI void evas_cache_engine_image_drop(Engine_Image_Entry *eim);

View File

@ -301,7 +301,7 @@ evas_cache_engine_image_shutdown(Evas_Cache_Engine_Image *cache)
EAPI Engine_Image_Entry *
evas_cache_engine_image_request(Evas_Cache_Engine_Image *cache,
const char *file, const char *key,
RGBA_Image_Loadopts *lo, void *data, int *error)
Evas_Image_Load_Opts *lo, void *data, int *error)
{
Engine_Image_Entry *eim;
Image_Entry *im;

View File

@ -215,7 +215,7 @@ _evas_cache_image_entry_new(Evas_Cache_Image *cache,
Image_Timestamp *tstamp,
const char *file,
const char *key,
RGBA_Image_Loadopts *lo,
Evas_Image_Load_Opts *lo,
int *error)
{
Image_Entry *ie;
@ -565,7 +565,7 @@ evas_cache_image_shutdown(Evas_Cache_Image *cache)
EAPI Image_Entry *
evas_cache_image_request(Evas_Cache_Image *cache, const char *file,
const char *key, RGBA_Image_Loadopts *lo, int *error)
const char *key, Evas_Image_Load_Opts *lo, int *error)
{
const char *ckey = "(null)";
char *hkey;

View File

@ -222,7 +222,7 @@ _evas_cache_image_entry_new(Evas_Cache2 *cache,
Image_Timestamp *tstamp,
const char *file,
const char *key,
RGBA_Image_Loadopts *lo,
Evas_Image_Load_Opts *lo,
int *error)
{
Image_Entry *ie;
@ -534,7 +534,7 @@ evas_cache2_shutdown(Evas_Cache2 *cache)
}
static void
_create_hash_key(char *hkey, const char *path, size_t pathlen, const char *key, size_t keylen, RGBA_Image_Loadopts *lo)
_create_hash_key(char *hkey, const char *path, size_t pathlen, const char *key, size_t keylen, Evas_Image_Load_Opts *lo)
{
const char *ckey = "(null)";
size_t size;
@ -618,7 +618,7 @@ _create_hash_key(char *hkey, const char *path, size_t pathlen, const char *key,
}
EAPI Image_Entry *
evas_cache2_image_open(Evas_Cache2 *cache, const char *path, const char *key, RGBA_Image_Loadopts *lo, int *error)
evas_cache2_image_open(Evas_Cache2 *cache, const char *path, const char *key, Evas_Image_Load_Opts *lo, int *error)
{
size_t size;
size_t pathlen;
@ -628,8 +628,7 @@ evas_cache2_image_open(Evas_Cache2 *cache, const char *path, const char *key, RG
int stat_done = 0, stat_failed = 0;
struct stat st;
Image_Timestamp tstamp;
Evas_Image_Load_Opts prevent = { 0, 0.0, 0, 0, 0, { 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0 }, EINA_FALSE };
Evas_Image_Load_Opts prevent;
if ((!path) || ((!path) && (!key)))
{
@ -637,6 +636,8 @@ evas_cache2_image_open(Evas_Cache2 *cache, const char *path, const char *key, RG
return NULL;
}
memset(&prevent, 0, sizeof (Evas_Image_Load_Opts));
pathlen = strlen(path);
keylen = key ? strlen(key) : 6;
size = pathlen + keylen + HKEY_LOAD_OPTS_STR_LEN;
@ -775,7 +776,7 @@ _scaled_image_find(Image_Entry *im, int src_x, int src_y, int src_w, int src_h,
{
size_t pathlen, keylen, size;
char *hkey;
RGBA_Image_Loadopts lo;
Evas_Image_Load_Opts lo;
Image_Entry *ret;
if (((!im->file) || ((!im->file) && (!im->key))) || (!im->data1) ||
@ -837,7 +838,7 @@ evas_cache2_image_scale_load(Image_Entry *im, int src_x, int src_y, int src_w, i
{
size_t pathlen, keylen, size;
char *hkey;
RGBA_Image_Loadopts lo;
Evas_Image_Load_Opts lo;
int error = EVAS_LOAD_ERROR_NONE;
Image_Entry *ret;

View File

@ -58,7 +58,7 @@ extern "C" {
EAPI Evas_Cache2* evas_cache2_init(const Evas_Cache2_Image_Func *cb);
EAPI void evas_cache2_shutdown(Evas_Cache2 *cache);
EAPI Image_Entry * evas_cache2_image_open(Evas_Cache2 *cache, const char *path, const char *key, RGBA_Image_Loadopts *lo, int *error);
EAPI Image_Entry * evas_cache2_image_open(Evas_Cache2 *cache, const char *path, const char *key, Evas_Image_Load_Opts *lo, int *error);
EAPI Image_Entry *evas_cache2_image_scale_load(Image_Entry *im, int src_x, int src_y, int src_w, int src_h, int dst_w, int dst_h, int smooth);
EAPI int evas_cache2_image_open_wait(Image_Entry *im);
EAPI void evas_cache2_image_ref(Image_Entry *im);

View File

@ -32,7 +32,7 @@ EAPI RGBA_Image *evas_common_image_alpha_line_buffer_obtain (int len);
EAPI void evas_common_image_alpha_line_buffer_release (RGBA_Image *im);
EAPI void evas_common_image_alpha_line_buffer_free (RGBA_Image *im);
EAPI RGBA_Image *evas_common_load_image_from_file (const char *file, const char *key, RGBA_Image_Loadopts *lo, int *error);
EAPI RGBA_Image *evas_common_load_image_from_file (const char *file, const char *key, Evas_Image_Load_Opts *lo, int *error);
EAPI int evas_common_save_image_to_file (RGBA_Image *im, const char *file, const char *key, int quality, int compress);
EAPI void evas_common_rgba_image_scalecache_init(Image_Entry *ie);

View File

@ -755,7 +755,7 @@ evas_common_image_get_cache(void)
}
EAPI RGBA_Image *
evas_common_load_image_from_file(const char *file, const char *key, RGBA_Image_Loadopts *lo, int *error)
evas_common_load_image_from_file(const char *file, const char *key, Evas_Image_Load_Opts *lo, int *error)
{
if (!file)
{

View File

@ -483,7 +483,7 @@ _build_absolute_path(const char *path, char buf[], int size)
}
static unsigned int
_image_open_server_send(Image_Entry *ie, const char *file, const char *key, RGBA_Image_Loadopts *lopt EINA_UNUSED)
_image_open_server_send(Image_Entry *ie, const char *file, const char *key, Evas_Image_Load_Opts *lopt EINA_UNUSED)
{
int flen, klen;
int size;
@ -727,7 +727,7 @@ _image_unload_server_send(Image_Entry *ie)
}
Eina_Bool
evas_cserve2_image_load(Image_Entry *ie, const char *file, const char *key, RGBA_Image_Loadopts *lopt)
evas_cserve2_image_load(Image_Entry *ie, const char *file, const char *key, Evas_Image_Load_Opts *lopt)
{
unsigned int rid;

View File

@ -23,7 +23,7 @@ typedef struct _Font_Entry Font_Entry;
int evas_cserve2_init(void);
int evas_cserve2_shutdown(void);
EAPI int evas_cserve2_use_get(void);
Eina_Bool evas_cserve2_image_load(Image_Entry *ie, const char *file, const char *key, RGBA_Image_Loadopts *lopt);
Eina_Bool evas_cserve2_image_load(Image_Entry *ie, const char *file, const char *key, Evas_Image_Load_Opts *lopt);
int evas_cserve2_image_load_wait(Image_Entry *ie);
Eina_Bool evas_cserve2_image_data_load(Image_Entry *ie);
void evas_cserve2_image_load_data_wait(Image_Entry *ie);

View File

@ -50,6 +50,7 @@
#include <Eina.h>
#include "Evas.h"
//#include "Evas_GL.h"
#include "Evas_Loader.h"
#ifndef HAVE_LROUND
/* right now i dont care about rendering bugs on platforms without lround
@ -352,8 +353,6 @@ typedef unsigned short DATA16;
typedef unsigned char DATA8;
typedef struct _Image_Entry Image_Entry;
typedef struct _Image_Entry_Property Image_Entry_Property;
typedef struct _Image_Entry_Animated Image_Entry_Animated;
typedef struct _Image_Entry_Flags Image_Entry_Flags;
typedef struct _Image_Entry_Frame Image_Entry_Frame;
typedef struct _Image_Timestamp Image_Timestamp;
@ -361,7 +360,6 @@ typedef struct _Engine_Image_Entry Engine_Image_Entry;
typedef struct _Evas_Cache_Target Evas_Cache_Target;
typedef struct _Evas_Preload_Pthread Evas_Preload_Pthread;
typedef struct _RGBA_Image_Loadopts RGBA_Image_Loadopts;
#ifdef BUILD_PIPE_RENDER
typedef struct _RGBA_Pipe_Op RGBA_Pipe_Op;
typedef struct _RGBA_Pipe RGBA_Pipe;
@ -495,25 +493,6 @@ typedef enum _Font_Rend_Flags
/*****************************************************************************/
struct _RGBA_Image_Loadopts
{
int scale_down_by; // if > 1 then use this
double dpi; // if > 0.0 use this
unsigned int w, h; // if > 0 use this
unsigned int degree;//if>0 there is some info related with rotation
struct {
unsigned int x, y, w, h;
} region;
struct {
int src_x, src_y, src_w, src_h;
int dst_w, dst_h;
int smooth;
Evas_Image_Scale_Hint scale_hint;
} scale_load;
Eina_Bool orientation; // if EINA_TRUE => should honor orientation information provided by file (like jpeg exif info)
};
struct _Image_Entry_Flags
{
Eina_Bool loaded : 1;
@ -544,17 +523,6 @@ struct _Image_Entry_Frame
Eina_Bool loaded : 1;
};
struct _Image_Entry_Animated
{
Eina_List *frames;
Evas_Image_Animated_Loop_Hint loop_hint;
int frame_count;
int loop_count;
int cur_frame;
Eina_Bool animated : 1;
};
struct _Evas_Cache_Target
{
EINA_INLIST;
@ -572,19 +540,6 @@ struct _Image_Timestamp
#endif
};
struct _Image_Entry_Property
{
unsigned int w;
unsigned int h;
unsigned char scale;
Eina_Bool rotated;
Eina_Bool alpha;
Eina_Bool premul;
Eina_Bool alpha_sparse;
};
struct _Image_Entry
{
EINA_INLIST;
@ -610,7 +565,7 @@ struct _Image_Entry
RGBA_Pipe *pipe;
#endif
RGBA_Image_Loadopts load_opts;
Evas_Image_Load_Opts load_opts;
int space;
unsigned int w;
@ -634,7 +589,7 @@ struct _Image_Entry
LK(lock_cancel);
/* for animation feature */
Image_Entry_Animated animated;
Evas_Image_Animated animated;
/* Reference to the file */
Eina_File *f;

View File

@ -9,6 +9,7 @@
#include <eina_safety_checks.h>
#include "Evas.h"
#include "Evas_Loader.h"
#include "../file/evas_module.h"
#include "../file/evas_path.h"
@ -32,11 +33,7 @@ typedef struct _Evas_Font Evas_Font;
typedef struct _Evas_Font_Alias Evas_Font_Alias;
typedef struct _Evas_Font_Description Evas_Font_Description;
typedef struct _Evas_Data_Node Evas_Data_Node;
typedef RGBA_Image_Loadopts Evas_Image_Load_Opts;
typedef Image_Entry_Animated Evas_Image_Animated;
typedef Image_Entry_Property Evas_Image_Property;
typedef struct _Evas_Func Evas_Func;
typedef struct _Evas_Image_Load_Func Evas_Image_Load_Func;
typedef struct _Evas_Image_Save_Func Evas_Image_Save_Func;
typedef struct _Evas_Object_Func Evas_Object_Func;
typedef struct _Evas_Intercept_Func Evas_Intercept_Func;
@ -900,27 +897,6 @@ struct _Evas_Func
Eina_Bool (*pixel_alpha_get) (void *image, int x, int y, DATA8 *alpha, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h);
};
struct _Evas_Image_Load_Func
{
Eina_Bool threadable;
void *(*file_open) (Eina_File *f, const char *key,
Evas_Image_Load_Opts *opts,
Evas_Image_Animated *animated,
int *error);
void (*file_close) (void *loader_data);
Eina_Bool (*file_head) (void *loader_data,
Evas_Image_Property *prop,
int *error);
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;
};
struct _Evas_Image_Save_Func
{
int (*image_save) (RGBA_Image *im, const char *file, const char *key, int quality, int compress);

View File

@ -467,7 +467,7 @@ struct _Evas_GL_Image
Evas_Engine_GL_Context *gc;
RGBA_Image *im;
Evas_GL_Texture *tex;
RGBA_Image_Loadopts load_opts;
Evas_Image_Load_Opts load_opts;
int references;
// if im->im == NULL, it's a render-surface so these here are used
int w, h;

View File

@ -1371,12 +1371,12 @@ evas_image_load_file_data_bmp(void *loader_data,
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,
EINA_TRUE,
EINA_FALSE
};

View File

@ -135,12 +135,12 @@ evas_image_load_file_data_eet(void *loader_data,
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,
EINA_TRUE,
EINA_FALSE
};

View File

@ -433,12 +433,12 @@ evas_image_load_file_data_generic(void *loader_data,
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,
EINA_TRUE,
EINA_FALSE
};

View File

@ -1113,12 +1113,12 @@ evas_image_load_frame_duration_gif(void *loader_data,
static Evas_Image_Load_Func evas_image_load_gif_func =
{
EINA_TRUE,
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_TRUE,
EINA_FALSE
};

View File

@ -805,12 +805,12 @@ evas_image_load_file_data_ico(void *loader_data,
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,
EINA_TRUE,
EINA_FALSE
};

View File

@ -1313,12 +1313,12 @@ evas_image_load_file_data_jpeg(void *loader_data,
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,
EINA_TRUE,
EINA_TRUE
};

View File

@ -555,12 +555,12 @@ 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,
EINA_TRUE,
EINA_FALSE
};

View File

@ -351,12 +351,12 @@ evas_image_load_file_data_png(void *loader_data,
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,
EINA_TRUE,
EINA_FALSE
};

View File

@ -896,12 +896,12 @@ 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,
EINA_TRUE,
EINA_FALSE
};

View File

@ -551,12 +551,12 @@ evas_image_load_file_data_tga(void *loader_data,
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,
EINA_TRUE,
EINA_FALSE
};

View File

@ -321,12 +321,12 @@ evas_image_load_file_data_tiff(void *loader_data,
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,
EINA_TRUE,
EINA_FALSE
};

View File

@ -168,12 +168,12 @@ evas_image_load_file_data_wbmp(void *loader_data,
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,
EINA_TRUE,
EINA_FALSE
};

View File

@ -116,12 +116,12 @@ evas_image_load_file_data_webp(void *loader_data,
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,
EINA_TRUE,
EINA_FALSE
};

View File

@ -685,12 +685,12 @@ evas_image_load_file_data_xpm(void *loader_data,
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,
EINA_FALSE,
EINA_FALSE
};