From: Julian Smart Date: Fri, 30 Nov 2001 07:34:40 +0000 (+0000) Subject: Fixed bug in wxConvertDIBToBitmap (contributed) X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/232b005197d3ad1efd4d49f281a048f3c7ef03c3 Fixed bug in wxConvertDIBToBitmap (contributed) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12760 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/msw/app.cpp b/src/msw/app.cpp index fd8d8e723a..f29afe759c 100644 --- a/src/msw/app.cpp +++ b/src/msw/app.cpp @@ -779,7 +779,7 @@ int wxEntry(WXHINSTANCE hInstance, wxCHECK_MSG( wxTheApp, 0, wxT("You have to define an instance of wxApp!") ); // save the WinMain() parameters - if (lpCmdLine) // MicroWindows pass NULL for this + if (lpCmdLine) // MicroWindows passes NULL wxTheApp->ConvertToStandardCommandArgs(lpCmdLine); wxTheApp->m_nCmdShow = nCmdShow; diff --git a/src/msw/ole/dataobj.cpp b/src/msw/ole/dataobj.cpp index 29c0d6f8e5..65151fbf5e 100644 --- a/src/msw/ole/dataobj.cpp +++ b/src/msw/ole/dataobj.cpp @@ -1260,8 +1260,15 @@ wxBitmap wxConvertDIBToBitmap(const LPBITMAPINFO pbmi) // BITMAPINFO starts with BITMAPINFOHEADER followed by colour info const BITMAPINFOHEADER *pbmih = &pbmi->bmiHeader; + // biClrUsed has the number of colors, unless it's 0 + int numColors = pbmih->biClrUsed; + if (numColors==0) + { + numColors = wxGetNumOfBitmapColors(pbmih->biBitCount); + } + // offset of image from the beginning of the header - DWORD ofs = wxGetNumOfBitmapColors(pbmih->biBitCount) * sizeof(RGBQUAD); + DWORD ofs = numColors * sizeof(RGBQUAD); void *image = (char *)pbmih + sizeof(BITMAPINFOHEADER) + ofs; ScreenHDC hdc;