Author: tkreuzer Date: Sun Oct 7 09:35:32 2012 New Revision: 57509
URL: http://svn.reactos.org/svn/reactos?rev=57509&view=rev Log: [GDI32] Use a struct do define the combined DIBSECTION/BITMAPINFO buffer in CreateCompatibleBitmap, to make it more clear how it works. See CID 716216
Modified: trunk/reactos/win32ss/gdi/gdi32/objects/bitmap.c
Modified: trunk/reactos/win32ss/gdi/gdi32/objects/bitmap.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/gdi32/objects/b... ============================================================================== --- trunk/reactos/win32ss/gdi/gdi32/objects/bitmap.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/gdi32/objects/bitmap.c [iso-8859-1] Sun Oct 7 09:35:32 2012 @@ -362,8 +362,14 @@ 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 @@ 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; }