+ HBITMAP hbmp;
+
+#if wxUSE_WXDIB && wxUSE_IMAGE
+ // CreateIconIndirect() requires non-pre-multiplied pixel data on input
+ // as it does pre-multiplication internally itself so we need to create
+ // a special DIB in such format to pass to it. This is inefficient but
+ // better than creating an icon with wrong colours.
+ AutoHBITMAP hbmpRelease;
+ hbmp = wxDIB(bmp.ConvertToImage(),
+ wxDIB::PixelFormat_NotPreMultiplied).Detach();
+ hbmpRelease.Init(hbmp);
+#else // !(wxUSE_WXDIB && wxUSE_IMAGE)
+ hbmp = GetHbitmapOf(bmp);
+#endif // wxUSE_WXDIB && wxUSE_IMAGE
+