Index: subsystems/win32/win32k/include/surface.h =================================================================== --- subsystems/win32/win32k/include/surface.h (revision 40207) +++ subsystems/win32/win32k/include/surface.h (working copy) @@ -29,6 +29,7 @@ DWORD dsBitfields[3]; // hack, should probably use palette instead DWORD biClrUsed; DWORD biClrImportant; + DWORD biCompression; } SURFACE, *PSURFACE; #define BITMAPOBJ_IS_APIBITMAP 0x1 Index: subsystems/win32/win32k/objects/bitmaps.c =================================================================== --- subsystems/win32/win32k/objects/bitmaps.c (revision 40207) +++ subsystems/win32/win32k/objects/bitmaps.c (working copy) @@ -35,7 +35,16 @@ SIZEL Size; LONG WidthBytes; PSURFACE psurfBmp; + DWORD biCompression; + if (BitsPixel == 16) + { + biCompression = BI_BITFIELDS; + } + else + { + biCompression = BI_RGB; + } /* NOTE: Windows also doesn't store nr. of planes separately! */ BitsPixel = BITMAP_GetRealBitsPixel(BitsPixel * Planes); @@ -64,7 +73,7 @@ /* Create the bitmap object. */ hBitmap = IntCreateBitmap(Size, WidthBytes, - BitmapFormat(BitsPixel, BI_RGB), + BitmapFormat(BitsPixel, biCompression), (Height < 0 ? BMF_TOPDOWN : 0) | (NULL == pBits ? 0 : BMF_NOZEROINIT), NULL); if (!hBitmap) @@ -82,6 +91,7 @@ psurfBmp->flFlags = BITMAPOBJ_IS_APIBITMAP; psurfBmp->hDC = NULL; // Fixme + psurfBmp->biCompression = biCompression; if (NULL != pBits) { @@ -147,7 +157,7 @@ Bmp = IntGdiCreateBitmap(abs(Width), abs(Height), IntGdiGetDeviceCaps(Dc,PLANES), - IntGdiGetDeviceCaps(Dc,BITSPIXEL), + IntGdiGetDeviceCaps(Dc,COLORRES) == 15 ? IntGdiGetDeviceCaps(Dc,COLORRES) : IntGdiGetDeviceCaps(Dc,BITSPIXEL), NULL); } else @@ -177,7 +187,7 @@ Bmp = IntGdiCreateBitmap(abs(Width), abs(Height), dibs.dsBm.bmPlanes, - IntGdiGetDeviceCaps(Dc,BITSPIXEL),//<-- HACK! dibs.dsBm.bmBitsPixel, // <-- Correct! + IntGdiGetDeviceCaps(Dc,COLORRES) == 15 ? IntGdiGetDeviceCaps(Dc,COLORRES) : IntGdiGetDeviceCaps(Dc,BITSPIXEL),//<-- HACK! dibs.dsBm.bmBitsPixel, // <-- Correct! NULL); } else @@ -855,30 +865,7 @@ pds->dsBmih.biHeight = pds->dsBm.bmHeight; pds->dsBmih.biPlanes = pds->dsBm.bmPlanes; pds->dsBmih.biBitCount = pds->dsBm.bmBitsPixel; - switch (psurf->SurfObj.iBitmapFormat) - { - /* FIXME: What about BI_BITFIELDS? */ - case BMF_1BPP: - case BMF_4BPP: - case BMF_8BPP: - case BMF_16BPP: - case BMF_24BPP: - case BMF_32BPP: - pds->dsBmih.biCompression = BI_RGB; - break; - case BMF_4RLE: - pds->dsBmih.biCompression = BI_RLE4; - break; - case BMF_8RLE: - pds->dsBmih.biCompression = BI_RLE8; - break; - case BMF_JPEG: - pds->dsBmih.biCompression = BI_JPEG; - break; - case BMF_PNG: - pds->dsBmih.biCompression = BI_PNG; - break; - } + pds->dsBmih.biCompression = psurf->biCompression; pds->dsBmih.biSizeImage = psurf->SurfObj.cjBits; pds->dsBmih.biXPelsPerMeter = 0; pds->dsBmih.biYPelsPerMeter = 0; Index: subsystems/win32/win32k/objects/dibobj.c =================================================================== --- subsystems/win32/win32k/objects/dibobj.c (revision 40207) +++ subsystems/win32/win32k/objects/dibobj.c (working copy) @@ -836,30 +836,7 @@ Info->bmiHeader.biHeight = psurf->SurfObj.sizlBitmap.cy; Info->bmiHeader.biPlanes = 1; Info->bmiHeader.biBitCount = BitsPerFormat(psurf->SurfObj.iBitmapFormat); - switch (psurf->SurfObj.iBitmapFormat) - { - /* FIXME: What about BI_BITFIELDS? */ - case BMF_1BPP: - case BMF_4BPP: - case BMF_8BPP: - case BMF_16BPP: - case BMF_24BPP: - case BMF_32BPP: - Info->bmiHeader.biCompression = BI_RGB; - break; - case BMF_4RLE: - Info->bmiHeader.biCompression = BI_RLE4; - break; - case BMF_8RLE: - Info->bmiHeader.biCompression = BI_RLE8; - break; - case BMF_JPEG: - Info->bmiHeader.biCompression = BI_JPEG; - break; - case BMF_PNG: - Info->bmiHeader.biCompression = BI_PNG; - break; - } + Info->bmiHeader.biCompression = psurf->biCompression; /* Image size has to be calculated */ Info->bmiHeader.biSizeImage = DIB_GetDIBWidthBytes(Info->bmiHeader.biWidth, Info->bmiHeader.biBitCount) * Info->bmiHeader.biHeight;