-//---------------------------------------------------------------------
-//
-// Function: InitBitmapInfoHeader
-//
-// Purpose: Does a "standard" initialization of a BITMAPINFOHEADER,
-// given the Width, Height, and Bits per Pixel for the
-// DIB.
-//
-// By standard, I mean that all the relevant fields are set
-// to the specified values. biSizeImage is computed, the
-// biCompression field is set to "no compression," and all
-// other fields are 0.
-//
-// Note that DIBs only allow BitsPixel values of 1, 4, 8, or
-// 24. This routine makes sure that one of these values is
-// used (whichever is most appropriate for the specified
-// nBPP).
-//
-// Parms: lpBmInfoHdr == Far pointer to a BITMAPINFOHEADER structure
-// to be filled in.
-// dwWidth == Width of DIB (not in Win 3.0 & 3.1, high
-// word MUST be 0).
-// dwHeight == Height of DIB (not in Win 3.0 & 3.1, high
-// word MUST be 0).
-// nBPP == Bits per Pixel for the DIB.
-//
-// History: Date Reason
-// 11/07/91 Created
-//
-//---------------------------------------------------------------------
-
-static void InitBitmapInfoHeader (LPBITMAPINFOHEADER lpBmInfoHdr,
- DWORD dwWidth,
- DWORD dwHeight,
- int nBPP)
-{
-// _fmemset (lpBmInfoHdr, 0, sizeof (BITMAPINFOHEADER));
- memset (lpBmInfoHdr, 0, sizeof (BITMAPINFOHEADER));
-
- lpBmInfoHdr->biSize = sizeof (BITMAPINFOHEADER);
- lpBmInfoHdr->biWidth = dwWidth;
- lpBmInfoHdr->biHeight = dwHeight;
- lpBmInfoHdr->biPlanes = 1;
-
- if (nBPP <= 1)
- nBPP = 1;
- else if (nBPP <= 4)
- nBPP = 4;
- else if (nBPP <= 8)
- nBPP = 8;
-/* Doesn't work
- else if (nBPP <= 16)
- nBPP = 16;
-*/
- else
- nBPP = 24;
-
- lpBmInfoHdr->biBitCount = nBPP;
- lpBmInfoHdr->biSizeImage = WIDTHBYTES (dwWidth * nBPP) * dwHeight;
-}
+ HGLOBAL hDIB = ::GlobalAlloc(GMEM_MOVEABLE, size);
+ if ( !hDIB )
+ {
+ // this is an error which does risk to happen especially under Win9x
+ // and which the user may understand so let him know about it
+ wxLogError(_("Failed to allocated %luKb of memory for bitmap data."),
+ (unsigned long)(size / 1024));