merged evas image masking code from brett
[framework/uifw/evas.git] / src / lib / engines / common / evas_pipe.h
1 #ifndef _EVAS_PIPE_H
2 #define _EVAS_PIPE_H
3 #include "evas_bidi_utils.h"
4
5 #ifdef BUILD_PTHREAD
6 typedef struct _Thinfo
7 {
8    int                    thread_num;
9    pthread_t              thread_id;
10    pthread_barrier_t     *barrier;
11    RGBA_Pipe_Thread_Info *info;
12 # ifdef EVAS_FRAME_QUEUING
13    void                  *fq_info;
14 #endif
15 } Thinfo;
16 #endif
17
18 #ifdef EVAS_FRAME_QUEUING
19 struct _Evas_Surface
20 {
21    EINA_INLIST;
22    RGBA_Image *im;
23    int x, y, w, h;
24    int dontpush; // dont push the surface out after drawing done
25 };
26 typedef struct _Evas_Surface Evas_Surface;
27
28 struct _Evas_Frame
29 {
30    EINA_INLIST;
31    Evas_Surface *surfaces;
32    void *data;
33    int in_process;
34    int ready;
35    int dont_schedule;
36    struct timeval ready_time;
37
38    void (*output_redraws_next_update_push) (void *data, void *surface, int x, int y, int w, int h);
39    void (*output_flush)  (void *data);
40    void (*output_set_priv)(void *data, void *cur, void *prev);
41 };
42 typedef struct _Evas_Frame Evas_Frame;
43
44
45 struct _Evas_FrameQ
46 {
47    int initialised;
48    Evas_Frame   *frames;
49    pthread_cond_t cond_new;
50    pthread_cond_t cond_ready;
51    pthread_cond_t cond_done;
52    LK(mutex);
53
54    int             thread_num;
55    Thinfo          thinfo[TH_MAX];
56    int             frameq_sz;
57
58    Evas_Frame *cur_frame;        
59 };
60 typedef struct _Evas_FrameQ Evas_FrameQ;
61 #define FRAMEQ_SZ_PER_THREAD 2
62
63 struct _Evas_Frameq_Thread_Info
64 {
65    Evas_FrameQ *frameq;
66 };
67 typedef struct _Evas_Frameq_Thread_Info Evas_Frameq_Thread_Info;
68
69 EAPI Evas_Surface *evas_common_frameq_new_surface(void *surface, int x, int y, int w, int h);
70 EAPI void evas_common_frameq_add_surface(Evas_Surface *surface);
71 EAPI void evas_common_frameq_set_frame_data(void *data, 
72                                             void (*fn_output_redraws_next_update_push) (void *data, void *surface, int x, int y, int w, int h),
73                                             void (*fn_output_flush)  (void *data),
74                                             void (*fn_output_set_priv)(void *data, void *cur, void *prev));
75 EAPI void evas_common_frameq_prepare_frame(void);
76 EAPI void evas_common_frameq_ready_frame(void);
77 EAPI void evas_common_frameq_init(void);
78 EAPI void evas_common_frameq_destroy(void);
79 EAPI void evas_common_frameq_flush(void);
80 EAPI void evas_common_frameq_flush_ready(void);
81 EAPI int evas_common_frameq_get_frameq_sz(void);
82 EAPI int evas_common_frameq_enabled(void);
83 EAPI void evas_common_frameq_begin(void);
84 EAPI void evas_common_frameq_finish(void);
85 #endif
86
87 /* image rendering pipelines... new optional system - non-immediate and
88  * threadable
89  */
90
91 EAPI void evas_common_pipe_free(RGBA_Image *im);
92 EAPI void evas_common_pipe_rectangle_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, int w, int h);
93 EAPI void evas_common_pipe_line_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x1, int y1);
94 EAPI void evas_common_pipe_poly_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Polygon_Point *points, int x, int y);
95 EAPI void evas_common_pipe_text_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font *fn, int x, int y, const Eina_Unicode *text, const Evas_BiDi_Props *intl_props);
96 EAPI void evas_common_pipe_image_load(RGBA_Image *im);
97 EAPI void evas_common_pipe_image_draw(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int smooth, 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);
98 EAPI void evas_common_pipe_map_begin(RGBA_Image *root);
99 EAPI void evas_common_pipe_map_draw(RGBA_Image *src, RGBA_Image *dst,
100                                      RGBA_Draw_Context *dc, RGBA_Map_Point *p,
101                                      int smooth, int level);
102 EAPI void evas_common_pipe_flush(RGBA_Image *im);
103
104 #ifdef EVAS_FRAME_QUEUING
105 EAPI void evas_common_pipe_op_text_flush(RGBA_Font *fn);
106 EAPI void evas_common_pipe_op_image_flush(RGBA_Image *im);
107 #endif
108
109 #endif /* _EVAS_PIPE_H */