* Sync up to trunk head (r64995).
[reactos.git] / win32ss / gdi / ntgdi / bitmaps.c
index ec44b9f..e72dec2 100644 (file)
@@ -217,7 +217,9 @@ HBITMAP FASTCALL
 IntCreateCompatibleBitmap(
     PDC Dc,
     INT Width,
-    INT Height)
+    INT Height,
+    UINT Planes,
+    UINT Bpp)
 {
     HBITMAP Bmp = NULL;
     PPALETTE ppal;
@@ -234,8 +236,8 @@ IntCreateCompatibleBitmap(
 
         Bmp = GreCreateBitmap(abs(Width),
                               abs(Height),
-                              1,
-                              Dc->ppdev->gdiinfo.cBitsPixel,
+                              Planes ? Planes : 1,
+                              Bpp ? Bpp : Dc->ppdev->gdiinfo.cBitsPixel,
                               NULL);
         psurf = SURFACE_ShareLockSurface(Bmp);
         ASSERT(psurf);
@@ -249,6 +251,7 @@ IntCreateCompatibleBitmap(
         /* Set flags */
         psurf->flags = API_BITMAP;
         psurf->hdc = NULL; // FIXME:
+        psurf->SurfObj.hdev = (HDEV)Dc->ppdev;
         SURFACE_ShareUnlockSurface(psurf);
     }
     else
@@ -265,8 +268,8 @@ IntCreateCompatibleBitmap(
 
             Bmp = GreCreateBitmap(abs(Width),
                           abs(Height),
-                          1,
-                          dibs.dsBm.bmBitsPixel,
+                          Planes ? Planes : 1,
+                          Bpp ? Bpp : dibs.dsBm.bmBitsPixel,
                           NULL);
             psurfBmp = SURFACE_ShareLockSurface(Bmp);
             ASSERT(psurfBmp);
@@ -277,6 +280,7 @@ IntCreateCompatibleBitmap(
             /* Set flags */
             psurfBmp->flags = API_BITMAP;
             psurfBmp->hdc = NULL; // FIXME:
+            psurf->SurfObj.hdev = (HDEV)Dc->ppdev;
             SURFACE_ShareUnlockSurface(psurfBmp);
         }
         else if (Count == sizeof(DIBSECTION))
@@ -289,8 +293,8 @@ IntCreateCompatibleBitmap(
             bi->bmiHeader.biSize          = sizeof(bi->bmiHeader);
             bi->bmiHeader.biWidth         = Width;
             bi->bmiHeader.biHeight        = Height;
-            bi->bmiHeader.biPlanes        = dibs.dsBmih.biPlanes;
-            bi->bmiHeader.biBitCount      = dibs.dsBmih.biBitCount;
+            bi->bmiHeader.biPlanes        = Planes ? Planes : dibs.dsBmih.biPlanes;
+            bi->bmiHeader.biBitCount      = Bpp ? Bpp : dibs.dsBmih.biBitCount;
             bi->bmiHeader.biCompression   = dibs.dsBmih.biCompression;
             bi->bmiHeader.biSizeImage     = 0;
             bi->bmiHeader.biXPelsPerMeter = dibs.dsBmih.biXPelsPerMeter;
@@ -371,7 +375,7 @@ NtGdiCreateCompatibleBitmap(
         return NULL;
     }
 
-    Bmp = IntCreateCompatibleBitmap(Dc, Width, Height);
+    Bmp = IntCreateCompatibleBitmap(Dc, Width, Height, 0, 0);
 
     DC_UnlockDc(Dc);
     return Bmp;