X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3ca6a5f04692678cd2d9f3ea0843fc3f5a0b254f..ee3510132b8b4160f848bd4f502a6f5315f90dbc:/src/msw/imaglist.cpp diff --git a/src/msw/imaglist.cpp b/src/msw/imaglist.cpp index f8a26cd036..46cb341d12 100644 --- a/src/msw/imaglist.cpp +++ b/src/msw/imaglist.cpp @@ -46,7 +46,7 @@ #include "wx/msw/imaglist.h" #include "wx/msw/private.h" -#if !defined(__GNUWIN32_OLD__) && !defined(__TWIN32__) +#if defined(__WIN95__) && !((defined(__GNUWIN32_OLD__) || defined(__TWIN32__)) && !defined(__CYGWIN10__)) #include #endif @@ -315,37 +315,41 @@ bool wxImageList::Draw(int index, static HBITMAP GetMaskForImage(const wxBitmap& bitmap, const wxBitmap& mask) { HBITMAP hbmpMask; - wxBitmap *bmpMask = NULL; + wxMask *pMask; + bool deleteMask = FALSE; if ( mask.Ok() ) { hbmpMask = GetHbitmapOf(mask); + pMask = NULL; } else { - wxMask *pMask = bitmap.GetMask(); - if ( pMask ) + pMask = bitmap.GetMask(); + if ( !pMask ) { - hbmpMask = (HBITMAP)pMask->GetMaskBitmap(); - } - else - { - // create a non transparent mask - apparently, this is needed under - // Win9x (it doesn't behave correctly if it's passed 0 mask) - bmpMask = new wxBitmap(bitmap.GetWidth(), bitmap.GetHeight(), 1); + // use the light grey count as transparent: the trouble here is + // that the light grey might have been changed by Windows behind + // our back, so use the standard colour map to get its real value + wxCOLORMAP *cmap = wxGetStdColourMap(); + wxColour col; + wxRGBToColour(col, cmap[wxSTD_COL_BTNFACE].from); - wxMemoryDC dcMem; - dcMem.SelectObject(*bmpMask); - dcMem.Clear(); - dcMem.SelectObject(wxNullBitmap); + pMask = new wxMask(bitmap, col); - hbmpMask = GetHbitmapOf(*bmpMask); + deleteMask = TRUE; } + + hbmpMask = (HBITMAP)pMask->GetMaskBitmap(); } // windows mask convention is opposite to the wxWindows one HBITMAP hbmpMaskInv = wxInvertMask(hbmpMask); - delete bmpMask; + + if ( deleteMask ) + { + delete pMask; + } return hbmpMaskInv; }