diff --git a/subsystems/win32/win32k/include/bitmaps.h b/subsystems/win32/win32k/include/bitmaps.h index 3844aa7427b..11b0585bec3 100644 --- a/subsystems/win32/win32k/include/bitmaps.h +++ b/subsystems/win32/win32k/include/bitmaps.h @@ -11,7 +11,6 @@ HBITMAP FASTCALL BITMAP_CopyBitmap (HBITMAP hBitmap); UINT FASTCALL BITMAP_GetRealBitsPixel(UINT nBitsPixel); INT FASTCALL BITMAP_GetWidthBytes (INT bmWidth, INT bpp); - HBITMAP APIENTRY GreCreateBitmap( @@ -20,3 +19,15 @@ GreCreateBitmap( IN UINT cPlanes, IN UINT cBitsPixel, IN OPTIONAL PVOID pvBits); + +HBITMAP +APIENTRY +GreCreateBitmapEx( + IN INT nWidth, + IN INT nHeight, + IN ULONG cjWidthBytes, + IN ULONG iFormat, + IN USHORT fjBitmap, + IN ULONG cjBits, + IN OPTIONAL PVOID pvBits); + diff --git a/subsystems/win32/win32k/objects/bitmaps.c b/subsystems/win32/win32k/objects/bitmaps.c index 17194c7298c..4fc4388e68b 100644 --- a/subsystems/win32/win32k/objects/bitmaps.c +++ b/subsystems/win32/win32k/objects/bitmaps.c @@ -69,11 +69,13 @@ UnsafeSetBitmapBits( HBITMAP APIENTRY -GreCreateBitmap( +GreCreateBitmapEx( IN INT nWidth, IN INT nHeight, - IN UINT cPlanes, - IN UINT cBitsPixel, + IN ULONG cjWidthBytes, + IN ULONG iFormat, + IN USHORT fjBitmap, + IN ULONG cjSizeImage, IN OPTIONAL PVOID pvBits) { PSURFACE psurf; @@ -82,10 +84,6 @@ GreCreateBitmap( PVOID pvCompressedBits; SIZEL sizl; FLONG fl = 0; - ULONG iFormat; - - /* Calculate bitmap format */ - iFormat = BitmapFormat(cBitsPixel * cPlanes, BI_RGB); /* Verify format */ if (iFormat < BMF_1BPP || iFormat > BMF_PNG) return NULL; @@ -121,7 +119,7 @@ GreCreateBitmap( } /* Set the bitmap bits */ - if (!SURFACE_bSetBitmapBits(psurf, fl, 0, pvBits)) + if (!SURFACE_bSetBitmapBits(psurf, fjBitmap, cjWidthBytes, pvBits)) { /* Bail out if that failed */ DPRINT1("SURFACE_bSetBitmapBits failed.\n"); @@ -137,6 +135,25 @@ GreCreateBitmap( return hbmp; } +HBITMAP +APIENTRY +GreCreateBitmap( + IN INT nWidth, + IN INT nHeight, + IN UINT cPlanes, + IN UINT cBitsPixel, + IN OPTIONAL PVOID pvBits) +{ + /* Call the extended function */ + return GreCreateBitmapEx(nWidth, + nHeight, + 0, /* auto width */ + BitmapFormat(cBitsPixel * cPlanes, BI_RGB), + 0, /* no bitmap flags */ + 0, /* auto size */ + pvBits); +} + HBITMAP APIENTRY NtGdiCreateBitmap( diff --git a/subsystems/win32/win32k/objects/dibobj.c b/subsystems/win32/win32k/objects/dibobj.c index a242eff0834..f5816dabe8e 100644 --- a/subsystems/win32/win32k/objects/dibobj.c +++ b/subsystems/win32/win32k/objects/dibobj.c @@ -1492,12 +1492,14 @@ DIB_CreateDIBSection( // Create Device Dependent Bitmap and add DIB pointer Size.cx = bm.bmWidth; Size.cy = abs(bm.bmHeight); - res = IntCreateBitmap(Size, - bm.bmWidthBytes, - BitmapFormat(bi->biBitCount * bi->biPlanes, bi->biCompression), - BMF_DONTCACHE | BMF_USERMEM | BMF_NOZEROINIT | - (bi->biHeight < 0 ? BMF_TOPDOWN : 0), - bm.bmBits); + res = GreCreateBitmapEx(bm.bmWidth, + abs(bm.bmHeight), + bm.bmWidthBytes, + BitmapFormat(bi->biBitCount * bi->biPlanes, bi->biCompression), + BMF_DONTCACHE | BMF_USERMEM | BMF_NOZEROINIT | + (bi->biHeight < 0 ? BMF_TOPDOWN : 0), + bi->biSizeImage, + bm.bmBits); if (!res) { if (lpRGB != bmi->bmiColors)