]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/image.cpp
Changed GetLong/ShortPath to allocate memory dynamically
[wxWidgets.git] / src / common / image.cpp
index 893eed643f6ac72b48a94daac5c4e68a84f69158..3e54488163451e2ff2c06dd382d2f36d3f73ae35 100644 (file)
@@ -525,7 +525,10 @@ unsigned char wxImage::GetBlue( int x, int y ) const
 
 bool wxImage::Ok() const
 {
-    return (M_IMGDATA && M_IMGDATA->m_ok);
+    // image of 0 width or height can't be considered ok - at least because it
+    // causes crashes in ConvertToBitmap() if we don't catch it in time
+    wxImageRefData *data = M_IMGDATA;
+    return data && data->m_ok && data->m_width && data->m_height;
 }
 
 char unsigned *wxImage::GetData() const
@@ -1398,12 +1401,16 @@ wxImage::wxImage( const wxBitmap &bitmap )
 
 #ifdef __WXMAC__
 
-#include <PictUtils.h>
+#ifdef __UNIX__
+  #include <QD/PictUtils.h>
+#else
+  #include <PictUtils.h>
+#endif
 
 extern CTabHandle wxMacCreateColorTable( int numColors ) ;
 extern void wxMacDestroyColorTable( CTabHandle colors ) ;
 extern void wxMacSetColorTableEntry( CTabHandle newColors , int index , int red , int green ,  int blue ) ;
-extern GWorldPtr wxMacCreateGWorld( int height , int width , int depth ) ;
+extern GWorldPtr wxMacCreateGWorld( int width , int height , int depth ) ;
 extern void wxMacDestroyGWorld( GWorldPtr gw ) ;
 
 wxBitmap wxImage::ConvertToBitmap() const