Grammar and spelling corrections for the documentation and comments.
[reactos.git] / reactos / subsystems / win32 / win32k / ntddraw / dxeng.c
index 74ee276..9e5b345 100644 (file)
@@ -96,11 +96,11 @@ DxEngRedrawDesktop()
 ULONG
 DxEngDispUniq()
 {
-    /* FIXME DisplayUniqVisrgn from gdishare memory */
-    UNIMPLEMENTED;
-    return FALSE;
+    return GdiHandleTable->flDeviceUniq;
 }
 
+ULONG gulVisRgnUniqueness; // Increase count everytime client region is updated.
+
 /************************************************************************/
 /* DxEngVisRgnUniq                                                      */
 /************************************************************************/
@@ -108,33 +108,44 @@ DxEngDispUniq()
 ULONG
 DxEngVisRgnUniq()
 {
-    /* FIXME DisplayUniqVisrgn from gdishare memory */
-    UNIMPLEMENTED;
-    return FALSE;
+    return gulVisRgnUniqueness;
 }
 
 /************************************************************************/
 /* DxEngEnumerateHdev                                                   */
 /************************************************************************/
-/* Enumate all drivers in win32k */
+/* Enumerate all drivers in win32k */
 HDEV *
 DxEngEnumerateHdev(HDEV *hdev)
 {
-    /* FIXME Enumate all drivers in win32k */
+    /* FIXME Enumerate all drivers in win32k */
     UNIMPLEMENTED;
     return FALSE;
 }
 
-/************************************************************************/
-/* DxEngGetDeviceGammaRamp                                              */
-/************************************************************************/
-/* same protypes NtGdiEngGetDeviceGammaRamp, diffent is we skipp the user mode checks and seh */
+/*++
+* @name DxEngGetDeviceGammaRamp
+* @implemented
+*
+* The function DxEngSetDeviceGammaRamp Set Gamma ramp from from dxg.sys
+
+* @param HDEV hPDev
+* The hdev
+*
+* @param PGAMMARAMP Ramp
+* to fill in our gamma ramp
+*
+* @return
+*Returns TRUE for success, FALSE for failure
+*
+* @remarks.
+* ReactOS does not loop it, only sets the gamma once.
+*
+*--*/
 BOOL
-DxEngGetDeviceGammaRamp(HDC hDC, LPVOID lpRamp)
+DxEngGetDeviceGammaRamp(HDEV hPDev, PGAMMARAMP Ramp)
 {
-    /* FIXME redirect it to NtGdiEngGetDeviceGammaRamp internal call  */
-    UNIMPLEMENTED;
-    return FALSE;
+    return IntGetDeviceGammaRamp(hPDev, Ramp);
 }
 
 
@@ -142,13 +153,13 @@ DxEngGetDeviceGammaRamp(HDC hDC, LPVOID lpRamp)
 * @name DxEngLockDC
 * @implemented
 *
-* The function DxEngLockDC lock a hdc from dxg.sys 
+* The function DxEngLockDC locks a hdc from dxg.sys
 *
 * @param HDC hDC
-* The handle we need want lock
+* The handle we want to lock
 *
-* @return 
-* This api return PDC or NULL depns if it sussess lock the hdc or not
+* @return
+* Returns PDC if lock succeeded or NULL depns if it failed
 *
 * @remarks.
 * none
@@ -165,13 +176,13 @@ DxEngLockDC(HDC hDC)
 * @name DxEngUnlockDC
 * @implemented
 *
-* The function DxEngUnlockDC Unlock a pDC (hdc) from dxg.sys 
+* The function DxEngUnlockDC unlocks a pDC (hdc) from dxg.sys
 
 * @param PDC pDC
-* The handle we need unlock
+* The handle we want to unlock
 *
-* @return 
-* This api always return TRUE if it sussess or not 
+* @return
+* This function returns TRUE no matter what
 *
 * @remarks.
 * none
@@ -267,13 +278,33 @@ DWORD DxEngUnreferenceHdev(DWORD x1)
     return FALSE;
 }
 
-/************************************************************************/
-/* DxEngSetDeviceGammaRamp                                              */
-/************************************************************************/
-DWORD DxEngSetDeviceGammaRamp(DWORD x1, DWORD x2, DWORD x3)
+
+/*++
+* @name DxEngSetDeviceGammaRamp
+* @implemented
+*
+* The function DxEngSetDeviceGammaRamp sets gamma ramp from dxg.sys
+
+* @param HDEV hPDev
+* The hdev
+*
+* @param PGAMMARAMP Ramp
+* Value to change gamma ramp to
+*
+* @param BOOL Test
+* Whether gamma should be tested. TRUE to test, FALSE to not test
+*
+* @return
+*Returns TRUE for success, FALSE for failure
+*
+* @remarks.
+* ReactOS does not loop and only sets the gamma once.
+*
+*--*/
+BOOL
+DxEngSetDeviceGammaRamp(HDEV hPDev, PGAMMARAMP Ramp, BOOL Test)
 {
-    UNIMPLEMENTED;
-    return FALSE;
+   return IntSetDeviceGammaRamp(hPDev, Ramp, Test);
 }
 
 /************************************************************************/
@@ -368,40 +399,65 @@ DWORD DxEngSetDCState(DWORD x1, DWORD x2, DWORD x3)
     return FALSE;
 }
 
-/************************************************************************/
-/* DxEngGetDCState                                                      */
-/************************************************************************/
+
+
+/*++
+* @name DxEngGetDCState
+* @implemented
+*
+* The function DxEngGetDCState is capable of returning three
+* DC states depending on what value is passed in its second parameter:
+* 1. If the DC is full screen
+* 2. Get Complexity of visible region
+* 3. Get Driver hdev, which is pPDev
+*
+* @param HDC hdc
+* The DC handle
+*
+* @param DWORD type
+* value 1 = Is DC fullscreen 
+* value 2 = Get Complexity of visible region. 
+* value 3 = Get Driver hdev, which is a pPDev. 
+*
+* @return
+* Return one of the type values
+*
+* @remarks.
+* We do not have type 2 implement yet
+*
+*--*/
 DWORD
 DxEngGetDCState(HDC hDC,
                 DWORD type)
 {
-    PEDD_DIRECTDRAW_GLOBAL pEDDgpl = NULL;
     PDC pDC = DC_LockDc(hDC);
+    DWORD retVal = 0;
+
     if (pDC)
     {
         switch (type)
         {
             case 1:
-                UNIMPLEMENTED;
-                return 0;
+                retVal = (DWORD) pDC->DC_Flags & DC_FLAG_FULLSCREEN;
+                break;
             case 2:
                 UNIMPLEMENTED;
-                return 0;
+                break;
             case 3:
             {
-/*                PGDIDEVICE GDIDevice = (PGDIDEVICE)pDC->PDev; //This one is right,, we have two.*/
-                PGDIDEVICE GDIDevice = (PGDIDEVICE)pDC->GDIDevice; //Until now noone noticed.
-                pEDDgpl = GDIDevice->pEDDgpl;
-                DC_UnlockDc(pDC);
-                return (DWORD)pEDDgpl;
+                /* Return the HDEV of this DC. */            
+                retVal = (DWORD) pDC->pPDev;
+                break;
             }
             default:
-                UNIMPLEMENTED;
+                /* if a valid type is not found, zero is returned */
+                DPRINT1("Warning did not find type %d\n",type); 
                 break;
         }
+        DC_UnlockDc(pDC);
     }
 
-    return 0;
+    return retVal;
 }
 
 /************************************************************************/