mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 09:34:43 +00:00
[GDI32] CreateDIBSection: Remove erroneous assignation (#5502)
bmBits is only used and assigned on output. It points (holds the address) to the array of DIB bit values. The "Bits" parameter is however a pointer to a variable that will receive the address of that array. So it makes no sense to initially assign bmBits to the value of the Bits parameter...
This commit is contained in:
parent
9632235a37
commit
e4c4894564
1 changed files with 17 additions and 15 deletions
|
@ -255,34 +255,36 @@ CreateDIBSection(
|
|||
HBITMAP hBitmap = NULL;
|
||||
PVOID bmBits = NULL;
|
||||
|
||||
pConvertedInfo = ConvertBitmapInfo(BitmapInfo, Usage, &ConvertedInfoSize,
|
||||
FALSE);
|
||||
|
||||
pConvertedInfo = ConvertBitmapInfo(BitmapInfo,
|
||||
Usage,
|
||||
&ConvertedInfoSize,
|
||||
FALSE);
|
||||
if (pConvertedInfo)
|
||||
{
|
||||
// Verify header due to converted may == info.
|
||||
if (pConvertedInfo->bmiHeader.biSize >= sizeof(BITMAPINFOHEADER))
|
||||
{
|
||||
if (pConvertedInfo->bmiHeader.biCompression == BI_JPEG
|
||||
|| pConvertedInfo->bmiHeader.biCompression == BI_PNG)
|
||||
if (pConvertedInfo->bmiHeader.biCompression == BI_JPEG ||
|
||||
pConvertedInfo->bmiHeader.biCompression == BI_PNG)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
bmBits = Bits;
|
||||
hBitmap = NtGdiCreateDIBSection(hDC, hSection, dwOffset, pConvertedInfo, Usage,
|
||||
ConvertedInfoSize, 0, // fl
|
||||
0, // dwColorSpace
|
||||
&bmBits);
|
||||
hBitmap = NtGdiCreateDIBSection(hDC,
|
||||
hSection,
|
||||
dwOffset,
|
||||
pConvertedInfo,
|
||||
Usage,
|
||||
ConvertedInfoSize,
|
||||
0, // fl
|
||||
0, // dwColorSpace
|
||||
&bmBits);
|
||||
if (!hBitmap)
|
||||
bmBits = NULL;
|
||||
|
||||
if (BitmapInfo != pConvertedInfo)
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, pConvertedInfo);
|
||||
|
||||
if (!hBitmap)
|
||||
{
|
||||
bmBits = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (Bits)
|
||||
|
|
Loading…
Reference in a new issue