[WIN32K]
[reactos.git] / subsystems / win32 / win32k / objects / bitmaps.c
index a3b3350..e604957 100644 (file)
@@ -309,30 +309,28 @@ IntCreateCompatibleBitmap(
                 else
                 {
                     /* A DIB section is selected in the DC */
-                    BITMAPV5INFO bi;
+                                       BYTE buf[sizeof(BITMAPINFOHEADER) + 256*sizeof(RGBQUAD)] = {0};
                     PVOID Bits;
-
-                    RtlZeroMemory(&bi.bmiHeader, sizeof(bi.bmiHeader));
-                    bi.bmiHeader.bV5Size          = sizeof(bi.bmiHeader);
-                    bi.bmiHeader.bV5Width         = Width;
-                    bi.bmiHeader.bV5Height        = Height;
-                    bi.bmiHeader.bV5Planes        = dibs.dsBmih.biPlanes;
-                    bi.bmiHeader.bV5BitCount      = dibs.dsBmih.biBitCount;
-                    bi.bmiHeader.bV5Compression   = dibs.dsBmih.biCompression;
-                    bi.bmiHeader.bV5SizeImage     = 0;
-                    bi.bmiHeader.bV5XPelsPerMeter = dibs.dsBmih.biXPelsPerMeter;
-                    bi.bmiHeader.bV5YPelsPerMeter = dibs.dsBmih.biYPelsPerMeter;
-                    bi.bmiHeader.bV5ClrUsed       = dibs.dsBmih.biClrUsed;
-                    bi.bmiHeader.bV5ClrImportant  = dibs.dsBmih.biClrImportant;
-
-                    if (bi.bmiHeader.bV5Compression == BI_BITFIELDS)
+                                       BITMAPINFO* bi = (BITMAPINFO*)buf;
+
+                    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.biCompression   = dibs.dsBmih.biCompression;
+                    bi->bmiHeader.biSizeImage     = 0;
+                    bi->bmiHeader.biXPelsPerMeter = dibs.dsBmih.biXPelsPerMeter;
+                    bi->bmiHeader.biYPelsPerMeter = dibs.dsBmih.biYPelsPerMeter;
+                    bi->bmiHeader.biClrUsed       = dibs.dsBmih.biClrUsed;
+                    bi->bmiHeader.biClrImportant  = dibs.dsBmih.biClrImportant;
+
+                    if (bi->bmiHeader.biCompression == BI_BITFIELDS)
                     {
                         /* Copy the color masks */
-                        bi.bmiHeader.bV5RedMask = dibs.dsBitfields[0];
-                                               bi.bmiHeader.bV5GreenMask = dibs.dsBitfields[1];
-                                               bi.bmiHeader.bV5BlueMask = dibs.dsBitfields[2];
+                        RtlCopyMemory(bi->bmiColors, dibs.dsBitfields, 3*sizeof(RGBQUAD));
                     }
-                    else if (bi.bmiHeader.bV5BitCount <= 8)
+                    else if (bi->bmiHeader.biBitCount <= 8)
                     {
                         /* Copy the color table */
                         UINT Index;
@@ -350,15 +348,15 @@ IntCreateCompatibleBitmap(
                                 Index < 256 && Index < PalGDI->NumColors;
                                 Index++)
                         {
-                            bi.bmiColors[Index].rgbRed   = PalGDI->IndexedColors[Index].peRed;
-                            bi.bmiColors[Index].rgbGreen = PalGDI->IndexedColors[Index].peGreen;
-                            bi.bmiColors[Index].rgbBlue  = PalGDI->IndexedColors[Index].peBlue;
-                            bi.bmiColors[Index].rgbReserved = 0;
+                            bi->bmiColors[Index].rgbRed   = PalGDI->IndexedColors[Index].peRed;
+                            bi->bmiColors[Index].rgbGreen = PalGDI->IndexedColors[Index].peGreen;
+                            bi->bmiColors[Index].rgbBlue  = PalGDI->IndexedColors[Index].peBlue;
+                            bi->bmiColors[Index].rgbReserved = 0;
                         }
                         PALETTE_UnlockPalette(PalGDI);
 
                         Bmp = DIB_CreateDIBSection(Dc,
-                                                   &bi,
+                                                   bi,
                                                    DIB_RGB_COLORS,
                                                    &Bits,
                                                    NULL,