]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/image.cpp
header inclusion fix
[wxWidgets.git] / src / common / image.cpp
index 7478392fe2779ea2fb1abc61cb5bbbb47e25a203..b0b91397f924be9c1022ee4270bf0d42c2a061e6 100644 (file)
@@ -300,7 +300,20 @@ void wxImage::SetData( char unsigned *data )
 {
     wxCHECK_RET( Ok(), _T("invalid image") );
 
-    memcpy(M_IMGDATA->m_data, data, M_IMGDATA->m_width * M_IMGDATA->m_height * 3);
+    wxImageRefData *newRefData = new wxImageRefData();
+
+    newRefData->m_width = M_IMGDATA->m_width;
+    newRefData->m_height = M_IMGDATA->m_height;
+    newRefData->m_data = data;
+    newRefData->m_ok = TRUE;
+    newRefData->m_maskRed = M_IMGDATA->m_maskRed;
+    newRefData->m_maskGreen = M_IMGDATA->m_maskGreen;
+    newRefData->m_maskBlue = M_IMGDATA->m_maskBlue;
+    newRefData->m_hasMask = M_IMGDATA->m_hasMask;
+    
+    UnRef();
+    
+    m_refData = newRefData;
 }
 
 void wxImage::SetMaskColour( unsigned char r, unsigned char g, unsigned char b )
@@ -597,6 +610,25 @@ void wxImage::InitStandardHandlers()
   AddHandler( new wxBMPHandler );
 }
 
+void wxImage::InitAllHandlers()
+{
+#if wxUSE_LIBPNG
+  AddHandler( new wxPNGHandler );
+#endif
+#if wxUSE_LIBJPEG
+  AddHandler( new wxJPEGHandler );
+#endif
+#if wxUSE_GIF
+  AddHandler( new wxGIFHandler );
+#endif
+#if wxUSE_PNM
+  AddHandler( new wxPNMHandler );
+#endif
+#if wxUSE_PCX
+  AddHandler( new wxPCXHandler );
+#endif
+}
+
 void wxImage::CleanUpHandlers()
 {
     wxNode *node = sm_handlers.First();
@@ -669,7 +701,11 @@ wxBitmap wxImage::ConvertToBitmap() const
         return wxNullBitmap;
 
     // sizeLimit is the MS upper limit for the DIB size
+#ifdef  WIN32
     int sizeLimit = 1024*768*3;
+#else
+    int sizeLimit = 0x7fff ;
+#endif
 
     // width and height of the device-dependent bitmap
     int width = GetWidth();