X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ec85956ae93cdbbb4351a5b34e595ea56f296fc4..77e79241e89f1968dd2f5a2faa6513ebd4df2087:/src/common/image.cpp diff --git a/src/common/image.cpp b/src/common/image.cpp index d261424034..125e97613a 100644 --- a/src/common/image.cpp +++ b/src/common/image.cpp @@ -148,17 +148,6 @@ wxImage::wxImage( wxInputStream& stream, const wxString& mimetype, int index ) } #endif // wxUSE_STREAMS -wxImage::wxImage( const wxImage& image ) - : wxObject() -{ - Ref(image); -} - -wxImage::wxImage( const wxImage* image ) -{ - if (image) Ref(*image); -} - wxImage::wxImage( const char** xpmData ) { Create(xpmData); @@ -261,9 +250,18 @@ wxImage wxImage::Copy() const image.SetMask( M_IMGDATA->m_hasMask ); memcpy( data, GetData(), M_IMGDATA->m_width*M_IMGDATA->m_height*3 ); - - // also copy the image options + wxImageRefData *imgData = (wxImageRefData *)image.m_refData; + + // also copy the alpha channel + if (HasAlpha()) + { + image.SetAlpha(); + unsigned char* alpha = image.GetAlpha(); + memcpy( alpha, GetAlpha(), M_IMGDATA->m_width*M_IMGDATA->m_height ); + } + + // also copy the image options imgData->m_optionNames = M_IMGDATA->m_optionNames; imgData->m_optionValues = M_IMGDATA->m_optionValues; @@ -1594,7 +1592,7 @@ bool wxImage::LoadFile( wxInputStream& stream, long type, int index ) return false; } - if (!handler->CanRead(stream)) + if (stream.IsSeekable() && !handler->CanRead(stream)) { wxLogError(_("Image file is not of type %d."), type); return false; @@ -1618,7 +1616,7 @@ bool wxImage::LoadFile( wxInputStream& stream, const wxString& mimetype, int ind return false; } - if (!handler->CanRead(stream)) + if (stream.IsSeekable() && !handler->CanRead(stream)) { wxLogError(_("Image file is not of type %s."), (const wxChar*) mimetype); return false;