X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d275c7eb8420c81e97a8b308c60c27d9856b58f9..00c813596e3eefdd028365acf9542355937e5531:/src/msw/bitmap.cpp?ds=inline diff --git a/src/msw/bitmap.cpp b/src/msw/bitmap.cpp index a68e54fa7d..c4b2b8bed5 100644 --- a/src/msw/bitmap.cpp +++ b/src/msw/bitmap.cpp @@ -144,6 +144,10 @@ bool wxBitmap::CopyFromIconOrCursor(const wxGDIImage& icon) refData->m_bitmapMask = new wxMask((WXHBITMAP) wxInvertMask(iconInfo.hbmMask, w, h)); + + // delete the old one now as we don't need it any more + ::DeleteObject(iconInfo.hbmMask); + #if WXWIN_COMPATIBILITY_2 refData->m_ok = TRUE; #endif // WXWIN_COMPATIBILITY_2 @@ -431,6 +435,9 @@ bool wxBitmap::CreateFromImage( const wxImage& image, int depth ) if (depth == -1) depth = wxDisplayDepth(); SetDepth( depth ); + // Copy the palette from the source image + SetPalette(image.GetPalette()); + // create a DIB header int headersize = sizeof(BITMAPINFOHEADER); BITMAPINFO *lpDIBh = (BITMAPINFO *) malloc( headersize ); @@ -1080,7 +1087,7 @@ bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour) // scan the bitmap for the transparent colour and set the corresponding // pixels in the mask to BLACK and the rest to WHITE - COLORREF maskColour = wxColourToRGB(colour); + COLORREF maskColour = RGB(colour.Red(), colour.Green(), colour.Blue()); m_maskBitmap = (WXHBITMAP)::CreateBitmap(width, height, 1, 1, 0); HDC srcDC = ::CreateCompatibleDC(NULL);