mirror of
https://github.com/reactos/reactos.git
synced 2025-06-12 10:18:31 +00:00
[GDI32]
Use a struct do define the combined DIBSECTION/BITMAPINFO buffer in CreateCompatibleBitmap, to make it more clear how it works. See CID 716216 svn path=/trunk/; revision=57509
This commit is contained in:
parent
31f030ee98
commit
35de366b5b
1 changed files with 10 additions and 4 deletions
|
@ -362,8 +362,14 @@ CreateCompatibleBitmap(
|
|||
else
|
||||
{
|
||||
HBITMAP hBmp = NULL;
|
||||
char buffer[sizeof(DIBSECTION) + 256*sizeof(RGBQUAD)];
|
||||
DIBSECTION* pDIBs = (DIBSECTION*)buffer;
|
||||
struct
|
||||
{
|
||||
BITMAP bitmap;
|
||||
BITMAPINFOHEADER bmih;
|
||||
RGBQUAD rgbquad[256];
|
||||
} buffer;
|
||||
DIBSECTION* pDIBs = (DIBSECTION*)&buffer;
|
||||
BITMAPINFO* pbmi = (BITMAPINFO*)&buffer.bmih;
|
||||
|
||||
hBmp = NtGdiGetDCObject(hDC, GDI_OBJECT_TYPE_BITMAP);
|
||||
|
||||
|
@ -371,12 +377,12 @@ CreateCompatibleBitmap(
|
|||
return NULL;
|
||||
|
||||
if ( pDIBs->dsBm.bmBitsPixel <= 8 )
|
||||
GetDIBColorTable(hDC, 0, 256, (RGBQUAD *)&pDIBs->dsBitfields[0]);
|
||||
GetDIBColorTable(hDC, 0, 256, buffer.rgbquad);
|
||||
|
||||
pDIBs->dsBmih.biWidth = Width;
|
||||
pDIBs->dsBmih.biHeight = Height;
|
||||
|
||||
return CreateDIBSection(hDC, (CONST BITMAPINFO *)&pDIBs->dsBmih, 0, NULL, NULL, 0);
|
||||
return CreateDIBSection(hDC, pbmi, DIB_RGB_COLORS, NULL, NULL, 0);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue