- // calculate the number of bits per pixel and the number of items in
- // bmiColors array (whose meaning depends on the bitmap format)
- WORD biBits = bm.bmPlanes * bm.bmBitsPixel;
- WORD biColors = wxGetNumOfBitmapColors(biBits);
-
- BITMAPINFO bi2;
-
- bool wantSizeOnly = pbi == NULL;
- if ( wantSizeOnly )
- pbi = &bi2;
-
- // just for convenience
- BITMAPINFOHEADER& bi = pbi->bmiHeader;
-
- bi.biSize = sizeof(BITMAPINFOHEADER);
- bi.biWidth = bm.bmWidth;
- bi.biHeight = bm.bmHeight;
- bi.biPlanes = 1;
- bi.biBitCount = biBits;
- bi.biCompression = BI_RGB;
- bi.biSizeImage = 0;
- bi.biXPelsPerMeter = 0;
- bi.biYPelsPerMeter = 0;
- bi.biClrUsed = 0;
- bi.biClrImportant = 0;
-
- // memory we need for BITMAPINFO only
- DWORD dwLen = bi.biSize + biColors * sizeof(RGBQUAD);
-
- // first get the image size
- ScreenHDC hdc;
- if ( !GetDIBits(hdc, hbmp, 0, bi.biHeight, NULL, pbi, DIB_RGB_COLORS) )
- {
- wxLogLastError("GetDIBits(NULL)");
+ wxCHECK_MSG( m_dataObjectLast, FALSE,
+ wxT("unsupported format in wxURLDataObject"));