ReactOS  0.4.14-dev-998-g623dd26
ddsurf.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: ReactOS kernel
4  * PURPOSE: Native DirectDraw implementation
5  * FILE: win32ss/reactx/ntddraw/ddsurf.c
6  * PROGRAMER: Magnus Olsen (greatlord@reactos.org)
7  * REVISION HISTORY:
8  * 19/7-2006 Magnus Olsen
9  */
10 
11 #include <win32k.h>
12 #include <debug.h>
13 
14 /************************************************************************/
15 /* NtGdiDdDestroySurface */
16 /************************************************************************/
17 DWORD
19 NtGdiDdDestroySurface(HANDLE hSurface, BOOL bRealDestroy)
20 {
22 
23  if (pfnDdDestroySurface == NULL)
24  {
25  DPRINT1("Warning: no pfnDdDestroySurface");
27  }
28 
29  DPRINT1("Calling on dxg.sys pfnDdDestroySurface");
30  return pfnDdDestroySurface(hSurface, bRealDestroy);
31 }
32 
33 /************************************************************************/
34 /* NtGdiDdFlip */
35 /************************************************************************/
36 DWORD
38 NtGdiDdFlip(HANDLE hSurfaceCurrent,
39  HANDLE hSurfaceTarget,
40  HANDLE hSurfaceCurrentLeft,
41  HANDLE hSurfaceTargetLeft,
42  PDD_FLIPDATA puFlipData)
43 {
45 
46  if (pfnDdDdFlip == NULL)
47  {
48  DPRINT1("Warning: no pfnDdDdFlip");
50  }
51 
52  DPRINT1("Calling on dxg.sys pfnDdDdFlip");
53  return pfnDdDdFlip(hSurfaceCurrent, hSurfaceTarget, hSurfaceCurrentLeft, hSurfaceTargetLeft, puFlipData);
54 }
55 
56 /************************************************************************/
57 /* NtGdiDdUnlock */
58 /************************************************************************/
59 DWORD
62  PDD_LOCKDATA puLockData,
63  HDC hdcClip)
64 {
66 
67  if (pfnDdLock == NULL)
68  {
69  DPRINT1("Warning: no pfnDdLock");
71  }
72 
73  DPRINT1("Calling on dxg.sys pfnDdLock");
74  return pfnDdLock(hSurface, puLockData, hdcClip);
75 }
76 
77 /************************************************************************/
78 /* NtGdiDdunlock */
79 /************************************************************************/
80 DWORD
83  PDD_UNLOCKDATA puUnlockData)
84 {
86 
87  if (pfnDdUnlock == NULL)
88  {
89  DPRINT1("Warning: no pfnDdUnlock");
91  }
92 
93  DPRINT1("Calling on dxg.sys pfnDdUnlock");
94  return pfnDdUnlock(hSurface, puUnlockData);
95 }
96 
97 /************************************************************************/
98 /* NtGdiDdBlt */
99 /************************************************************************/
100 DWORD
101 APIENTRY
102 NtGdiDdBlt(HANDLE hSurfaceDest,
103  HANDLE hSurfaceSrc,
104  PDD_BLTDATA puBltData)
105 {
107 
108  if (pfnDdBlt == NULL)
109  {
110  DPRINT1("Warning: no pfnDdBlt");
112  }
113 
114  DPRINT1("Calling on dxg.sys DdBlt");
115  return pfnDdBlt(hSurfaceDest,hSurfaceSrc,puBltData);
116 }
117 
118 /************************************************************************/
119 /* NtGdiDdSetColorKey */
120 /************************************************************************/
121 DWORD
122 APIENTRY
124  PDD_SETCOLORKEYDATA puSetColorKeyData)
125 {
127 
128  if (pfnDdSetColorKey == NULL)
129  {
130  DPRINT1("Warning: no pfnDdSetColorKey");
132  }
133 
134  DPRINT1("Calling on dxg.sys pfnDdSetColorKey");
135  return pfnDdSetColorKey(hSurface,puSetColorKeyData);
136 
137 }
138 
139 /************************************************************************/
140 /* NtGdiDdAddAttachedSurface */
141 /************************************************************************/
142 
143 DWORD
144 APIENTRY
146  HANDLE hSurfaceAttached,
147  PDD_ADDATTACHEDSURFACEDATA puAddAttachedSurfaceData)
148 {
150 
151  if (pfnDdAddAttachedSurface == NULL)
152  {
153  DPRINT1("Warning: no pfnDdAddAttachedSurface");
155  }
156 
157  DPRINT1("Calling on dxg.sys DdAddAttachedSurface");
158  return pfnDdAddAttachedSurface(hSurface,hSurfaceAttached,puAddAttachedSurfaceData);
159 }
160 
161 /************************************************************************/
162 /* NtGdiDdGetBltStatus */
163 /************************************************************************/
164 DWORD
165 APIENTRY
167  PDD_GETBLTSTATUSDATA puGetBltStatusData)
168 {
170 
171  if (pfnDdGetBltStatus == NULL)
172  {
173  DPRINT1("Warning: no pfnDdGetBltStatus");
175  }
176 
177  DPRINT1("Calling on dxg.sys pfnDdGetBltStatus");
178  return pfnDdGetBltStatus(hSurface,puGetBltStatusData);
179 }
180 
181 /************************************************************************/
182 /* NtGdiDdGetFlipStatus */
183 /************************************************************************/
184 DWORD
185 APIENTRY
187  PDD_GETFLIPSTATUSDATA puGetFlipStatusData)
188 {
190 
191  if (pfnDdGetFlipStatus == NULL)
192  {
193  DPRINT1("Warning: no pfnDdGetFlipStatus");
195  }
196 
197  DPRINT1("Calling on dxg.sys pfnDdGetFlipStatus");
198  return pfnDdGetFlipStatus(hSurface,puGetFlipStatusData);
199 }
200 
201 /************************************************************************/
202 /* NtGdiDdUpdateOverlay */
203 /************************************************************************/
204 DWORD
205 APIENTRY
206 NtGdiDdUpdateOverlay(HANDLE hSurfaceDestination,
207  HANDLE hSurfaceSource,
208  PDD_UPDATEOVERLAYDATA puUpdateOverlayData)
209 {
211 
212  if (pfnDdUpdateOverlay == NULL)
213  {
214  DPRINT1("Warning: no pfnDdUpdateOverlay");
216  }
217 
218  DPRINT1("Calling on dxg.sys pfnDdUpdateOverlay");
219  return pfnDdUpdateOverlay(hSurfaceDestination,hSurfaceSource,puUpdateOverlayData);
220 }
221 
222 /************************************************************************/
223 /* NtGdiDdSetOverlayPosition */
224 /************************************************************************/
225 
226 DWORD
227 APIENTRY
229  HANDLE hSurfaceDestination,
230  PDD_SETOVERLAYPOSITIONDATA puSetOverlayPositionData)
231 {
233 
234  if (pfnDdSetOverlayPosition == NULL)
235  {
236  DPRINT1("Warning: no pfnDdSetOverlayPosition");
238  }
239 
240  DPRINT1("Calling on dxg.sys pfnDdSetOverlayPosition");
241  return pfnDdSetOverlayPosition(hSurfaceSource,hSurfaceDestination,puSetOverlayPositionData);
242 }
243 
244 /************************************************************************/
245 /* This is not part of the ddsurface interface but it */
246 /* deals with the surface */
247 /************************************************************************/
248 
249 
250 /************************************************************************/
251 /* NtGdiDdAlphaBlt */
252 /************************************************************************/
253 DWORD
254 APIENTRY
255 NtGdiDdAlphaBlt(HANDLE hSurfaceDest,
256  HANDLE hSurfaceSrc,
257  PDD_BLTDATA puBltData)
258 {
260 
261  if (pfnDdAlphaBlt == NULL)
262  {
263  DPRINT1("Warning: no pfnDdAlphaBlt");
265  }
266 
267  DPRINT1("Calling on dxg.sys DdAlphaBlt");
268  return pfnDdAlphaBlt(hSurfaceDest,hSurfaceSrc,puBltData);
269 }
270 
271 /************************************************************************/
272 /* NtGdiDdAttachSurface */
273 /************************************************************************/
274 BOOL
275 APIENTRY
277  HANDLE hSurfaceTo
278 )
279 {
281 
282  if (pfnDdAttachSurface == NULL)
283  {
284  DPRINT1("Warning: no pfnDdAttachSurface");
286  }
287 
288  DPRINT1("Calling on dxg.sys pfnDdAttachSurface");
289  return pfnDdAttachSurface(hSurfaceFrom,hSurfaceTo);
290 }
291 
292 /************************************************************************/
293 /* NtGdiDdUnattachSurface */
294 /************************************************************************/
295 /* Note: MSDN protypes is VOID APIENTRY NtGdiDdUnattachSurface(HANDLE hSurface, HANDLE hSurfaceAttached)
296  But it say it return either DDHAL_DRIVER_NOTHANDLED or DDHAL_DRIVER_HANDLED
297  so I guess it is a typo in MSDN for this prototype for the info contradicts itself.
298 */
299 NTSTATUS
300 APIENTRY
302  HANDLE hSurfaceAttached)
303 {
305  if (pfnDdUnattachSurface == NULL)
306  {
307  DPRINT1("Warning: no pfnDdUnattachSurface");
308  //return DDHAL_DRIVER_NOTHANDLED;
309  return STATUS_NOT_IMPLEMENTED;
310  }
311 
312  DPRINT1("Calling on dxg.sys pfnDdUnattachSurface");
313  return pfnDdUnattachSurface(hSurface,hSurfaceAttached);
314 }
NTSTATUS APIENTRY NtGdiDdUnattachSurface(HANDLE hSurface, HANDLE hSurfaceAttached)
Definition: ddsurf.c:301
DWORD(APIENTRY * PGD_DXDDGETBLTSTATUS)(HANDLE, PDD_GETBLTSTATUSDATA)
Definition: intddraw.h:98
DWORD(APIENTRY * PGD_DXDDUPDATEOVERLAY)(HANDLE, HANDLE, PDD_UPDATEOVERLAYDATA)
Definition: intddraw.h:100
DWORD APIENTRY NtGdiDdBlt(HANDLE hSurfaceDest, HANDLE hSurfaceSrc, PDD_BLTDATA puBltData)
Definition: ddsurf.c:102
DWORD APIENTRY NtGdiDdFlip(HANDLE hSurfaceCurrent, HANDLE hSurfaceTarget, HANDLE hSurfaceCurrentLeft, HANDLE hSurfaceTargetLeft, PDD_FLIPDATA puFlipData)
Definition: ddsurf.c:38
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define DXG_INDEX_DxDdUnlock
Definition: dxg.h:66
#define DDHAL_DRIVER_NOTHANDLED
Definition: ddrawi.h:320
LONG NTSTATUS
Definition: precomp.h:26
static HDC
Definition: imagelist.c:92
DWORD APIENTRY NtGdiDdDestroySurface(HANDLE hSurface, BOOL bRealDestroy)
Definition: ddsurf.c:19
#define DXG_INDEX_DxDdUnattachSurface
Definition: dxg.h:64
DWORD APIENTRY NtGdiDdSetOverlayPosition(HANDLE hSurfaceSource, HANDLE hSurfaceDestination, PDD_SETOVERLAYPOSITIONDATA puSetOverlayPositionData)
Definition: ddsurf.c:228
DWORD(APIENTRY * PGD_DXDDLOCK)(HANDLE, PDD_LOCKDATA, HDC)
Definition: intddraw.h:93
DWORD APIENTRY NtGdiDdLock(HANDLE hSurface, PDD_LOCKDATA puLockData, HDC hdcClip)
Definition: ddsurf.c:61
unsigned int BOOL
Definition: ntddk_ex.h:94
DWORD(APIENTRY * PGD_DDADDATTACHEDSURFACE)(HANDLE, HANDLE, PDD_ADDATTACHEDSURFACEDATA)
Definition: intddraw.h:97
#define DXG_INDEX_DxDdFlip
Definition: dxg.h:37
smooth NULL
Definition: ftsmooth.c:416
DWORD APIENTRY NtGdiDdAddAttachedSurface(HANDLE hSurface, HANDLE hSurfaceAttached, PDD_ADDATTACHEDSURFACEDATA puAddAttachedSurfaceData)
Definition: ddsurf.c:145
#define DXG_INDEX_DxDdGetFlipStatus
Definition: dxg.h:44
BOOL(APIENTRY * PGD_DDATTACHSURFACE)(HANDLE, HANDLE)
Definition: intddraw.h:89
DWORD APIENTRY NtGdiDdSetColorKey(HANDLE hSurface, PDD_SETCOLORKEYDATA puSetColorKeyData)
Definition: ddsurf.c:123
DWORD(APIENTRY * PGD_DDBLT)(HANDLE, HANDLE, PDD_BLTDATA)
Definition: intddraw.h:95
BOOL APIENTRY NtGdiDdAttachSurface(HANDLE hSurfaceFrom, HANDLE hSurfaceTo)
Definition: ddsurf.c:276
#define DXG_INDEX_DxDdSetOverlayPosition
Definition: dxg.h:63
DWORD APIENTRY NtGdiDdUpdateOverlay(HANDLE hSurfaceDestination, HANDLE hSurfaceSource, PDD_UPDATEOVERLAYDATA puUpdateOverlayData)
Definition: ddsurf.c:206
#define DXG_INDEX_DxDdDestroySurface
Definition: dxg.h:34
DWORD(APIENTRY * PGD_DXDDSETOVERLAYPOSITION)(HANDLE, HANDLE, PDD_SETOVERLAYPOSITIONDATA)
Definition: intddraw.h:101
#define DXG_INDEX_DxDdAttachSurface
Definition: dxg.h:19
#define DXG_INDEX_DxDdSetColorKey
Definition: dxg.h:59
unsigned long DWORD
Definition: ntddk_ex.h:95
#define DXG_INDEX_DxDdUpdateOverlay
Definition: dxg.h:68
DWORD(APIENTRY * PGD_DXDDSETCOLORKEY)(HANDLE, PDD_SETCOLORKEYDATA)
Definition: intddraw.h:96
DRVFN gpDxFuncs[DXG_INDEX_DxDdIoctl+1]
Definition: ddraw.c:23
#define DXG_INDEX_DxDdLock
Definition: dxg.h:51
DWORD(APIENTRY * PGD_DXDDFLIP)(HANDLE, HANDLE, HANDLE, HANDLE, PDD_FLIPDATA)
Definition: intddraw.h:92
DWORD APIENTRY NtGdiDdAlphaBlt(HANDLE hSurfaceDest, HANDLE hSurfaceSrc, PDD_BLTDATA puBltData)
Definition: ddsurf.c:255
DWORD APIENTRY NtGdiDdUnlock(HANDLE hSurface, PDD_UNLOCKDATA puUnlockData)
Definition: ddsurf.c:82
DWORD APIENTRY NtGdiDdGetFlipStatus(HANDLE hSurface, PDD_GETFLIPSTATUSDATA puGetFlipStatusData)
Definition: ddsurf.c:186
#define DPRINT1
Definition: precomp.h:8
DWORD APIENTRY NtGdiDdGetBltStatus(HANDLE hSurface, PDD_GETBLTSTATUSDATA puGetBltStatusData)
Definition: ddsurf.c:166
#define DXG_INDEX_DxDdGetBltStatus
Definition: dxg.h:40
DWORD(APIENTRY * PGD_DXDDUNLOCK)(HANDLE, PDD_UNLOCKDATA)
Definition: intddraw.h:94
#define DXG_INDEX_DxDdBlt
Definition: dxg.h:21
DWORD(APIENTRY * PGD_DXDDUNATTACHSURFACE)(HANDLE, HANDLE)
Definition: intddraw.h:90
DWORD(APIENTRY * PGD_DXDDDESTROYSURFACE)(HANDLE, BOOL)
Definition: intddraw.h:91
DWORD(APIENTRY * PGD_DXDDGETFLIPSTATUS)(HANDLE, PDD_GETFLIPSTATUSDATA)
Definition: intddraw.h:99
#define DXG_INDEX_DxDdAddAttachedSurface
Definition: dxg.h:17
#define APIENTRY
Definition: api.h:79
DWORD(APIENTRY * PGD_DDALPHABLT)(HANDLE, HANDLE, PDD_BLTDATA)
Definition: intddraw.h:88
#define DXG_INDEX_DxDdAlphaBlt
Definition: dxg.h:18