1 #ifndef EVAS_ENGINE_H
2 #define EVAS_ENGINE_H
3 
4 
5 #define WIN32_LEAN_AND_MEAN
6 #include <windows.h>
7 #undef WIN32_LEAN_AND_MEAN
8 
9 #include "../software_generic/Evas_Engine_Software_Generic.h"
10 
11 extern int _evas_engine_soft_gdi_log_dom;
12 
13 #ifdef ERR
14 # undef ERR
15 #endif
16 #define ERR(...) EINA_LOG_DOM_ERR(_evas_engine_soft_gdi_log_dom, __VA_ARGS__)
17 
18 #ifdef DBG
19 # undef DBG
20 #endif
21 #define DBG(...) EINA_LOG_DOM_DBG(_evas_engine_soft_gdi_log_dom, __VA_ARGS__)
22 
23 #ifdef INF
24 # undef INF
25 #endif
26 #define INF(...) EINA_LOG_DOM_INFO(_evas_engine_soft_gdi_log_dom, __VA_ARGS__)
27 
28 #ifdef WRN
29 # undef WRN
30 #endif
31 #define WRN(...) EINA_LOG_DOM_WARN(_evas_engine_soft_gdi_log_dom, __VA_ARGS__)
32 
33 #ifdef CRI
34 # undef CRI
35 #endif
36 #define CRI(...) EINA_LOG_DOM_CRIT(_evas_engine_soft_gdi_log_dom, __VA_ARGS__)
37 
38 typedef struct BITMAPINFO_GDI     BITMAPINFO_GDI;
39 typedef struct _Outbuf_Region     Outbuf_Region;
40 typedef struct _Gdi_Output_Buffer Gdi_Output_Buffer;
41 
42 struct BITMAPINFO_GDI
43 {
44    BITMAPINFOHEADER bih;
45    DWORD            masks[3];
46 };
47 
48 struct _Outbuf
49 {
50    int                   width;
51    int                   height;
52    int                   rot;
53    int                   onebuf;
54 
55    struct {
56       Convert_Pal       *pal;
57       struct {
58          BITMAPINFO_GDI *bitmap_info;
59          HWND            window;
60          HDC             dc;
61          HRGN            regions;
62          unsigned char   borderless : 1;
63          unsigned char   fullscreen : 1;
64          unsigned char   region     : 1;
65       } gdi;
66 
67       /* 1 big buffer for updates - flush on idle_flush */
68       RGBA_Image        *onebuf;
69       Eina_List         *onebuf_regions;
70 
71       /* a list of pending regions to write to the target */
72       Eina_List         *pending_writes;
73       /* a list of previous frame pending regions to write to the target */
74       Eina_List         *prev_pending_writes;
75 
76       unsigned char      mask_dither       : 1;
77       unsigned char      destination_alpha : 1;
78       unsigned char      debug             : 1;
79       unsigned char      synced            : 1;
80 
81       unsigned char      region_built      : 1;
82    } priv;
83 };
84 
85 struct _Outbuf_Region
86 {
87    Gdi_Output_Buffer *gdiob;
88    int                x;
89    int                y;
90    int                width;
91    int                height;
92 };
93 
94 struct _Gdi_Output_Buffer
95 {
96    BITMAPINFO_GDI *bitmap_info;
97    HBITMAP         bitmap;
98    HDC             dc;
99    int             width;
100    int             height;
101    void           *data;
102    int             pitch;
103    int             psize;
104 };
105 
106 /* evas_gdi_main.c */
107 
108 int evas_software_gdi_init (HWND         window,
109                             unsigned int borderless,
110                             unsigned int fullscreen,
111                             unsigned int region,
112                             Outbuf      *buf);
113 
114 void evas_software_gdi_shutdown(Outbuf *buf);
115 
116 void evas_software_gdi_bitmap_resize(Outbuf *buf);
117 
118 /* evas_gdi_buffer.c */
119 
120 Gdi_Output_Buffer *evas_software_gdi_output_buffer_new(HDC             dc,
121                                                        BITMAPINFO_GDI *bitmap_info,
122                                                        int             width,
123                                                        int             height,
124                                                        void           *data);
125 
126 void evas_software_gdi_output_buffer_free(Gdi_Output_Buffer *gdiob);
127 
128 void evas_software_gdi_output_buffer_paste(Gdi_Output_Buffer *gdiob,
129                                            int                x,
130                                            int                y);
131 
132 DATA8 *evas_software_gdi_output_buffer_data(Gdi_Output_Buffer *gdiob,
133                                             int               *pitch);
134 
135 /* evas_outbuf.c */
136 
137 void evas_software_gdi_outbuf_init(void);
138 
139 void evas_software_gdi_outbuf_free(Outbuf *buf);
140 
141 Outbuf *evas_software_gdi_outbuf_setup(int          width,
142                                        int          height,
143                                        int          rotation,
144                                        HWND         window,
145                                        unsigned int borderless,
146                                        unsigned int fullscreen,
147                                        unsigned int region,
148                                        int          mask_dither,
149                                        int          destination_alpha);
150 
151 void evas_software_gdi_outbuf_reconfigure(Outbuf      *buf,
152                                           int          width,
153                                           int          height,
154                                           int          rotation,
155                                           Outbuf_Depth depth);
156 
157 void *evas_software_gdi_outbuf_new_region_for_update(Outbuf *buf,
158                                                      int     x,
159                                                      int     y,
160                                                      int     w,
161                                                      int     h,
162                                                      int    *cx,
163                                                      int    *cy,
164                                                      int    *cw,
165                                                      int    *ch);
166 
167 void evas_software_gdi_outbuf_push_updated_region(Outbuf     *buf,
168                                                   RGBA_Image *update,
169                                                   int         x,
170                                                   int         y,
171                                                   int         w,
172                                                   int         h);
173 
174 void evas_software_gdi_outbuf_flush(Outbuf *buf, Tilebuf_Rect *surface_damage, Tilebuf_Rect *buffer_damage, Evas_Render_Mode render_mode);
175 
176 void evas_software_gdi_outbuf_idle_flush(Outbuf *buf);
177 
178 int evas_software_gdi_outbuf_width_get(Outbuf *buf);
179 
180 int evas_software_gdi_outbuf_height_get(Outbuf *buf);
181 
182 int evas_software_gdi_outbuf_rot_get(Outbuf *buf);
183 
184 
185 #endif /* EVAS_ENGINE_H */
186