X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0828c0875e1516e4bfc0aa5b0a84195a2ac92cca..77cff606637e123ff279011919eb8c817e2149e1:/src/common/image.cpp diff --git a/src/common/image.cpp b/src/common/image.cpp index 7478392fe2..b0b91397f9 100644 --- a/src/common/image.cpp +++ b/src/common/image.cpp @@ -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();