Improved stubs for the ddraw clipper routines.
[wine] / graphics / ddraw_private.h
1 #ifndef __GRAPHICS_WINE_DDRAW_PRIVATE_H
2 #define __GRAPHICS_WINE_DDRAW_PRIVATE_H
3
4 #include "ddraw.h"
5 #include "winuser.h"
6
7 /*****************************************************************************
8  * Predeclare the interface implementation structures
9  */
10 typedef struct IDirectDrawPaletteImpl IDirectDrawPaletteImpl;
11 typedef struct IDirectDrawClipperImpl IDirectDrawClipperImpl;
12 typedef struct IDirectDrawImpl IDirectDrawImpl;
13 typedef struct IDirectDraw2Impl IDirectDraw2Impl;
14 typedef struct IDirectDraw4Impl IDirectDraw4Impl;
15 typedef struct IDirectDrawSurfaceImpl IDirectDrawSurfaceImpl;
16 typedef struct IDirectDrawSurface3Impl IDirectDrawSurface2Impl;
17 typedef struct IDirectDrawSurface4Impl IDirectDrawSurface3Impl;
18 typedef struct IDirectDrawSurface4Impl IDirectDrawSurface4Impl;
19 typedef struct IDirectDrawColorControlImpl IDirectDrawColorControlImpl;
20
21 #include "d3d_private.h"
22
23 /*****************************************************************************
24  * IDirectDrawPalette implementation structure
25  */
26 struct IDirectDrawPaletteImpl
27 {
28     /* IUnknown fields */
29     ICOM_VFIELD(IDirectDrawPalette);
30     DWORD                            ref;
31     /* IDirectDrawPalette fields */
32     IDirectDrawImpl* ddraw;
33     Colormap         cm;
34     PALETTEENTRY     palents[256];
35     int              installed;
36     /* This is to store the palette in 'screen format' */
37     int              screen_palents[256];
38 };
39
40 /*****************************************************************************
41  * IDirectDrawClipper implementation structure
42  */
43 struct IDirectDrawClipperImpl
44 {
45     /* IUnknown fields */
46     ICOM_VFIELD(IDirectDrawClipper);
47     DWORD                            ref;
48
49     /* IDirectDrawClipper fields */
50     HWND hWnd;
51 };
52
53 /*****************************************************************************
54  * IDirectDraw implementation structure
55  */
56 struct _common_directdrawdata
57 {
58     DDPIXELFORMAT directdraw_pixelformat;
59     DDPIXELFORMAT screen_pixelformat;
60     int           pixmap_depth;
61     void (*pixel_convert)(void *src, void *dst, DWORD width, DWORD height, LONG pitch, IDirectDrawPaletteImpl* palette);
62     void (*palette_convert)(LPPALETTEENTRY palent, void *screen_palette, DWORD start, DWORD count);
63     DWORD         height,width; /* SetDisplayMode */
64     HWND          mainWindow;   /* SetCooperativeLevel */
65
66     /* This is for Wine's fake mainWindow.
67        We need it also in DGA mode to make some games (for example Monkey Island III work) */
68     ATOM          winclass;
69     HWND          window;
70     Window        drawable;
71     PAINTSTRUCT   ps;
72     int           paintable;
73 };
74
75 struct _dga_directdrawdata
76 {
77     DWORD        fb_width,fb_height,fb_banksize,fb_memsize;
78     void*        fb_addr;
79     unsigned int vpmask;
80 };
81
82 struct _xlib_directdrawdata
83 {
84 #ifdef HAVE_LIBXXSHM
85     int xshm_active, xshm_compl;
86 #endif /* defined(HAVE_LIBXXSHM) */
87     
88     /* are these needed for anything? (draw_surf is the active surface)
89     IDirectDrawSurfaceImpl* surfs;
90     DWORD               num_surfs, alloc_surfs, draw_surf; */
91 };
92
93 struct IDirectDrawImpl
94 {
95     /* IUnknown fields */
96     ICOM_VFIELD(IDirectDraw);
97     DWORD                     ref;
98     /* IDirectDraw fields */
99     struct _common_directdrawdata   d;
100     union {
101         struct _xlib_directdrawdata xlib;
102         struct _dga_directdrawdata  dga;
103     } e;
104 };
105
106 /*****************************************************************************
107  * IDirectDraw2 implementation structure
108  */
109 struct IDirectDraw2Impl
110 {
111     /* IUnknown fields */
112     ICOM_VFIELD(IDirectDraw2);
113     DWORD                      ref;
114     /* IDirectDraw2 fields */
115     struct _common_directdrawdata   d;
116     union {
117         struct _xlib_directdrawdata xlib;
118         struct _dga_directdrawdata  dga;
119     } e;
120 };
121
122 /*****************************************************************************
123  * IDirectDraw4 implementation structure
124  */
125 struct IDirectDraw4Impl
126 {
127     /* IUnknown fields */
128     ICOM_VFIELD(IDirectDraw4);
129     DWORD                      ref;
130     /* IDirectDraw4 fields */
131     struct _common_directdrawdata   d;
132     union {
133         struct _xlib_directdrawdata xlib;
134         struct _dga_directdrawdata  dga;
135     } e;
136 };
137
138 /*****************************************************************************
139  * IDirectDrawSurface implementation structure
140  */
141 struct _common_directdrawsurface
142 {
143     IDirectDrawPaletteImpl*     palette;
144     IDirectDraw2Impl*           ddraw;
145
146     struct _surface_chain       *chain;
147
148     DDSURFACEDESC               surface_desc;
149
150     /* For Get / Release DC methods */
151     HBITMAP DIBsection;
152     void *bitmap_data;
153     HDC hdc;
154     HGDIOBJ holdbitmap;
155     
156     /* Callback for loaded textures */
157     IDirect3DTexture2Impl*      texture;
158     HRESULT WINAPI            (*SetColorKey_cb)(IDirect3DTexture2Impl *texture, DWORD dwFlags, LPDDCOLORKEY ckey ) ;
159
160     /* Storage for attached device (void * as it can be either a Device or a Device2) */
161     void                       *d3d_device;
162 };
163
164 struct _dga_directdrawsurface
165 {
166     DWORD               fb_height;
167 };
168
169 struct _xlib_directdrawsurface
170 {
171     XImage              *image;
172 #ifdef HAVE_LIBXXSHM
173     XShmSegmentInfo     shminfo;
174 #endif
175 };
176
177 struct IDirectDrawSurfaceImpl
178 {
179     /* IUnknown fields */
180     ICOM_VFIELD(IDirectDrawSurface);
181     DWORD                            ref;
182     /* IDirectDrawSurface fields */
183     struct _common_directdrawsurface    s;
184     union {
185         struct _dga_directdrawsurface   dga;
186         struct _xlib_directdrawsurface  xlib;
187     } t;
188     LPDIRECTDRAWCLIPPER lpClipper;
189 };
190
191 /*****************************************************************************
192  * IDirectDrawSurface2 implementation structure
193  */
194 struct IDirectDrawSurface2Impl
195 {
196     /* IUnknown fields */
197     ICOM_VFIELD(IDirectDrawSurface2);
198     DWORD                             ref;
199     /* IDirectDrawSurface2 fields */
200     struct _common_directdrawsurface    s;
201     union {
202         struct _dga_directdrawsurface   dga;
203         struct _xlib_directdrawsurface  xlib;
204     } t;
205     LPDIRECTDRAWCLIPPER lpClipper;
206 };
207
208 /*****************************************************************************
209  * IDirectDrawSurface3 implementation structure
210  */
211 struct IDirectDrawSurface3Impl
212 {
213     /* IUnknown fields */
214     ICOM_VFIELD(IDirectDrawSurface3);
215     DWORD                             ref;
216     /* IDirectDrawSurface3 fields */
217     struct _common_directdrawsurface    s;
218     union {
219         struct _dga_directdrawsurface   dga;
220         struct _xlib_directdrawsurface  xlib;
221     } t;
222     LPDIRECTDRAWCLIPPER lpClipper;
223 };
224
225 /*****************************************************************************
226  * IDirectDrawSurface4 implementation structure
227  */
228 struct IDirectDrawSurface4Impl
229 {
230     /* IUnknown fields */
231     ICOM_VFIELD(IDirectDrawSurface4);
232     DWORD                             ref;
233
234     /* IDirectDrawSurface4 fields */
235     struct _common_directdrawsurface    s;
236     union {
237         struct _dga_directdrawsurface   dga;
238         struct _xlib_directdrawsurface  xlib;
239     } t;
240     LPDIRECTDRAWCLIPPER lpClipper;
241 } ;
242
243 struct _surface_chain {
244         IDirectDrawSurface4Impl **surfaces;
245         int                     nrofsurfaces;
246 };
247
248 /*****************************************************************************
249  * IDirectDrawColorControl implementation structure
250  */
251 struct IDirectDrawColorControlImpl
252 {
253     /* IUnknown fields */
254     ICOM_VFIELD(IDirectDrawColorControl);
255     DWORD                                 ref;
256     /* IDirectDrawColorControl fields */
257     /* none */
258 };
259
260
261 #endif /* __GRAPHICS_WINE_DDRAW_PRIVATE_H */