evas: don't clip the clipper.
[framework/uifw/evas.git] / src / lib / cserve2 / evas_cs2.h
1 #ifndef EVAS_CS2_H
2 #define EVAS_CS2_H 1
3
4 #include <Eina.h>
5
6 #ifdef EVAS_CSERVE2
7
8 typedef enum {
9    CSERVE2_OPEN = 1,
10    CSERVE2_OPENED,
11    CSERVE2_SETOPTS,
12    CSERVE2_SETOPTSED,
13    CSERVE2_LOAD,
14    CSERVE2_LOADED,
15    CSERVE2_PRELOAD,
16    CSERVE2_UNLOAD,
17    CSERVE2_CLOSE,
18    CSERVE2_FONT_LOAD,
19    CSERVE2_FONT_LOADED,
20    CSERVE2_FONT_UNLOAD,
21    CSERVE2_FONT_GLYPHS_LOAD,
22    CSERVE2_FONT_GLYPHS_LOADED,
23    CSERVE2_FONT_GLYPHS_USED,
24    CSERVE2_STATS,
25    CSERVE2_FONT_DEBUG,
26    CSERVE2_ERROR
27 } Message_Type;
28
29 typedef enum {
30    CSERVE2_NONE,
31    CSERVE2_GENERIC,
32    CSERVE2_DOES_NOT_EXIST,
33    CSERVE2_PERMISSION_DENIED,
34    CSERVE2_RESOURCE_ALLOCATION_FAILED,
35    CSERVE2_CORRUPT_FILE,
36    CSERVE2_UNKNOWN_FORMAT,
37    CSERVE2_INVALID_COMMAND,
38    CSERVE2_LOADER_DIED,
39    CSERVE2_LOADER_EXEC_ERR,
40    CSERVE2_INVALID_CACHE, // invalid cserve cache entry
41    CSERVE2_FILE_CHANGED,
42    CSERVE2_REQUEST_CANCEL
43 } Error_Type;
44
45 struct _Msg_Base {
46    int type;
47    unsigned int rid;
48 };
49
50 typedef struct _Msg_Base Msg_Base;
51
52 struct _Msg_Open {
53    Msg_Base base;
54    unsigned int file_id;
55    int path_offset;
56    int key_offset;
57 };
58
59 struct _Msg_Opened {
60    Msg_Base base;
61    struct {
62       int w, h;
63       int frame_count;
64       int loop_count;
65       int loop_hint; /* include Evas.h? Copy the enum around? */
66       Eina_Bool alpha : 1;
67    } image;
68 };
69
70 struct _Msg_Setopts {
71    Msg_Base base;
72    unsigned int file_id;
73    unsigned int image_id;
74    struct {
75       double dpi;
76       int w, h;
77       int scale_down;
78       int rx, ry, rw, rh;
79       Eina_Bool orientation;
80    } opts;
81 };
82
83 struct _Msg_Setoptsed {
84    Msg_Base base;
85 };
86
87 struct _Msg_Load {
88    Msg_Base base;
89    unsigned int image_id;
90 };
91
92 struct _Msg_Loaded {
93    Msg_Base base;
94    struct {
95       int mmap_offset;
96       int use_offset;
97       int mmap_size;
98       int image_size;
99    } shm;
100    Eina_Bool alpha_sparse : 1;
101 };
102
103 struct _Msg_Preload {
104    Msg_Base base;
105    unsigned int image_id;
106 };
107
108 struct _Msg_Preloaded {
109    Msg_Base base;
110 };
111
112 struct _Msg_Unload {
113    Msg_Base base;
114    unsigned int image_id;
115 };
116
117 struct _Msg_Close {
118    Msg_Base base;
119    unsigned int file_id;
120 };
121
122 /**
123  * @struct _Msg_Font_Load
124  *
125  * Message from client to request load or unload of a font.
126  *
127  * The path strings follow the struct inside the message.
128  */
129 struct _Msg_Font_Load {
130    Msg_Base base;
131    unsigned int sourcelen; // font id
132    unsigned int pathlen; // font id
133    unsigned int rend_flags; // font id
134    unsigned int size; // font id
135    unsigned int dpi; // font id
136 };
137
138 /**
139  * @struct _Msg_Font_Loaded
140  *
141  * Message from server to inform that a font was loaded.
142  */
143 struct _Msg_Font_Loaded {
144    Msg_Base base;
145 };
146
147 /**
148  * @struct _Msg_Font_Glyphs_Request
149  *
150  * Message from client to request load of glyphs, or inform usage of them.
151  *
152  * The path strings follow the struct inside the message, as well as
153  * the list of glyphs to be loaded.
154  */
155 struct _Msg_Font_Glyphs_Request {
156    Msg_Base base;
157    unsigned int sourcelen; // font id
158    unsigned int pathlen; // font id
159    unsigned int rend_flags; // font id
160    unsigned int size; // font id
161    unsigned int dpi; // font id
162    unsigned int hint;
163    unsigned int nglyphs;
164 };
165
166 /**
167  * @struct _Msg_Font_Glyphs_Loaded
168  *
169  * Message from server to inform that some glyphs were loaded.
170  *
171  * This message is quite complex: it contains the font id, representing for
172  * which font these glyphs should be loaded, and the number of caches on which
173  * the loaded glyphs are stored. Each cache is a SHM segment. The information
174  * about each SHM comes serialized just after this struct, and can be read in
175  * order as follows:
176  *
177  * shm name:
178  *  - unsigned int size;
179  *  - char name[];
180  * glyphs:
181  *  - unsigned int nglyphs;
182  *  - struct {
183  *      unsigned int index;
184  *      unsigned int offset;
185  *      unsigned int size;
186  *      unsigned int rows;
187  *      unsigned int width;
188  *      unsigned int pitch;
189  *      unsigned int num_grays;
190  *      unsigned int pixel_mode;
191  *    } glarray[];
192  */
193 struct _Msg_Font_Glyphs_Loaded {
194    Msg_Base base;
195    unsigned int ncaches;
196 };
197
198 struct _Msg_Stats {
199    Msg_Base base;
200    struct {
201       unsigned int requested_size;
202       unsigned int real_size;
203       unsigned int unused_size;
204       unsigned int fonts_loaded; /* number of loaded fonts */
205       unsigned int fonts_unused; /* number of loaded fonts without reference
206                                   * from any clients */
207       int fonts_load_time; /* total time spent loading fonts */
208       int fonts_used_load_time; /* total time spent loading fonts that are
209                                  * really used, i.e. fonts that have glyphs
210                                  * rendered */
211       int fonts_used_saved_time;
212       int glyphs_request_time; /* time spent waiting for glyph requests */
213       int glyphs_load_time; /* total time spent loading glyphs */
214       int glyphs_render_time; /* total time spent rendering glyphs */
215       int glyphs_slave_time; /* total time spent on the slave processing glyph load requests */
216       int glyphs_saved_time; /* total time spent loading glyphs */
217    } fonts;
218    struct {
219       unsigned int files_loaded; /* number of file headers loaded */
220       unsigned int images_loaded; /* number of image data loaded */
221       unsigned int images_unused; /* number of image data loaded and unused */
222
223       unsigned int requested_size; /* memory usage originally requested by
224                                     * the client */
225       unsigned int files_size; /* memory usage from image headers */
226       unsigned int images_size; /* memory usage from image data */
227       unsigned int unused_size; /* memory usage from image data */
228
229       int files_load_time;
230       int files_saved_time;
231       int images_load_time;
232       int images_saved_time;
233    } images;
234 };
235
236 /*
237  * @struct _Msg_Font_Debug
238  *
239  * Message from server containing all font cache info.
240  *
241  * Content of the message follows:
242  *
243  * * number of font entries;
244  * * each font entry:
245  *   - unsigned int filelen
246  *   - const char file
247  *   - unsigned int namelen
248  *   - const char name
249  *   - unsigned int rend_flags;
250  *   - unsigned int size;
251  *   - unsigned int dpi;
252  *   - unsigned int unused;
253  *   - ncaches:
254  *   - each cache:
255  *     * usigned int shmnamelen;
256  *     * const char shmname;
257  *     * unsigned int size;
258  *     * unsigned int usage;
259  *     * unsigned int nglyphs;
260  *     * each glyph:
261  *       - unsigned int index;
262  *       - unsigned int offset;
263  *       - unsigned int size;
264  *       - unsigned int rows;
265  *       - unsigned int width;
266  *       - unsigned int pitch;
267  *       - unsigned int num_grays;
268  *       - unsigned int pixel_mode;
269  */
270 struct _Msg_Font_Debug {
271     Msg_Base base;
272 };
273
274 struct _Msg_Error {
275    Msg_Base base;
276    int error;
277 };
278
279 typedef struct _Msg_Open Msg_Open;
280 typedef struct _Msg_Opened Msg_Opened;
281 typedef struct _Msg_Setopts Msg_Setopts;
282 typedef struct _Msg_Setoptsed Msg_Setoptsed;
283 typedef struct _Msg_Load Msg_Load;
284 typedef struct _Msg_Loaded Msg_Loaded;
285 typedef struct _Msg_Preload Msg_Preload;
286 typedef struct _Msg_Preloaded Msg_Preloaded;
287 typedef struct _Msg_Unload Msg_Unload;
288 typedef struct _Msg_Close Msg_Close;
289 typedef struct _Msg_Font_Load Msg_Font_Load;
290 typedef struct _Msg_Font_Loaded Msg_Font_Loaded;
291 typedef struct _Msg_Font_Glyphs_Request Msg_Font_Glyphs_Request;
292 typedef struct _Msg_Font_Glyphs_Loaded Msg_Font_Glyphs_Loaded;
293 typedef struct _Msg_Stats Msg_Stats;
294 typedef struct _Msg_Font_Debug Msg_Font_Debug;
295 typedef struct _Msg_Error Msg_Error;
296
297 #endif
298 #endif