[CMAKE]
[reactos.git] / subsystems / win32 / win32k / objects / dibobj.c
index 2fe1e4c..fdc8f92 100644 (file)
@@ -164,7 +164,7 @@ IntSetDIBColorTable(
             return 0;
         }
 
-        PalGDI = PALETTE_LockPalette(psurf->ppal->BaseObject.hHmgr);
+        PalGDI = psurf->ppal;
 
         for (Index = StartIndex;
                 Index < StartIndex + Entries && Index < PalGDI->NumColors;
@@ -174,7 +174,6 @@ IntSetDIBColorTable(
             PalGDI->IndexedColors[Index].peGreen = Colors[Index - StartIndex].rgbGreen;
             PalGDI->IndexedColors[Index].peBlue = Colors[Index - StartIndex].rgbBlue;
         }
-        PALETTE_UnlockPalette(PalGDI);
     }
     else
         Entries = 0;
@@ -277,8 +276,8 @@ IntSetDIBits(
                   bmi->bmiHeader.biHeight,
                   bmi->bmiHeader.biBitCount));
 
-    psurfDst = SURFACE_LockSurface(hBitmap);
-    psurfSrc = SURFACE_LockSurface(SourceBitmap);
+    psurfDst = SURFACE_ShareLockSurface(hBitmap);
+    psurfSrc = SURFACE_ShareLockSurface(SourceBitmap);
 
     if(!(psurfSrc && psurfDst))
     {
@@ -311,11 +310,11 @@ IntSetDIBits(
 cleanup:
     if(psurfSrc)
     {
-        SURFACE_UnlockSurface(psurfSrc);
+        SURFACE_ShareUnlockSurface(psurfSrc);
     }
     if(psurfDst)
     {
-        SURFACE_UnlockSurface(psurfDst);
+        SURFACE_ShareUnlockSurface(psurfDst);
     }
     GreDeleteObject(SourceBitmap);
 
@@ -514,7 +513,7 @@ NtGdiSetDIBitsToDeviceInternal(
     }
 
     /* Lock the DIB palette */
-    ppalDIB = PALETTE_LockPalette(hpalDIB);
+    ppalDIB = PALETTE_ShareLockPalette(hpalDIB);
     if (!ppalDIB)
     {
         EngSetLastError(ERROR_INVALID_HANDLE);
@@ -555,11 +554,11 @@ Exit:
         ret = ScanLines;
     }
 
-    if (ppalDIB) PALETTE_UnlockPalette(ppalDIB);
+    if (ppalDIB) PALETTE_ShareUnlockPalette(ppalDIB);
 
     if (pSourceSurf) EngUnlockSurface(pSourceSurf);
     if (hSourceBitmap) EngDeleteSurface((HSURF)hSourceBitmap);
-    if (hpalDIB) PALETTE_FreePaletteByHandle(hpalDIB);
+    if (hpalDIB) GreDeleteObject(hpalDIB);
     DC_UnlockDc(pDC);
 
     return ret;
@@ -766,7 +765,7 @@ NtGdiGetDIBitsInternal(
                 /* For color DDBs in native depth (mono DDBs always have
                    a black/white palette):
                    Generate the color map from the selected palette */
-                PPALETTE pDcPal = PALETTE_LockPalette(pDC->dclevel.hpal);
+                PPALETTE pDcPal = PALETTE_ShareLockPalette(pDC->dclevel.hpal);
                 if(!pDcPal)
                 {
                     ScanLines = 0 ;
@@ -786,7 +785,7 @@ NtGdiGetDIBitsInternal(
                     rgbQuads[i].rgbBlue     = pDcPal->IndexedColors[i].peBlue;
                     rgbQuads[i].rgbReserved = 0;
                 }
-                PALETTE_UnlockPalette(pDcPal);
+                PALETTE_ShareUnlockPalette(pDcPal);
             }
             else
             {
@@ -1548,10 +1547,10 @@ DIB_CreateDIBSection(
     {
         if(dc)
         {
-            PPALETTE pdcPal ;
-            pdcPal = PALETTE_LockPalette(dc->dclevel.hpal);
-            hpal = DIB_MapPaletteColors(pdcPal, bmi);
-            PALETTE_UnlockPalette(pdcPal);
+            PPALETTE ppalDc;
+            ppalDc = PALETTE_ShareLockPalette(dc->dclevel.hpal);
+            hpal = DIB_MapPaletteColors(ppalDc, bmi);
+            PALETTE_ShareUnlockPalette(ppalDc);
         }
         else
         {
@@ -1590,7 +1589,7 @@ DIB_CreateDIBSection(
         EngSetLastError(ERROR_NO_SYSTEM_RESOURCES);
         goto cleanup;
     }
-    bmp = SURFACE_LockSurface(res);
+    bmp = SURFACE_ShareLockSurface(res); // HACK
     if (NULL == bmp)
     {
         DPRINT1("SURFACE_LockSurface failed\n");
@@ -1639,14 +1638,14 @@ cleanup:
 
         if (res)
         {
-            SURFACE_FreeSurfaceByHandle(res);
+            GreDeleteObject(res);
             res = 0;
         }
     }
 
     if (bmp)
     {
-        SURFACE_UnlockSurface(bmp);
+        SURFACE_ShareUnlockSurface(bmp);
     }
 
     // Return BITMAP handle and storage location