- PicHandle picHandle = (PicHandle) NewHandle( nSize ) ;
- memcpy( *picHandle , pBuf , nSize ) ;
- m_pictHandle = picHandle ;
- m_pictCreated = false ;
- Rect frame = (**picHandle).picFrame ;
-
- m_bitmap.SetPict( picHandle ) ;
- m_bitmap.SetWidth( frame.right - frame.left ) ;
- m_bitmap.SetHeight( frame.bottom - frame.top ) ;
+
+ if ((pBuf == NULL) || (nSize == 0))
+ return false;
+
+ PicHandle picHandle = (PicHandle)NewHandle( nSize );
+ memcpy( *picHandle, pBuf, nSize );
+ m_pictHandle = picHandle;
+
+ // ownership is transferred to the bitmap
+ m_pictCreated = false;
+#ifndef __LP64__
+ Rect frame;
+ wxMacGetPictureBounds( picHandle, &frame );
+
+ wxMetafile mf;
+ mf.SetHMETAFILE( (WXHMETAFILE)m_pictHandle );
+ wxMemoryDC mdc;
+ m_bitmap.Create( frame.right - frame.left, frame.bottom - frame.top );
+ mdc.SelectObject( m_bitmap );
+ mf.Play( &mdc );
+ mdc.SelectObject( wxNullBitmap );
+#endif
+