move around - flatter.
[profile/ivi/evas.git] / src / modules / engines / software_x11 / evas_engine.h
1 #ifndef EVAS_ENGINE_H
2 #define EVAS_ENGINE_H
3
4 #include <X11/Xlib.h>
5 #include <X11/Xutil.h>
6 #include <X11/Xatom.h>
7 #include <X11/extensions/XShm.h>
8 #include <sys/ipc.h>
9 #include <sys/shm.h>
10
11 typedef struct _Outbuf                Outbuf;
12 typedef struct _Outbuf_Region         Outbuf_Region;
13 typedef struct _X_Output_Buffer       X_Output_Buffer;
14
15 typedef enum   _Outbuf_Depth          Outbuf_Depth;
16
17 enum _Outbuf_Depth
18 {
19    OUTBUF_DEPTH_NONE,
20      OUTBUF_DEPTH_INHERIT,
21      OUTBUF_DEPTH_RGB_16BPP_565_565_DITHERED,
22      OUTBUF_DEPTH_RGB_16BPP_555_555_DITHERED,
23      OUTBUF_DEPTH_RGB_16BPP_444_444_DITHERED,
24      OUTBUF_DEPTH_RGB_16BPP_565_444_DITHERED,
25      OUTBUF_DEPTH_RGB_32BPP_888_8888,
26      OUTBUF_DEPTH_LAST
27 };
28
29 struct _Outbuf
30 {
31    Outbuf_Depth    depth;
32    int             w, h;
33    int             rot;
34    int             onebuf;
35
36    struct {
37       Convert_Pal *pal;
38       struct {
39          Display       *disp;
40          Window         win;
41          Pixmap         mask;
42          Visual        *vis;
43          Colormap       cmap;
44          int            depth;
45          int            shm;
46          GC             gc;
47          GC             gcm;
48          unsigned char  swap : 1;
49          unsigned char  bit_swap : 1;
50       } x;
51       struct {
52          DATA32    r, g, b;
53       } mask;
54
55       /* 1 big buffer for updates - flush on idle_flush */
56       RGBA_Image  *onebuf;
57       Evas_List   *onebuf_regions;
58
59       /* a list of pending regions to write to the target */
60       Evas_List   *pending_writes;
61       /* a list of previous frame pending regions to write to the target */
62       Evas_List   *prev_pending_writes;
63
64       unsigned char mask_dither : 1;
65       unsigned char destination_alpha : 1;
66       unsigned char debug : 1;
67       unsigned char synced : 1;
68    } priv;
69 };
70
71 struct _Outbuf_Region
72 {
73    X_Output_Buffer *xob, *mxob;
74    int x, y, w, h;
75 };
76
77 struct _X_Output_Buffer
78 {
79    Display         *display;
80    XImage          *xim;
81    XShmSegmentInfo *shm_info;
82    Visual          *visual;
83    void            *data;
84    int              w, h, bpl;
85    int              psize;
86 };
87
88 /****/
89 void             evas_software_x11_x_init                        (void);
90
91 void             evas_software_x11_x_write_mask_line             (Outbuf *buf, X_Output_Buffer *xob, DATA32 *src, int w, int y);
92 int              evas_software_x11_x_can_do_shm                  (Display *d);
93 X_Output_Buffer *evas_software_x11_x_output_buffer_new           (Display *d, Visual *v, int depth, int w, int h, int try_shm, void *data);
94 void             evas_software_x11_x_output_buffer_free          (X_Output_Buffer *xob, int sync);
95 void             evas_software_x11_x_output_buffer_paste         (X_Output_Buffer *xob, Drawable d, GC gc, int x, int y, int sync);
96 DATA8           *evas_software_x11_x_output_buffer_data          (X_Output_Buffer *xob, int *bytes_per_line_ret);
97 int              evas_software_x11_x_output_buffer_depth         (X_Output_Buffer *xob);
98 int              evas_software_x11_x_output_buffer_byte_order    (X_Output_Buffer *xob);
99 int              evas_software_x11_x_output_buffer_bit_order     (X_Output_Buffer *xob);
100
101 void             evas_software_x11_x_color_init                  (void);
102 Convert_Pal     *evas_software_x11_x_color_allocate              (Display *disp, Colormap cmap, Visual *vis, Convert_Pal_Mode colors);
103 void             evas_software_x11_x_color_deallocate            (Display *disp, Colormap cmap, Visual *vis, Convert_Pal *pal);
104
105 void             evas_software_x11_outbuf_init                   (void);
106 void             evas_software_x11_outbuf_free                   (Outbuf *buf);
107
108 Outbuf          *evas_software_x11_outbuf_setup_x                (int w, int h, int rot, Outbuf_Depth depth, Display *disp, Drawable draw, Visual *vis, Colormap cmap, int x_depth, int grayscale, int max_colors, Pixmap mask, int shape_dither, int destination_alpha);
109
110 RGBA_Image      *evas_software_x11_outbuf_new_region_for_update  (Outbuf *buf, int x, int y, int w, int h, int *cx, int *cy, int *cw, int *ch);
111 void             evas_software_x11_outbuf_free_region_for_update (Outbuf *buf, RGBA_Image *update);
112 void             evas_software_x11_outbuf_flush                  (Outbuf *buf);
113 void             evas_software_x11_outbuf_idle_flush             (Outbuf *buf);
114 void             evas_software_x11_outbuf_push_updated_region    (Outbuf *buf, RGBA_Image *update, int x, int y, int w, int h);
115 void             evas_software_x11_outbuf_reconfigure            (Outbuf *buf, int w, int h, int rot, Outbuf_Depth depth);
116 int              evas_software_x11_outbuf_get_width              (Outbuf *buf);
117 int              evas_software_x11_outbuf_get_height             (Outbuf *buf);
118 Outbuf_Depth     evas_software_x11_outbuf_get_depth              (Outbuf *buf);
119 int              evas_software_x11_outbuf_get_rot                (Outbuf *buf);
120 void             evas_software_x11_outbuf_drawable_set           (Outbuf *buf, Drawable draw);
121 void             evas_software_x11_outbuf_mask_set               (Outbuf *buf, Pixmap mask);
122 void             evas_software_x11_outbuf_rotation_set           (Outbuf *buf, int rot);
123
124 void             evas_software_x11_outbuf_debug_set              (Outbuf *buf, int debug);
125 void             evas_software_x11_outbuf_debug_show             (Outbuf *buf, Drawable draw, int x, int y, int w, int h);
126
127 #endif