Remove old hack I implmeneted in NtGdiCreateBitmap it is height == 0 or width == 0, it create 1x1 1Bpp we can remove this hack now.

BugFix CreateBitmapIndirect, the code have been tested in reactos and windows, include abiword 
1. the bmWidthBytes must be align with 2 and it must be 2 or higher like windows xp/2003 and msdn
2. Do not do direcly call to NtGdiCreateBitmap use CreateBitmap so we getting same behoir for 1x1 1Bpp bitmap.
3. This will also take care of handle leaks for bitmap that being create with height = 0,  width = 0 and do not delete the object.
4. Windowss does not check if the incoming bitmap is NULL, this behoir to make it more compatible. 




svn path=/trunk/; revision=33427
This commit is contained in:
Magnus Olsen 2008-05-11 08:20:18 +00:00
parent 0dfbae2961
commit 973109beb4
2 changed files with 16 additions and 15 deletions

View file

@ -187,15 +187,22 @@ StretchBlt(
HBITMAP WINAPI
CreateBitmapIndirect(const BITMAP *pbm)
{
if (pbm)
HBITMAP bitmap = NULL;
/* Note windows xp/2003 does not check if pbm is NULL or not */
if ( (pbm->bmWidthBytes != 0) &&
(!(pbm->bmWidthBytes & 1)) )
{
return NtGdiCreateBitmap(pbm->bmWidth,
pbm->bmHeight,
pbm->bmPlanes,
pbm->bmBitsPixel,
pbm->bmBits);
bitmap = CreateBitmap(pbm->bmWidth,
pbm->bmHeight,
pbm->bmPlanes,
pbm->bmBitsPixel,
pbm->bmBits);
}
return NULL;
return bitmap;
}
HBITMAP WINAPI

View file

@ -112,14 +112,8 @@ NtGdiCreateBitmap(
ProbeForRead(pUnsafeBits, cjBits, 1);
}
if (0 == Width || 0 == Height)
{
hBitmap = IntGdiCreateBitmap (1, 1, 1, 1, NULL);
}
else
{
hBitmap = IntGdiCreateBitmap(Width, Height, Planes, BitsPixel, pUnsafeBits);
}
hBitmap = IntGdiCreateBitmap(Width, Height, Planes, BitsPixel, pUnsafeBits);
}
_SEH_HANDLE
{