mirror of
https://github.com/reactos/reactos.git
synced 2024-11-20 06:15:26 +00:00
[GDI32]
- Some fixes for CreateDIBitmap (Patch by Victor Martinez, modified by me) CORE-6420 #resolve - Fix warning on MSVC svn path=/trunk/; revision=57440
This commit is contained in:
parent
23eb1826bb
commit
12d5c03fcc
2 changed files with 41 additions and 2 deletions
|
@ -449,14 +449,53 @@ CreateDIBitmap( HDC hDC,
|
||||||
HBITMAP hBmp;
|
HBITMAP hBmp;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
if (!Header) return 0;
|
/* Check for CBM_CREATDIB */
|
||||||
|
if (Init & CBM_CREATDIB)
|
||||||
|
{
|
||||||
|
/* CBM_CREATDIB needs Data. */
|
||||||
|
if (!Data)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* It only works with PAL or RGB */
|
||||||
|
if (ColorUse > DIB_PAL_COLORS)
|
||||||
|
{
|
||||||
|
GdiSetLastError(ERROR_INVALID_PARAMETER);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Header is required */
|
||||||
|
if (!Header)
|
||||||
|
{
|
||||||
|
GdiSetLastError(ERROR_INVALID_PARAMETER);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get the bitmap format and dimensions */
|
||||||
if (DIB_GetBitmapInfo(Header, &width, &height, &planes, &bpp, &compr, &dibsize) == -1)
|
if (DIB_GetBitmapInfo(Header, &width, &height, &planes, &bpp, &compr, &dibsize) == -1)
|
||||||
{
|
{
|
||||||
GdiSetLastError(ERROR_INVALID_PARAMETER);
|
GdiSetLastError(ERROR_INVALID_PARAMETER);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Check if the Compr is incompatible */
|
||||||
|
if ((compr == BI_JPEG) || (compr == BI_PNG) || (compr == BI_BITFIELDS)) return 0;
|
||||||
|
|
||||||
|
/* Only DIB_RGB_COLORS (0), DIB_PAL_COLORS (1) and 2 are valid. */
|
||||||
|
if (ColorUse > DIB_PAL_COLORS + 1)
|
||||||
|
{
|
||||||
|
GdiSetLastError(ERROR_INVALID_PARAMETER);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Negative width is not allowed */
|
||||||
|
if (width < 0) return 0;
|
||||||
|
|
||||||
|
/* Top-down DIBs have a negative height. */
|
||||||
|
height = abs(height);
|
||||||
|
|
||||||
// For Icm support.
|
// For Icm support.
|
||||||
// GdiGetHandleUserData(hdc, GDI_OBJECT_TYPE_DC, (PVOID)&pDc_Attr))
|
// GdiGetHandleUserData(hdc, GDI_OBJECT_TYPE_DC, (PVOID)&pDc_Attr))
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ EFtoF(EFLOAT_S * efp)
|
||||||
Exp = efp->lExp;
|
Exp = efp->lExp;
|
||||||
Sign = SIGN(Mant);
|
Sign = SIGN(Mant);
|
||||||
|
|
||||||
if (Sign) Mant = -Mant;
|
if (Sign) Mant = -(LONG)Mant;
|
||||||
Mant >>= 7;
|
Mant >>= 7;
|
||||||
Exp += (EXCESS-1);
|
Exp += (EXCESS-1);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue