summaryrefslogtreecommitdiff
path: root/src/modules/evas/engines/software_gdi/evas_engine.h
blob: 329ec33399921b5dc7a8baed628fb1b9f1211a02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
#ifndef EVAS_ENGINE_H
#define EVAS_ENGINE_H


#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN

#include "../software_generic/Evas_Engine_Software_Generic.h"

extern int _evas_engine_soft_gdi_log_dom;

#ifdef ERR
# undef ERR
#endif
#define ERR(...) EINA_LOG_DOM_ERR(_evas_engine_soft_gdi_log_dom, __VA_ARGS__)

#ifdef DBG
# undef DBG
#endif
#define DBG(...) EINA_LOG_DOM_DBG(_evas_engine_soft_gdi_log_dom, __VA_ARGS__)

#ifdef INF
# undef INF
#endif
#define INF(...) EINA_LOG_DOM_INFO(_evas_engine_soft_gdi_log_dom, __VA_ARGS__)

#ifdef WRN
# undef WRN
#endif
#define WRN(...) EINA_LOG_DOM_WARN(_evas_engine_soft_gdi_log_dom, __VA_ARGS__)

#ifdef CRI
# undef CRI
#endif
#define CRI(...) EINA_LOG_DOM_CRIT(_evas_engine_soft_gdi_log_dom, __VA_ARGS__)

typedef struct BITMAPINFO_GDI     BITMAPINFO_GDI;
typedef struct _Outbuf_Region     Outbuf_Region;
typedef struct _Gdi_Output_Buffer Gdi_Output_Buffer;

struct BITMAPINFO_GDI
{
   BITMAPINFOHEADER bih;
   DWORD            masks[3];
};

struct _Outbuf
{
   int                   width;
   int                   height;
   int                   rot;
   int                   onebuf;

   struct {
      Convert_Pal       *pal;
      struct {
         BITMAPINFO_GDI *bitmap_info;
         HWND            window;
         HDC             dc;
         HRGN            regions;
         unsigned char   borderless : 1;
         unsigned char   fullscreen : 1;
         unsigned char   region     : 1;
      } gdi;

      /* 1 big buffer for updates - flush on idle_flush */
      RGBA_Image        *onebuf;
      Eina_List         *onebuf_regions;

      /* a list of pending regions to write to the target */
      Eina_List         *pending_writes;
      /* a list of previous frame pending regions to write to the target */
      Eina_List         *prev_pending_writes;

      unsigned char      mask_dither       : 1;
      unsigned char      destination_alpha : 1;
      unsigned char      debug             : 1;
      unsigned char      synced            : 1;

      unsigned char      region_built      : 1;
   } priv;
};

struct _Outbuf_Region
{
   Gdi_Output_Buffer *gdiob;
   int                x;
   int                y;
   int                width;
   int                height;
};

struct _Gdi_Output_Buffer
{
   BITMAPINFO_GDI *bitmap_info;
   HBITMAP         bitmap;
   HDC             dc;
   int             width;
   int             height;
   void           *data;
   int             pitch;
   int             psize;
};

/* evas_gdi_main.c */

int evas_software_gdi_init (HWND         window,
                            unsigned int borderless,
                            unsigned int fullscreen,
                            unsigned int region,
                            Outbuf      *buf);

void evas_software_gdi_shutdown(Outbuf *buf);

void evas_software_gdi_bitmap_resize(Outbuf *buf);

/* evas_gdi_buffer.c */

Gdi_Output_Buffer *evas_software_gdi_output_buffer_new(HDC             dc,
                                                       BITMAPINFO_GDI *bitmap_info,
                                                       int             width,
                                                       int             height,
                                                       void           *data);

void evas_software_gdi_output_buffer_free(Gdi_Output_Buffer *gdiob);

void evas_software_gdi_output_buffer_paste(Gdi_Output_Buffer *gdiob,
                                           int                x,
                                           int                y);

DATA8 *evas_software_gdi_output_buffer_data(Gdi_Output_Buffer *gdiob,
                                            int               *pitch);

/* evas_outbuf.c */

void evas_software_gdi_outbuf_init(void);

void evas_software_gdi_outbuf_free(Outbuf *buf);

Outbuf *evas_software_gdi_outbuf_setup(int          width,
                                       int          height,
                                       int          rotation,
                                       HWND         window,
                                       unsigned int borderless,
                                       unsigned int fullscreen,
                                       unsigned int region,
                                       int          mask_dither,
                                       int          destination_alpha);

void evas_software_gdi_outbuf_reconfigure(Outbuf      *buf,
                                          int          width,
                                          int          height,
                                          int          rotation,
                                          Outbuf_Depth depth);

void *evas_software_gdi_outbuf_new_region_for_update(Outbuf *buf,
                                                     int     x,
                                                     int     y,
                                                     int     w,
                                                     int     h,
                                                     int    *cx,
                                                     int    *cy,
                                                     int    *cw,
                                                     int    *ch);

void evas_software_gdi_outbuf_push_updated_region(Outbuf     *buf,
                                                  RGBA_Image *update,
                                                  int         x,
                                                  int         y,
                                                  int         w,
                                                  int         h);

void evas_software_gdi_outbuf_flush(Outbuf *buf, Tilebuf_Rect *surface_damage, Tilebuf_Rect *buffer_damage, Evas_Render_Mode render_mode);

void evas_software_gdi_outbuf_idle_flush(Outbuf *buf);

int evas_software_gdi_outbuf_width_get(Outbuf *buf);

int evas_software_gdi_outbuf_height_get(Outbuf *buf);

int evas_software_gdi_outbuf_rot_get(Outbuf *buf);


#endif /* EVAS_ENGINE_H */