mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 00:27:13 +00:00
- Fix bpp count in CreateDIBitmap.
svn path=/trunk/; revision=37437
This commit is contained in:
parent
fa0375352f
commit
3192a32d97
1 changed files with 26 additions and 5 deletions
|
@ -1013,7 +1013,7 @@ NtGdiCreateDIBitmapInternal(IN HDC hDc,
|
||||||
HBITMAP Bmp;
|
HBITMAP Bmp;
|
||||||
UINT bpp;
|
UINT bpp;
|
||||||
|
|
||||||
if (!hDc)
|
if (!hDc) // CreateBitmap
|
||||||
{ // Should use System Bitmap DC hSystemBM, with CreateCompatibleDC for this.
|
{ // Should use System Bitmap DC hSystemBM, with CreateCompatibleDC for this.
|
||||||
hDc = IntGdiCreateDC(NULL, NULL, NULL, NULL,FALSE);
|
hDc = IntGdiCreateDC(NULL, NULL, NULL, NULL,FALSE);
|
||||||
if (!hDc)
|
if (!hDc)
|
||||||
|
@ -1029,13 +1029,13 @@ NtGdiCreateDIBitmapInternal(IN HDC hDc,
|
||||||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
bpp = IntGdiGetDeviceCaps(Dc, BITSPIXEL);
|
bpp = 1;
|
||||||
Bmp = IntCreateDIBitmap(Dc, cx, cy, bpp, fInit, pjInit, pbmi, iUsage);
|
Bmp = IntCreateDIBitmap(Dc, cx, cy, bpp, fInit, pjInit, pbmi, iUsage);
|
||||||
|
|
||||||
DC_UnlockDc(Dc);
|
DC_UnlockDc(Dc);
|
||||||
NtGdiDeleteObjectApp(hDc);
|
NtGdiDeleteObjectApp(hDc);
|
||||||
}
|
}
|
||||||
else
|
else // CreateCompatibleBitmap
|
||||||
{
|
{
|
||||||
Dc = DC_LockDc(hDc);
|
Dc = DC_LockDc(hDc);
|
||||||
if (!Dc)
|
if (!Dc)
|
||||||
|
@ -1050,8 +1050,29 @@ NtGdiCreateDIBitmapInternal(IN HDC hDc,
|
||||||
if (pbmi)
|
if (pbmi)
|
||||||
bpp = pbmi->bmiHeader.biBitCount;
|
bpp = pbmi->bmiHeader.biBitCount;
|
||||||
else
|
else
|
||||||
bpp = IntGdiGetDeviceCaps(Dc, BITSPIXEL);
|
{
|
||||||
|
if (Dc->DC_Type != DC_TYPE_MEMORY )
|
||||||
|
bpp = IntGdiGetDeviceCaps(Dc, BITSPIXEL);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DIBSECTION dibs;
|
||||||
|
INT Count;
|
||||||
|
BITMAPOBJ *BitmapObject = BITMAPOBJ_LockBitmap(Dc->w.hBitmap);
|
||||||
|
Count = BITMAP_GetObject(BitmapObject, sizeof(dibs), &dibs);
|
||||||
|
if (!Count)
|
||||||
|
bpp = 1;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (Count == sizeof(BITMAP))
|
||||||
|
/* A device-dependent bitmap is selected in the DC */
|
||||||
|
bpp = dibs.dsBm.bmBitsPixel;
|
||||||
|
else
|
||||||
|
/* A DIB section is selected in the DC */
|
||||||
|
bpp = dibs.dsBmih.biBitCount;
|
||||||
|
}
|
||||||
|
BITMAPOBJ_UnlockBitmap(BitmapObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
Bmp = IntCreateDIBitmap(Dc, cx, cy, bpp, fInit, pjInit, pbmi, iUsage);
|
Bmp = IntCreateDIBitmap(Dc, cx, cy, bpp, fInit, pjInit, pbmi, iUsage);
|
||||||
DC_UnlockDc(Dc);
|
DC_UnlockDc(Dc);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue