Fixed bug in wxConvertDIBToBitmap (contributed)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12760 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -779,7 +779,7 @@ int wxEntry(WXHINSTANCE hInstance,
|
|||||||
wxCHECK_MSG( wxTheApp, 0, wxT("You have to define an instance of wxApp!") );
|
wxCHECK_MSG( wxTheApp, 0, wxT("You have to define an instance of wxApp!") );
|
||||||
|
|
||||||
// save the WinMain() parameters
|
// save the WinMain() parameters
|
||||||
if (lpCmdLine) // MicroWindows pass NULL for this
|
if (lpCmdLine) // MicroWindows passes NULL
|
||||||
wxTheApp->ConvertToStandardCommandArgs(lpCmdLine);
|
wxTheApp->ConvertToStandardCommandArgs(lpCmdLine);
|
||||||
wxTheApp->m_nCmdShow = nCmdShow;
|
wxTheApp->m_nCmdShow = nCmdShow;
|
||||||
|
|
||||||
|
@@ -1260,8 +1260,15 @@ wxBitmap wxConvertDIBToBitmap(const LPBITMAPINFO pbmi)
|
|||||||
// BITMAPINFO starts with BITMAPINFOHEADER followed by colour info
|
// BITMAPINFO starts with BITMAPINFOHEADER followed by colour info
|
||||||
const BITMAPINFOHEADER *pbmih = &pbmi->bmiHeader;
|
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
|
// 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;
|
void *image = (char *)pbmih + sizeof(BITMAPINFOHEADER) + ofs;
|
||||||
|
|
||||||
ScreenHDC hdc;
|
ScreenHDC hdc;
|
||||||
|
Reference in New Issue
Block a user