- wxBitmap bmp( icon ) ;
- OSStatus err = noErr ;
-
- CGImageRef pImage;
-
-#if 0 // is always available under OSX now -- crashes on 10.2 in CFRetain() - RN
- pImage = (CGImageRef) bmp.CGImageCreate() ;
-#else
- WXHBITMAP iconport ;
- WXHBITMAP maskport ;
- iconport = bmp.GetHBITMAP( &maskport ) ;
-
- if (!maskport)
- {
- // Make a mask with no transparent pixels
- wxBitmap mbmp(icon.GetWidth(), icon.GetHeight());
- wxMemoryDC dc;
- dc.SelectObject(mbmp);
- dc.SetBackground(*wxBLACK_BRUSH);
- dc.Clear();
- dc.SelectObject(wxNullBitmap);
- bmp.SetMask( new wxMask(mbmp, *wxWHITE) ) ;
- iconport = bmp.GetHBITMAP( &maskport ) ;
- }
-
- //create the icon from the bitmap and mask bitmap contained within
- err = CreateCGImageFromPixMaps(
- GetGWorldPixMap(MAC_WXHBITMAP(iconport)),
- GetGWorldPixMap(MAC_WXHBITMAP(maskport)),
- &pImage
- );
- wxASSERT(err == 0);
-#endif