Author: tkreuzer
Date: Sun Feb 27 17:38:18 2011
New Revision: 50920

URL: http://svn.reactos.org/svn/reactos?rev=50920&view=rev
Log:
[WIN32K]
- In NtGdiGetDIBitsInternal use a shared lock for the bitmaps and provide 
background colors when initializing the XLATEOBJ. This fixes mono bitmaps 
passed to GetDIBits. (no it does not fix pink icons in VLC)
- In BuildDIBPalette don't handle 15bpp, its not valid. and 16 bpp is 555, this 
is documented in MSDN.

Modified:
    trunk/reactos/subsystems/win32/win32k/objects/dibobj.c

Modified: trunk/reactos/subsystems/win32/win32k/objects/dibobj.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/objects/dibobj.c?rev=50920&r1=50919&r2=50920&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/dibobj.c [iso-8859-1] 
(original)
+++ trunk/reactos/subsystems/win32/win32k/objects/dibobj.c [iso-8859-1] Sun Feb 
27 17:38:18 2011
@@ -649,7 +649,7 @@
     }
 
     /* Get a pointer to the source bitmap object */
-    psurf = SURFACE_LockSurface(hBitmap);
+    psurf = SURFACE_ShareLockSurface(hBitmap);
     if (psurf == NULL)
     {
         ScanLines = 0;
@@ -944,7 +944,7 @@
                        goto done ;
                }
 
-               psurfDest = SURFACE_LockSurface(hBmpDest);
+               psurfDest = SURFACE_ShareLockSurface(hBmpDest);
 
                rcDest.left = 0;
                rcDest.top = 0;
@@ -955,7 +955,7 @@
                srcPoint.y = height < 0 ?
                        psurf->SurfObj.sizlBitmap.cy - (StartScan + ScanLines) 
: StartScan;
 
-               EXLATEOBJ_vInitialize(&exlo, psurf->ppal, psurfDest->ppal, 0, 
0, 0);
+               EXLATEOBJ_vInitialize(&exlo, psurf->ppal, psurfDest->ppal, 
0xffffff, 0xffffff, 0);
 
                ret = IntEngCopyBits(&psurfDest->SurfObj,
                                                         &psurf->SurfObj,
@@ -963,6 +963,8 @@
                                                         &exlo.xlo,
                                                         &rcDest,
                                                         &srcPoint);
+
+        SURFACE_ShareUnlockSurface(psurfDest);
 
                if(!ret)
                        ScanLines = 0;
@@ -994,7 +996,7 @@
 done:
 
        if(pDC) DC_UnlockDc(pDC);
-       if(psurf) SURFACE_UnlockSurface(psurf);
+       if(psurf) SURFACE_ShareUnlockSurface(psurf);
        if(pbmci) DIB_FreeConvertedBitmapInfo(Info, (BITMAPINFO*)pbmci);
 
        return ScanLines;
@@ -1101,13 +1103,13 @@
     hBitmap = DIB_CreateDIBSection(pdc, BitsInfo, Usage, &pvBits, NULL, 0, 0);
     DC_UnlockDc(pdc);
 
+    if(!hBitmap)
+    {
+        DPRINT1("Error, failed to create a DIB section\n");
+        goto cleanup;
+    }
+
     hdcMem = NtGdiCreateCompatibleDC(hDC);
-    if(!hBitmap)
-    {
-        DPRINT1("Error, failed to create a DIB section\n");
-        NtGdiDeleteObjectApp(hdcMem);
-        goto cleanup;
-    }
 
     RtlCopyMemory(pvBits, safeBits, cjMaxBits);
     hOldBitmap = NtGdiSelectBitmap(hdcMem, hBitmap);
@@ -1771,17 +1773,10 @@
         paletteType = PAL_BITFIELDS;
         switch (bits)
         {
-            case 15:
+            case 16:
                 paletteType |= PAL_RGB16_555;
                 RedMask = 0x7C00;
                 GreenMask = 0x03E0;
-                BlueMask = 0x001F;
-                break;
-
-            case 16:
-                paletteType |= PAL_RGB16_565;
-                RedMask = 0xF800;
-                GreenMask = 0x07E0;
                 BlueMask = 0x001F;
                 break;
 


Reply via email to