Grammar and spelling corrections for the documentation and comments.
[reactos.git] / reactos / subsystems / win32 / win32k / ntddraw / dxeng.c
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * PURPOSE: Native driver enumate of dxeng implementation
5 * FILE: subsys/win32k/ntddraw/dxeng.c
6 * PROGRAMER: Magnus olsen (magnus@greatlord.com)
7 * REVISION HISTORY:
8 * 15/10-2007 Magnus Olsen
9 */
10
11 #include <w32k.h>
12 #include <debug.h>
13
14
15
16 ULONG gcEngFuncs = DXENG_INDEX_DxEngLoadImage + 1;
17 DRVFN gaEngFuncs [] =
18 {
19 {0, (PFN) NULL},
20 {DXENG_INDEX_DxEngNUIsTermSrv, (PFN)DxEngNUIsTermSrv},
21 {DXENG_INDEX_DxEngScreenAccessCheck, (PFN)DxEngScreenAccessCheck},
22 {DXENG_INDEX_DxEngRedrawDesktop, (PFN)DxEngRedrawDesktop},
23 {DXENG_INDEX_DxEngDispUniq, (PFN)DxEngDispUniq},
24 {DXENG_INDEX_DxEngIncDispUniq, (PFN)DxEngIncDispUniq},
25 {DXENG_INDEX_DxEngVisRgnUniq, (PFN)DxEngVisRgnUniq},
26 {DXENG_INDEX_DxEngLockShareSem, (PFN)DxEngLockShareSem},
27 {DXENG_INDEX_DxEngUnlockShareSem, (PFN)DxEngUnlockShareSem},
28 {DXENG_INDEX_DxEngEnumerateHdev, (PFN)DxEngEnumerateHdev},
29 {DXENG_INDEX_DxEngLockHdev, (PFN)DxEngLockHdev},
30 {DXENG_INDEX_DxEngUnlockHdev, (PFN)DxEngUnlockHdev},
31 {DXENG_INDEX_DxEngIsHdevLockedByCurrentThread, (PFN)DxEngIsHdevLockedByCurrentThread},
32 {DXENG_INDEX_DxEngReferenceHdev, (PFN)DxEngReferenceHdev},
33 {DXENG_INDEX_DxEngUnreferenceHdev, (PFN)DxEngUnreferenceHdev},
34 {DXENG_INDEX_DxEngGetDeviceGammaRamp, (PFN)DxEngGetDeviceGammaRamp},
35 {DXENG_INDEX_DxEngSetDeviceGammaRamp, (PFN)DxEngSetDeviceGammaRamp},
36 {DXENG_INDEX_DxEngSpTearDownSprites, (PFN)DxEngSpTearDownSprites},
37 {DXENG_INDEX_DxEngSpUnTearDownSprites, (PFN)DxEngSpUnTearDownSprites},
38 {DXENG_INDEX_DxEngSpSpritesVisible, (PFN)DxEngSpSpritesVisible},
39 {DXENG_INDEX_DxEngGetHdevData, (PFN)DxEngGetHdevData},
40 {DXENG_INDEX_DxEngSetHdevData, (PFN)DxEngSetHdevData},
41 {DXENG_INDEX_DxEngCreateMemoryDC, (PFN)DxEngCreateMemoryDC},
42 {DXENG_INDEX_DxEngGetDesktopDC, (PFN)DxEngGetDesktopDC},
43 {DXENG_INDEX_DxEngDeleteDC, (PFN)DxEngDeleteDC},
44 {DXENG_INDEX_DxEngCleanDC, (PFN)DxEngCleanDC},
45 {DXENG_INDEX_DxEngSetDCOwner, (PFN)DxEngSetDCOwner},
46 {DXENG_INDEX_DxEngLockDC, (PFN)DxEngLockDC},
47 {DXENG_INDEX_DxEngUnlockDC, (PFN)DxEngUnlockDC},
48 {DXENG_INDEX_DxEngSetDCState, (PFN)DxEngGetDCState},
49 {DXENG_INDEX_DxEngGetDCState, (PFN)DxEngGetDCState},
50 {DXENG_INDEX_DxEngSelectBitmap, (PFN)DxEngSelectBitmap},
51 {DXENG_INDEX_DxEngSetBitmapOwner, (PFN)DxEngSetBitmapOwner},
52 {DXENG_INDEX_DxEngDeleteSurface, (PFN)DxEngDeleteSurface},
53 {DXENG_INDEX_DxEngGetSurfaceData, (PFN)DxEngGetSurfaceData},
54 {DXENG_INDEX_DxEngAltLockSurface, (PFN)DxEngAltLockSurface},
55 {DXENG_INDEX_DxEngUploadPaletteEntryToSurface, (PFN)DxEngUploadPaletteEntryToSurface},
56 {DXENG_INDEX_DxEngMarkSurfaceAsDirectDraw, (PFN)DxEngMarkSurfaceAsDirectDraw},
57 {DXENG_INDEX_DxEngSelectPaletteToSurface, (PFN)DxEngSelectPaletteToSurface},
58 {DXENG_INDEX_DxEngSyncPaletteTableWithDevice, (PFN)DxEngSyncPaletteTableWithDevice},
59 {DXENG_INDEX_DxEngSetPaletteState, (PFN)DxEngSetPaletteState},
60 {DXENG_INDEX_DxEngGetRedirectionBitmap, (PFN)DxEngGetRedirectionBitmap},
61 {DXENG_INDEX_DxEngLoadImage, (PFN)DxEngLoadImage}
62 };
63
64 /************************************************************************/
65 /* DxEngNUIsTermSrv */
66 /************************************************************************/
67
68 /* Notes : Check see if termal server got a connections or not */
69 BOOL
70 DxEngNUIsTermSrv()
71 {
72 /* FIXME ReactOS does not suport terminal server yet, we can not check if we got a connections or not */
73 UNIMPLEMENTED;
74 return FALSE;
75 }
76
77 /************************************************************************/
78 /* DxEngRedrawDesktop */
79 /************************************************************************/
80
81 /* Notes : it always return TRUE, and it update whole the screen (redaw current desktop) */
82 BOOL
83 DxEngRedrawDesktop()
84 {
85 /* FIXME add redraw code */
86 UNIMPLEMENTED;
87 return TRUE;
88 }
89
90
91 /************************************************************************/
92 /* DxEngDispUniq */
93 /************************************************************************/
94
95 /* Notes : return the DisplayUniqVisrgn counter from gdishare memory */
96 ULONG
97 DxEngDispUniq()
98 {
99 return GdiHandleTable->flDeviceUniq;
100 }
101
102 ULONG gulVisRgnUniqueness; // Increase count everytime client region is updated.
103
104 /************************************************************************/
105 /* DxEngVisRgnUniq */
106 /************************************************************************/
107 /* Notes : return the VisRgnUniq counter for win32k */
108 ULONG
109 DxEngVisRgnUniq()
110 {
111 return gulVisRgnUniqueness;
112 }
113
114 /************************************************************************/
115 /* DxEngEnumerateHdev */
116 /************************************************************************/
117 /* Enumerate all drivers in win32k */
118 HDEV *
119 DxEngEnumerateHdev(HDEV *hdev)
120 {
121 /* FIXME Enumerate all drivers in win32k */
122 UNIMPLEMENTED;
123 return FALSE;
124 }
125
126 /*++
127 * @name DxEngGetDeviceGammaRamp
128 * @implemented
129 *
130 * The function DxEngSetDeviceGammaRamp Set Gamma ramp from from dxg.sys
131
132 * @param HDEV hPDev
133 * The hdev
134 *
135 * @param PGAMMARAMP Ramp
136 * to fill in our gamma ramp
137 *
138 * @return
139 *Returns TRUE for success, FALSE for failure
140 *
141 * @remarks.
142 * ReactOS does not loop it, only sets the gamma once.
143 *
144 *--*/
145 BOOL
146 DxEngGetDeviceGammaRamp(HDEV hPDev, PGAMMARAMP Ramp)
147 {
148 return IntGetDeviceGammaRamp(hPDev, Ramp);
149 }
150
151
152 /*++
153 * @name DxEngLockDC
154 * @implemented
155 *
156 * The function DxEngLockDC locks a hdc from dxg.sys
157 *
158 * @param HDC hDC
159 * The handle we want to lock
160 *
161 * @return
162 * Returns PDC if lock succeeded or NULL depns if it failed
163 *
164 * @remarks.
165 * none
166 *
167 *--*/
168 PDC
169 DxEngLockDC(HDC hDC)
170 {
171 return DC_LockDc(hDC);
172 }
173
174
175 /*++
176 * @name DxEngUnlockDC
177 * @implemented
178 *
179 * The function DxEngUnlockDC unlocks a pDC (hdc) from dxg.sys
180
181 * @param PDC pDC
182 * The handle we want to unlock
183 *
184 * @return
185 * This function returns TRUE no matter what
186 *
187 * @remarks.
188 * none
189 *
190 *--*/
191 BOOL
192 DxEngUnlockDC(PDC pDC)
193 {
194 DC_UnlockDc(pDC);
195 return TRUE;
196 }
197
198
199 /************************************************************************/
200 /* DxEngCreateMemoryDC */
201 /************************************************************************/
202 DWORD DxEngCreateMemoryDC(DWORD x1)
203 {
204 UNIMPLEMENTED;
205 return FALSE;
206 }
207
208 /************************************************************************/
209 /* DxEngScreenAccessCheck */
210 /************************************************************************/
211 DWORD DxEngScreenAccessCheck()
212 {
213 UNIMPLEMENTED;
214 return FALSE;
215 }
216
217 /************************************************************************/
218 /* DxEngLockShareSem */
219 /************************************************************************/
220 DWORD DxEngLockShareSem()
221 {
222 UNIMPLEMENTED;
223 return FALSE;
224 }
225
226 /************************************************************************/
227 /* DxEngUnlockShareSem */
228 /************************************************************************/
229 DWORD DxEngUnlockShareSem()
230 {
231 UNIMPLEMENTED;
232 return FALSE;
233 }
234
235 /************************************************************************/
236 /* DxEngLockHdev */
237 /************************************************************************/
238 DWORD DxEngLockHdev(DWORD x1)
239 {
240 UNIMPLEMENTED;
241 return FALSE;
242 }
243
244 /************************************************************************/
245 /* DxEngUnlockHdev */
246 /************************************************************************/
247 DWORD DxEngUnlockHdev(DWORD x1)
248 {
249 UNIMPLEMENTED;
250 return FALSE;
251 }
252
253 /************************************************************************/
254 /* DxEngReferenceHdev */
255 /************************************************************************/
256 DWORD DxEngReferenceHdev(DWORD x1)
257 {
258 UNIMPLEMENTED;
259 return FALSE;
260 }
261
262 /************************************************************************/
263 /* DxEngIsHdevLockedByCurrentThread */
264 /************************************************************************/
265 DWORD DxEngIsHdevLockedByCurrentThread(DWORD x1)
266 {
267 UNIMPLEMENTED;
268 return FALSE;
269 }
270
271
272 /************************************************************************/
273 /* DxEngUnreferenceHdev */
274 /************************************************************************/
275 DWORD DxEngUnreferenceHdev(DWORD x1)
276 {
277 UNIMPLEMENTED;
278 return FALSE;
279 }
280
281
282 /*++
283 * @name DxEngSetDeviceGammaRamp
284 * @implemented
285 *
286 * The function DxEngSetDeviceGammaRamp sets gamma ramp from dxg.sys
287
288 * @param HDEV hPDev
289 * The hdev
290 *
291 * @param PGAMMARAMP Ramp
292 * Value to change gamma ramp to
293 *
294 * @param BOOL Test
295 * Whether gamma should be tested. TRUE to test, FALSE to not test
296 *
297 * @return
298 *Returns TRUE for success, FALSE for failure
299 *
300 * @remarks.
301 * ReactOS does not loop and only sets the gamma once.
302 *
303 *--*/
304 BOOL
305 DxEngSetDeviceGammaRamp(HDEV hPDev, PGAMMARAMP Ramp, BOOL Test)
306 {
307 return IntSetDeviceGammaRamp(hPDev, Ramp, Test);
308 }
309
310 /************************************************************************/
311 /* DxEngSpTearDownSprites */
312 /************************************************************************/
313 DWORD DxEngSpTearDownSprites(DWORD x1, DWORD x2, DWORD x3)
314 {
315 UNIMPLEMENTED;
316 return FALSE;
317 }
318
319 /************************************************************************/
320 /* DxEngSpUnTearDownSprites */
321 /************************************************************************/
322 DWORD DxEngSpUnTearDownSprites(DWORD x1, DWORD x2, DWORD x3)
323 {
324 UNIMPLEMENTED;
325 return FALSE;
326 }
327
328 /************************************************************************/
329 /* DxEngSpSpritesVisible */
330 /************************************************************************/
331 DWORD DxEngSpSpritesVisible(DWORD x1)
332 {
333 UNIMPLEMENTED;
334 return FALSE;
335 }
336
337 /************************************************************************/
338 /* DxEngGetHdevData */
339 /************************************************************************/
340 DWORD
341 DxEngGetHdevData(PEDD_DIRECTDRAW_GLOBAL pEDDgpl,
342 DWORD Index)
343 {
344 UNIMPLEMENTED;
345 return 0;
346 }
347
348 /************************************************************************/
349 /* DxEngSetHdevData */
350 /************************************************************************/
351 DWORD DxEngSetHdevData(DWORD x1, DWORD x2, DWORD x3)
352 {
353 UNIMPLEMENTED;
354 return FALSE;
355 }
356
357 /************************************************************************/
358 /* DxEngGetDesktopDC */
359 /************************************************************************/
360 DWORD DxEngGetDesktopDC(DWORD x1, DWORD x2, DWORD x3)
361 {
362 UNIMPLEMENTED;
363 return FALSE;
364 }
365
366 /************************************************************************/
367 /* DxEngDeleteDC */
368 /************************************************************************/
369 DWORD DxEngDeleteDC(DWORD x1, DWORD x2)
370 {
371 UNIMPLEMENTED;
372 return FALSE;
373 }
374
375 /************************************************************************/
376 /* DxEngCleanDC */
377 /************************************************************************/
378 DWORD DxEngCleanDC(DWORD x1)
379 {
380 UNIMPLEMENTED;
381 return FALSE;
382 }
383
384 /************************************************************************/
385 /* DxEngSetDCOwner */
386 /************************************************************************/
387 DWORD DxEngSetDCOwner(DWORD x1, DWORD x2)
388 {
389 UNIMPLEMENTED;
390 return FALSE;
391 }
392
393 /************************************************************************/
394 /* DxEngSetDCState */
395 /************************************************************************/
396 DWORD DxEngSetDCState(DWORD x1, DWORD x2, DWORD x3)
397 {
398 UNIMPLEMENTED;
399 return FALSE;
400 }
401
402
403
404 /*++
405 * @name DxEngGetDCState
406 * @implemented
407 *
408 * The function DxEngGetDCState is capable of returning three
409 * DC states depending on what value is passed in its second parameter:
410 * 1. If the DC is full screen
411 * 2. Get Complexity of visible region
412 * 3. Get Driver hdev, which is pPDev
413 *
414 * @param HDC hdc
415 * The DC handle
416 *
417 * @param DWORD type
418 * value 1 = Is DC fullscreen
419 * value 2 = Get Complexity of visible region.
420 * value 3 = Get Driver hdev, which is a pPDev.
421 *
422 * @return
423 * Return one of the type values
424 *
425 * @remarks.
426 * We do not have type 2 implement yet
427 *
428 *--*/
429 DWORD
430 DxEngGetDCState(HDC hDC,
431 DWORD type)
432 {
433 PDC pDC = DC_LockDc(hDC);
434 DWORD retVal = 0;
435
436 if (pDC)
437 {
438 switch (type)
439 {
440 case 1:
441 retVal = (DWORD) pDC->DC_Flags & DC_FLAG_FULLSCREEN;
442 break;
443 case 2:
444 UNIMPLEMENTED;
445 break;
446 case 3:
447 {
448 /* Return the HDEV of this DC. */
449 retVal = (DWORD) pDC->pPDev;
450 break;
451 }
452 default:
453 /* if a valid type is not found, zero is returned */
454 DPRINT1("Warning did not find type %d\n",type);
455 break;
456 }
457 DC_UnlockDc(pDC);
458 }
459
460 return retVal;
461 }
462
463 /************************************************************************/
464 /* DxEngSelectBitmap */
465 /************************************************************************/
466 DWORD DxEngSelectBitmap(DWORD x1, DWORD x2)
467 {
468 UNIMPLEMENTED;
469 return FALSE;
470 }
471
472 /************************************************************************/
473 /* DxEngSetBitmapOwner */
474 /************************************************************************/
475 DWORD DxEngSetBitmapOwner(DWORD x1, DWORD x2)
476 {
477 UNIMPLEMENTED;
478 return FALSE;
479 }
480
481 /************************************************************************/
482 /* DxEngDeleteSurface */
483 /************************************************************************/
484 DWORD DxEngDeleteSurface(DWORD x1)
485 {
486 UNIMPLEMENTED;
487 return FALSE;
488 }
489
490 /************************************************************************/
491 /* DxEngGetSurfaceData */
492 /************************************************************************/
493 DWORD DxEngGetSurfaceData(DWORD x1, DWORD x2)
494 {
495 UNIMPLEMENTED;
496 return FALSE;
497 }
498
499 /************************************************************************/
500 /* DxEngAltLockSurface */
501 /************************************************************************/
502 DWORD DxEngAltLockSurface(DWORD x1)
503 {
504 UNIMPLEMENTED;
505 return FALSE;
506 }
507
508 /************************************************************************/
509 /* DxEngUploadPaletteEntryToSurface */
510 /************************************************************************/
511 DWORD DxEngUploadPaletteEntryToSurface(DWORD x1, DWORD x2,DWORD x3, DWORD x4)
512 {
513 UNIMPLEMENTED;
514 return FALSE;
515 }
516
517 /************************************************************************/
518 /* DxEngMarkSurfaceAsDirectDraw */
519 /************************************************************************/
520 DWORD DxEngMarkSurfaceAsDirectDraw(DWORD x1, DWORD x2)
521 {
522 UNIMPLEMENTED;
523 return FALSE;
524 }
525
526 /************************************************************************/
527 /* DxEngSelectPaletteToSurface */
528 /************************************************************************/
529 DWORD DxEngSelectPaletteToSurface(DWORD x1, DWORD x2)
530 {
531 UNIMPLEMENTED;
532 return FALSE;
533 }
534
535 /************************************************************************/
536 /* DxEngSyncPaletteTableWithDevice */
537 /************************************************************************/
538 DWORD DxEngSyncPaletteTableWithDevice(DWORD x1, DWORD x2)
539 {
540 UNIMPLEMENTED;
541 return FALSE;
542 }
543
544 /************************************************************************/
545 /* DxEngSetPaletteState */
546 /************************************************************************/
547 DWORD DxEngSetPaletteState(DWORD x1, DWORD x2, DWORD x3)
548 {
549 UNIMPLEMENTED;
550 return FALSE;
551 }
552
553 /************************************************************************/
554 /* DxEngGetRedirectionBitmap */
555 /************************************************************************/
556 DWORD DxEngGetRedirectionBitmap(DWORD x1)
557 {
558 UNIMPLEMENTED;
559 return FALSE;
560 }
561
562 /************************************************************************/
563 /* DxEngLoadImage */
564 /************************************************************************/
565 DWORD DxEngLoadImage(DWORD x1,DWORD x2)
566 {
567 UNIMPLEMENTED;
568 return FALSE;
569 }
570
571 /************************************************************************/
572 /* DxEngIncDispUniq */
573 /************************************************************************/
574 DWORD DxEngIncDispUniq()
575 {
576 UNIMPLEMENTED;
577 return FALSE;
578 }
579
580