- wxBitmap& bmp = source->GetSelectedBitmap();
- int width = bmp.GetWidth(),
- height = bmp.GetHeight();
-#if wxUSE_DIB_FOR_BITMAP
- if(bmp.GetHFileMap()) // we already have a dib
- {
- DIBSECTION dib;
- if( ::GetObject(GetHbitmapOf(bmp),
- sizeof(dib),
- &dib) == sizeof(dib) )
- {
- if ( ::StretchDIBits
- (
- GetHdc(),
- xdest, ydest,
- width, height,
- xsrc, ysrc,
- width, height,
- dib.dsBm.bmBits,
- (LPBITMAPINFO)&dib.dsBmih,
- DIB_RGB_COLORS,
- SRCCOPY
- ) == GDI_ERROR )
- {
- wxLogLastError(wxT("StretchDIBits"));
- }
- }
- else
- {
- wxLogLastError(wxT("GetObject"));
- }
- }
- else
-#endif // wxUSE_DIB_FOR_BITMAP
- {
- BITMAPINFO *info = (BITMAPINFO *) malloc( sizeof( BITMAPINFOHEADER ) + 256 * sizeof(RGBQUAD ) );
-#if wxUSE_DRAWBITMAP_24BITS
- int iBitsSize = (((width * 3) + 3 ) & ~3 ) * height;
-#else
- int iBitsSize = ((width + 3 ) & ~3 ) * height ;
-#endif
-
- void* bits = malloc( iBitsSize );
-
- memset( info , 0 , sizeof( BITMAPINFOHEADER ) );