[ros-diffs] [tkreuzer] 50989: [WIN32K] Use GreCreateBitmapEx instead of EngCreateBitmap in NtGdiSetDIBitsToDeviceInternal, so that the RLE hack works. Fix initialization of XLATEOBJ.

tkreuzer at svn.reactos.org tkreuzer at svn.reactos.org
Mon Mar 7 10:00:27 UTC 2011


Author: tkreuzer
Date: Mon Mar  7 10:00:27 2011
New Revision: 50989

URL: http://svn.reactos.org/svn/reactos?rev=50989&view=rev
Log:
[WIN32K]
Use GreCreateBitmapEx instead of EngCreateBitmap in NtGdiSetDIBitsToDeviceInternal, so that the RLE hack works. Fix initialization of XLATEOBJ.

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=50989&r1=50988&r2=50989&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] Mon Mar  7 10:00:27 2011
@@ -463,7 +463,7 @@
     rcDest.top = YDest;
     if (bTransformCoordinates)
     {
-        CoordLPtoDP(pDC, (LPPOINT)&rcDest);
+        IntLPtoDP(pDC, (LPPOINT)&rcDest, 2);
     }
     rcDest.left += pDC->ptlDCOrig.x;
     rcDest.top += pDC->ptlDCOrig.y;
@@ -479,12 +479,16 @@
 
     DIBWidth = WIDTH_BYTES_ALIGN32(SourceSize.cx, bmi->bmiHeader.biBitCount);
 
-    hSourceBitmap = EngCreateBitmap(SourceSize,
-                                    DIBWidth,
-                                    BitmapFormat(bmi->bmiHeader.biBitCount,
-                                            bmi->bmiHeader.biCompression),
-                                    bmi->bmiHeader.biHeight < 0 ? BMF_TOPDOWN : 0,
-                                    (PVOID) Bits);
+    hSourceBitmap = GreCreateBitmapEx(bmi->bmiHeader.biWidth,
+                                      ScanLines,
+                                      0,
+                                      BitmapFormat(bmi->bmiHeader.biBitCount,
+                                                   bmi->bmiHeader.biCompression),
+                                      bmi->bmiHeader.biHeight < 0 ? BMF_TOPDOWN : 0,
+                                      bmi->bmiHeader.biSizeImage,
+                                      Bits,
+                                      0);
+
     if (!hSourceBitmap)
     {
         EngSetLastError(ERROR_NO_SYSTEM_RESOURCES);
@@ -520,7 +524,12 @@
     }
 
     /* Initialize EXLATEOBJ */
-    EXLATEOBJ_vInitialize(&exlo, ppalDIB, pSurf->ppal, 0, 0, 0);
+    EXLATEOBJ_vInitialize(&exlo,
+                          ppalDIB,
+                          pSurf->ppal,
+                          RGB(0xff, 0xff, 0xff),
+                          pDC->pdcattr->crBackgroundClr,
+                          pDC->pdcattr->crForegroundClr);
 
     /* Copy the bits */
     DPRINT("BitsToDev with dstsurf=(%d|%d) (%d|%d), src=(%d|%d) w=%d h=%d\n",
@@ -1433,6 +1442,7 @@
     /* CreateDIBSection should fail for compressed formats */
     if (bi->biCompression == BI_RLE4 || bi->biCompression == BI_RLE8)
     {
+        DPRINT1("no compressed format allowed\n");
         return (HBITMAP)NULL;
     }
 
@@ -1465,6 +1475,7 @@
                                           0);
         if (!NT_SUCCESS(Status))
         {
+            DPRINT1("ZwQuerySystemInformation failed (0x%lx)\n", Status);
             return NULL;
         }
 
@@ -1486,6 +1497,7 @@
                                     PAGE_READWRITE);
         if (!NT_SUCCESS(Status))
         {
+            DPRINT1("ZwMapViewOfSection failed (0x%lx)\n", Status);
             EngSetLastError(ERROR_INVALID_PARAMETER);
             return NULL;
         }
@@ -1498,7 +1510,11 @@
     {
         offset = 0;
         bm.bmBits = EngAllocUserMem(totalSize, 0);
-        if(!bm.bmBits) goto cleanup;
+        if(!bm.bmBits)
+        {
+            DPRINT1("Failed to allocate memory\n");
+            goto cleanup;
+        }
     }
 
 //  hSecure = MmSecureVirtualMemory(bm.bmBits, totalSize, PAGE_READWRITE);
@@ -1546,12 +1562,14 @@
                             0);
     if (!res)
     {
+        DPRINT1("GreCreateBitmapEx failed\n");
         EngSetLastError(ERROR_NO_SYSTEM_RESOURCES);
         goto cleanup;
     }
     bmp = SURFACE_LockSurface(res);
     if (NULL == bmp)
     {
+        DPRINT1("SURFACE_LockSurface failed\n");
         EngSetLastError(ERROR_INVALID_HANDLE);
         goto cleanup;
     }




More information about the Ros-diffs mailing list