[WIN32K]
authorJérôme Gardou <jerome.gardou@reactos.org>
Sat, 3 Apr 2010 16:32:30 +0000 (16:32 +0000)
committerJérôme Gardou <jerome.gardou@reactos.org>
Sat, 3 Apr 2010 16:32:30 +0000 (16:32 +0000)
Unlock/lock surface when locking DC

svn path=/branches/reactos-yarotows/; revision=46697

subsystems/win32/win32k/include/dc.h

index a662300..a209ff2 100644 (file)
@@ -169,15 +169,19 @@ DC_LockDc(HDC hdc)
 {
     PDC pdc;
     pdc = GDIOBJ_LockObj(hdc, GDILoObjType_LO_DC_TYPE);
 {
     PDC pdc;
     pdc = GDIOBJ_LockObj(hdc, GDILoObjType_LO_DC_TYPE);
-    
+
     /* Direct DC's need PDEV locking */
     if(pdc && pdc->dctype == DCTYPE_DIRECT)
     {
         /* Acquire shared PDEV lock */
         EngAcquireSemaphoreShared(pdc->ppdev->hsemDevLock);
     /* Direct DC's need PDEV locking */
     if(pdc && pdc->dctype == DCTYPE_DIRECT)
     {
         /* Acquire shared PDEV lock */
         EngAcquireSemaphoreShared(pdc->ppdev->hsemDevLock);
-        
-        /* Get the current surface */
-        pdc->dclevel.pSurface = pdc->ppdev->pSurface;
+
+        /* Update Surface if needed */
+        if(pdc->dclevel.pSurface != pdc->ppdev->pSurface)
+        {
+            if(pdc->dclevel.pSurface) SURFACE_ShareUnlockSurface(pdc->dclevel.pSurface);
+            pdc->dclevel.pSurface = PDEVOBJ_pSurface(pdc->ppdev);
+        }
     }
     return pdc;
 }
     }
     return pdc;
 }