aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/evas/src/lib/cache/evas_cache.h
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-01-04 18:41:13 +1000
committerDavid Walter Seikel2012-01-04 18:41:13 +1000
commitdd7595a3475407a7fa96a97393bae8c5220e8762 (patch)
treee341e911d7eb911a51684a7412ef7f7c7605d28e /libraries/evas/src/lib/cache/evas_cache.h
parentAdd the skeleton. (diff)
downloadSledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.zip
SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.gz
SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.bz2
SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.xz
Add the base Enlightenment Foundation Libraries - eina, eet, evas, ecore, embryo, and edje.
Note that embryo wont be used, but I'm not sure yet if you can build edje without it.
Diffstat (limited to 'libraries/evas/src/lib/cache/evas_cache.h')
-rw-r--r--libraries/evas/src/lib/cache/evas_cache.h175
1 files changed, 175 insertions, 0 deletions
diff --git a/libraries/evas/src/lib/cache/evas_cache.h b/libraries/evas/src/lib/cache/evas_cache.h
new file mode 100644
index 0000000..0947a6d
--- /dev/null
+++ b/libraries/evas/src/lib/cache/evas_cache.h
@@ -0,0 +1,175 @@
1#ifndef _EVAS_CACHE_H
2#define _EVAS_CACHE_H
3
4
5typedef struct _Evas_Cache_Image Evas_Cache_Image;
6typedef struct _Evas_Cache_Image_Func Evas_Cache_Image_Func;
7typedef struct _Evas_Cache_Engine_Image Evas_Cache_Engine_Image;
8typedef struct _Evas_Cache_Engine_Image_Func Evas_Cache_Engine_Image_Func;
9
10
11struct _Evas_Cache_Image_Func
12{
13 Image_Entry *(*alloc)(void);
14 void (*dealloc)(Image_Entry *im);
15
16 /* The cache provide some helpers for surface manipulation. */
17 int (*surface_alloc)(Image_Entry *im, unsigned int w, unsigned int h);
18 void (*surface_delete)(Image_Entry *im);
19 DATA32 *(*surface_pixels)(Image_Entry *im);
20
21 /* The cache is doing the allocation and deallocation, you must just do the rest. */
22 int (*constructor)(Image_Entry *im); /**< return is EVAS_LOAD_ERROR_* or EVAS_LOAD_ERROR_NONE! */
23 void (*destructor)(Image_Entry *im);
24
25 void (*dirty_region)(Image_Entry *im, unsigned int x, unsigned int y, unsigned int w, unsigned int h);
26 /* Only called when references > 0. Need to provide a fresh copie of im. */
27 /* The destination surface does have a surface, but no allocated pixel data. */
28 int (*dirty)(Image_Entry *dst, const Image_Entry *src);
29 /* Only called when references == 1. We will call drop on `im'. */
30 /* The destination surface does not have any surface. */
31 int (*size_set)(Image_Entry *dst, const Image_Entry *src, unsigned int w, unsigned int h);
32
33 /* The destination surface does not have any surface. */
34 int (*copied_data)(Image_Entry *dst, unsigned int w, unsigned int h, DATA32 *image_data, int alpha, int cspace);
35 /* The destination surface does not have any surface. */
36 int (*data)(Image_Entry *dst, unsigned int w, unsigned int h, DATA32 *image_data, int alpha, int cspace);
37 int (*color_space)(Image_Entry *dst, int cspace);
38
39 /* This function need to update im->w and im->h. */
40 int (*load)(Image_Entry *im); /**< return is EVAS_LOAD_ERROR_* or EVAS_LOAD_ERROR_NONE! */
41 int (*mem_size_get)(Image_Entry *im);
42 void (*debug)(const char *context, Image_Entry *im);
43};
44
45struct _Evas_Cache_Image
46{
47 Evas_Cache_Image_Func func;
48
49 Eina_List *preload;
50 Eina_List *pending;
51
52 Eina_Inlist *dirty;
53
54 Eina_Inlist *lru;
55 Eina_Inlist *lru_nodata;
56 Eina_Hash *inactiv;
57 Eina_Hash *activ;
58 void *data;
59
60 int usage;
61 unsigned int limit;
62 int references;
63#ifdef EVAS_FRAME_QUEUING
64 LK(lock);
65#endif
66};
67
68struct _Evas_Cache_Engine_Image_Func
69{
70 /* Must return a char* allocated with eina_stringshare_add. */
71 char* (*key)(Image_Entry *im, const char *file, const char *key, RGBA_Image_Loadopts *lo, int *error);
72
73 Engine_Image_Entry* (*alloc)(void);
74 void (*dealloc)(Engine_Image_Entry *eim);
75
76 int (*constructor)(Engine_Image_Entry *eim, void* data);
77 void (*destructor)(Engine_Image_Entry *eim);
78
79 void (*dirty_region)(Engine_Image_Entry *eim, unsigned int x, unsigned int y, unsigned int w, unsigned int h);
80 /* Only called when references > 0. Need to provide a fresh copie of im. */
81 int (*dirty)(Engine_Image_Entry *dst, const Engine_Image_Entry *src);
82 /* Only called when references == 1. We will call drop on `im'. */
83 int (*size_set)(Engine_Image_Entry *dst, const Engine_Image_Entry *src);
84
85 int (*update_data)(Engine_Image_Entry* dst, void* data);
86
87 void (*load)(Engine_Image_Entry *eim, const Image_Entry* im);
88 int (*mem_size_get)(Engine_Image_Entry *eim);
89 void (*debug)(const char* context, Engine_Image_Entry *eim);
90};
91
92struct _Evas_Cache_Engine_Image
93{
94 Evas_Cache_Engine_Image_Func func;
95
96 Eina_Inlist* dirty;
97
98 Eina_Hash* activ;
99 Eina_Hash* inactiv;
100 Eina_Inlist* lru;
101
102 Evas_Cache_Image* parent;
103 Evas_Cache_Engine_Image* brother;
104
105 int usage;
106 int limit;
107
108 int references;
109};
110
111
112#ifdef __cplusplus
113extern "C" {
114#endif
115
116
117EAPI Evas_Cache_Image* evas_cache_image_init(const Evas_Cache_Image_Func *cb);
118EAPI void evas_cache_image_shutdown(Evas_Cache_Image *cache);
119EAPI Image_Entry* evas_cache_image_request(Evas_Cache_Image *cache, const char *file, const char *key, RGBA_Image_Loadopts *lo, int *error);
120EAPI void evas_cache_image_drop(Image_Entry *im);
121EAPI void evas_cache_image_data_not_needed(Image_Entry *im);
122EAPI int evas_cache_image_flush(Evas_Cache_Image *cache);
123EAPI void evas_cache_private_set(Evas_Cache_Image *cache, const void *data);
124EAPI void* evas_cache_private_get(Evas_Cache_Image *cache);
125EAPI void* evas_cache_private_from_image_entry_get(Image_Entry *im);
126
127EAPI int evas_cache_image_usage_get(Evas_Cache_Image *cache);
128EAPI int evas_cache_image_get(Evas_Cache_Image *cache);
129EAPI void evas_cache_image_set(Evas_Cache_Image *cache, unsigned int size);
130
131EAPI Image_Entry* evas_cache_image_alone(Image_Entry *im);
132EAPI Image_Entry* evas_cache_image_dirty(Image_Entry *im, unsigned int x, unsigned int y, unsigned int w, unsigned int h);
133EAPI int evas_cache_image_load_data(Image_Entry *im);
134EAPI void evas_cache_image_unload_data(Image_Entry *im);
135EAPI Eina_Bool evas_cache_image_is_loaded(Image_Entry *im);
136EAPI void evas_cache_image_unload_all(Evas_Cache_Image *cache);
137EAPI void evas_cache_image_surface_alloc(Image_Entry *im, unsigned int w, unsigned int h);
138EAPI DATA32* evas_cache_image_pixels(Image_Entry *im);
139EAPI Image_Entry* evas_cache_image_copied_data(Evas_Cache_Image *cache, unsigned int w, unsigned int h, DATA32 *image_data, int alpha, int cspace);
140EAPI Image_Entry* evas_cache_image_data(Evas_Cache_Image *cache, unsigned int w, unsigned int h, DATA32 *image_data, int alpha, int cspace);
141EAPI void evas_cache_image_colorspace(Image_Entry *im, int cspace);
142EAPI Image_Entry* evas_cache_image_empty(Evas_Cache_Image *cache);
143EAPI Image_Entry* evas_cache_image_size_set(Image_Entry *im, unsigned int w, unsigned int h);
144
145EAPI Evas_Cache_Engine_Image* evas_cache_engine_image_init(const Evas_Cache_Engine_Image_Func *cb, Evas_Cache_Image *parent);
146EAPI void evas_cache_engine_image_shutdown(Evas_Cache_Engine_Image *cache);
147
148EAPI int evas_cache_engine_image_usage_get(Evas_Cache_Engine_Image *cache);
149EAPI int evas_cache_engine_image_get(Evas_Cache_Engine_Image *cache);
150EAPI void evas_cache_engine_image_set(Evas_Cache_Engine_Image *cache, int limit);
151
152EAPI 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);
153EAPI void evas_cache_engine_parent_not_needed(Engine_Image_Entry *eim);
154EAPI Engine_Image_Entry* evas_cache_engine_image_engine(Evas_Cache_Engine_Image *cache, void *engine_data);
155EAPI void evas_cache_engine_image_drop(Engine_Image_Entry *eim);
156EAPI Engine_Image_Entry* evas_cache_engine_image_alone(Engine_Image_Entry *eim, void *data);
157EAPI Engine_Image_Entry* evas_cache_engine_image_dirty(Engine_Image_Entry *eim, unsigned int x, unsigned int y, unsigned int w, unsigned int h);
158EAPI Engine_Image_Entry* evas_cache_engine_image_copied_data(Evas_Cache_Engine_Image *cache, unsigned int w, unsigned int h, DATA32 *image_data, int alpha, int cspace, void *engine_data);
159EAPI Engine_Image_Entry* evas_cache_engine_image_data(Evas_Cache_Engine_Image *cache, unsigned int w, unsigned int h, DATA32 *image_data, int alpha, int cspace, void *engine_data);
160EAPI void evas_cache_engine_image_colorspace(Engine_Image_Entry *eim, int cspace, void *engine_data);
161EAPI Engine_Image_Entry* evas_cache_engine_image_size_set(Engine_Image_Entry *eim, unsigned int w, unsigned int h);
162
163EAPI void evas_cache_engine_image_load_data(Engine_Image_Entry *eim);
164
165EAPI void evas_cache_image_preload_data(Image_Entry *im, const void *target);
166EAPI void evas_cache_image_preload_cancel(Image_Entry *im, const void *target);
167
168EAPI void evas_cache_image_wakeup(void);
169
170#ifdef __cplusplus
171}
172#endif
173
174
175#endif /* _EVAS_CACHE_H */