2008-07-10 09:38:54 -07:00
|
|
|
#ifndef _EVAS_CACHE_H
|
|
|
|
#define _EVAS_CACHE_H
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct _Evas_Cache_Image Evas_Cache_Image;
|
|
|
|
typedef struct _Evas_Cache_Image_Func Evas_Cache_Image_Func;
|
|
|
|
typedef struct _Evas_Cache_Engine_Image Evas_Cache_Engine_Image;
|
|
|
|
typedef struct _Evas_Cache_Engine_Image_Func Evas_Cache_Engine_Image_Func;
|
|
|
|
|
|
|
|
|
|
|
|
struct _Evas_Cache_Image_Func
|
|
|
|
{
|
|
|
|
Image_Entry *(*alloc)(void);
|
|
|
|
void (*dealloc)(Image_Entry *im);
|
|
|
|
|
|
|
|
/* The cache provide some helpers for surface manipulation. */
|
|
|
|
int (*surface_alloc)(Image_Entry *im, int w, int h);
|
|
|
|
void (*surface_delete)(Image_Entry *im);
|
|
|
|
DATA32 *(*surface_pixels)(Image_Entry *im);
|
|
|
|
|
|
|
|
/* The cache is doing the allocation and deallocation, you must just do the rest. */
|
2009-12-22 15:11:57 -08:00
|
|
|
int (*constructor)(Image_Entry *im); /**< return is EVAS_LOAD_ERROR_* or EVAS_LOAD_ERROR_NONE! */
|
2008-07-10 09:38:54 -07:00
|
|
|
void (*destructor)(Image_Entry *im);
|
|
|
|
|
|
|
|
void (*dirty_region)(Image_Entry *im, int x, int y, int w, int h);
|
|
|
|
/* Only called when references > 0. Need to provide a fresh copie of im. */
|
|
|
|
/* The destination surface does have a surface, but no allocated pixel data. */
|
|
|
|
int (*dirty)(Image_Entry *dst, const Image_Entry *src);
|
|
|
|
/* Only called when references == 1. We will call drop on `im'. */
|
|
|
|
/* The destination surface does not have any surface. */
|
|
|
|
int (*size_set)(Image_Entry *dst, const Image_Entry *src, int w, int h);
|
|
|
|
|
|
|
|
/* The destination surface does not have any surface. */
|
|
|
|
int (*copied_data)(Image_Entry *dst, int w, int h, DATA32 *image_data, int alpha, int cspace);
|
|
|
|
/* The destination surface does not have any surface. */
|
|
|
|
int (*data)(Image_Entry *dst, int w, int h, DATA32 *image_data, int alpha, int cspace);
|
|
|
|
int (*color_space)(Image_Entry *dst, int cspace);
|
|
|
|
|
|
|
|
/* This function need to update im->w and im->h. */
|
2009-12-22 15:11:57 -08:00
|
|
|
int (*load)(Image_Entry *im);; /**< return is EVAS_LOAD_ERROR_* or EVAS_LOAD_ERROR_NONE! */
|
2008-07-10 09:38:54 -07:00
|
|
|
int (*mem_size_get)(Image_Entry *im);
|
|
|
|
void (*debug)(const char *context, Image_Entry *im);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _Evas_Cache_Image
|
|
|
|
{
|
|
|
|
Evas_Cache_Image_Func func;
|
|
|
|
|
2009-12-18 03:03:31 -08:00
|
|
|
Eina_List *preload;
|
|
|
|
Eina_List *pending;
|
|
|
|
|
2008-10-17 04:23:18 -07:00
|
|
|
Eina_Inlist *dirty;
|
2008-07-10 09:38:54 -07:00
|
|
|
|
2008-10-17 04:23:18 -07:00
|
|
|
Eina_Inlist *lru;
|
|
|
|
Eina_Inlist *lru_nodata;
|
2008-12-09 09:56:31 -08:00
|
|
|
Eina_Hash *inactiv;
|
|
|
|
Eina_Hash *activ;
|
2008-07-10 09:38:54 -07:00
|
|
|
void *data;
|
|
|
|
|
|
|
|
int usage;
|
|
|
|
int limit;
|
|
|
|
int references;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _Evas_Cache_Engine_Image_Func
|
|
|
|
{
|
2008-10-15 07:38:34 -07:00
|
|
|
/* Must return a char* allocated with eina_stringshare_add. */
|
2008-07-10 09:38:54 -07:00
|
|
|
char* (*key)(Image_Entry *im, const char *file, const char *key, RGBA_Image_Loadopts *lo, int *error);
|
|
|
|
|
|
|
|
Engine_Image_Entry* (*alloc)(void);
|
|
|
|
void (*dealloc)(Engine_Image_Entry *eim);
|
|
|
|
|
|
|
|
int (*constructor)(Engine_Image_Entry *eim, void* data);
|
|
|
|
void (*destructor)(Engine_Image_Entry *eim);
|
|
|
|
|
|
|
|
void (*dirty_region)(Engine_Image_Entry *eim, int x, int y, int w, int h);
|
|
|
|
/* Only called when references > 0. Need to provide a fresh copie of im. */
|
|
|
|
int (*dirty)(Engine_Image_Entry *dst, const Engine_Image_Entry *src);
|
|
|
|
/* Only called when references == 1. We will call drop on `im'. */
|
|
|
|
int (*size_set)(Engine_Image_Entry *dst, const Engine_Image_Entry *src);
|
|
|
|
|
|
|
|
int (*update_data)(Engine_Image_Entry* dst, void* data);
|
|
|
|
|
|
|
|
void (*load)(Engine_Image_Entry *eim, const Image_Entry* im);
|
|
|
|
int (*mem_size_get)(Engine_Image_Entry *eim);
|
|
|
|
void (*debug)(const char* context, Engine_Image_Entry *eim);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _Evas_Cache_Engine_Image
|
|
|
|
{
|
|
|
|
Evas_Cache_Engine_Image_Func func;
|
|
|
|
|
2008-12-09 09:56:31 -08:00
|
|
|
Eina_Inlist* dirty;
|
2008-07-10 09:38:54 -07:00
|
|
|
|
2008-12-09 09:56:31 -08:00
|
|
|
Eina_Hash* activ;
|
|
|
|
Eina_Hash* inactiv;
|
|
|
|
Eina_Inlist* lru;
|
2008-07-10 09:38:54 -07:00
|
|
|
|
|
|
|
Evas_Cache_Image* parent;
|
|
|
|
Evas_Cache_Engine_Image* brother;
|
|
|
|
|
|
|
|
int usage;
|
|
|
|
int limit;
|
|
|
|
|
|
|
|
int references;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-07-17 13:42:22 -07:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2008-07-10 09:38:54 -07:00
|
|
|
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 void evas_cache_image_drop(Image_Entry *im);
|
|
|
|
EAPI void evas_cache_image_data_not_needed(Image_Entry *im);
|
|
|
|
EAPI int evas_cache_image_flush(Evas_Cache_Image *cache);
|
|
|
|
EAPI void evas_cache_private_set(Evas_Cache_Image *cache, const void *data);
|
|
|
|
EAPI void* evas_cache_private_get(Evas_Cache_Image *cache);
|
|
|
|
EAPI void* evas_cache_private_from_image_entry_get(Image_Entry *im);
|
|
|
|
|
|
|
|
EAPI int evas_cache_image_usage_get(Evas_Cache_Image *cache);
|
|
|
|
EAPI int evas_cache_image_get(Evas_Cache_Image *cache);
|
|
|
|
EAPI void evas_cache_image_set(Evas_Cache_Image *cache, int size);
|
|
|
|
|
|
|
|
EAPI Image_Entry* evas_cache_image_alone(Image_Entry *im);
|
|
|
|
EAPI Image_Entry* evas_cache_image_dirty(Image_Entry *im, int x, int y, int w, int h);
|
|
|
|
EAPI void evas_cache_image_load_data(Image_Entry *im);
|
|
|
|
EAPI void evas_cache_image_surface_alloc(Image_Entry *im, int w, int h);
|
|
|
|
EAPI DATA32* evas_cache_image_pixels(Image_Entry *im);
|
|
|
|
EAPI Image_Entry* evas_cache_image_copied_data(Evas_Cache_Image *cache, int w, int h, DATA32 *image_data, int alpha, int cspace);
|
|
|
|
EAPI Image_Entry* evas_cache_image_data(Evas_Cache_Image *cache, int w, int h, DATA32 *image_data, int alpha, int cspace);
|
|
|
|
EAPI void evas_cache_image_colorspace(Image_Entry *im, int cspace);
|
|
|
|
EAPI Image_Entry* evas_cache_image_empty(Evas_Cache_Image *cache);
|
|
|
|
EAPI Image_Entry* evas_cache_image_size_set(Image_Entry *im, int w, int h);
|
|
|
|
|
|
|
|
EAPI Evas_Cache_Engine_Image* evas_cache_engine_image_init(const Evas_Cache_Engine_Image_Func *cb, Evas_Cache_Image *parent);
|
|
|
|
EAPI void evas_cache_engine_image_shutdown(Evas_Cache_Engine_Image *cache);
|
|
|
|
|
|
|
|
EAPI int evas_cache_engine_image_usage_get(Evas_Cache_Engine_Image *cache);
|
|
|
|
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 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);
|
|
|
|
EAPI Engine_Image_Entry* evas_cache_engine_image_alone(Engine_Image_Entry *eim, void *data);
|
|
|
|
EAPI Engine_Image_Entry* evas_cache_engine_image_dirty(Engine_Image_Entry *eim, int x, int y, int w, int h);
|
|
|
|
EAPI Engine_Image_Entry* evas_cache_engine_image_copied_data(Evas_Cache_Engine_Image *cache, int w, int h, DATA32 *image_data, int alpha, int cspace, void *engine_data);
|
|
|
|
EAPI Engine_Image_Entry* evas_cache_engine_image_data(Evas_Cache_Engine_Image *cache, int w, int h, DATA32 *image_data, int alpha, int cspace, void *engine_data);
|
|
|
|
EAPI void evas_cache_engine_image_colorspace(Engine_Image_Entry *eim, int cspace, void *engine_data);
|
|
|
|
EAPI Engine_Image_Entry* evas_cache_engine_image_size_set(Engine_Image_Entry *eim, int w, int h);
|
|
|
|
|
|
|
|
EAPI void evas_cache_engine_image_load_data(Engine_Image_Entry *eim);
|
|
|
|
|
2008-12-15 12:31:26 -08:00
|
|
|
EAPI void evas_cache_image_preload_data(Image_Entry *im, const void *target);
|
2009-01-20 06:56:37 -08:00
|
|
|
EAPI void evas_cache_image_preload_cancel(Image_Entry *im, const void *target);
|
2008-07-10 09:38:54 -07:00
|
|
|
|
2009-12-18 03:03:31 -08:00
|
|
|
EAPI void evas_cache_image_wakeup(void);
|
|
|
|
|
2008-07-17 13:42:22 -07:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2008-07-10 09:38:54 -07:00
|
|
|
#endif /* _EVAS_CACHE_H */
|