Introduce GreCreateBitmapEx, which has the extended functionality needed by some callers, GreCreateBitmap calls GreCreateBitmapEx to keep the simple syntax. Use it in DIB_CreateDIBSection to fix build. Also pass the size of the image (still ignored), which is needed for compressed bitmaps (we currently assume that RLEs take as much space as an uncompressed bitmap)

svn path=/branches/reactos-yarotows/; revision=47663
This commit is contained in:
Timo Kreuzer 2010-06-07 15:55:03 +00:00
parent a3214996fc
commit f8a49f4c75
3 changed files with 45 additions and 15 deletions

View file

@ -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);

View file

@ -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(

View file

@ -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)