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