]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/image.cpp
Avoid resetting size if paper id not found
[wxWidgets.git] / src / common / image.cpp
index 433e013d05893fe48f8c72a98bd1e7cd90e54ce2..cbe275bc19a3c2dd3e9c71a4703175dbe79049a3 100644 (file)
@@ -53,7 +53,14 @@ IMPLEMENT_VARIANT_OBJECT_EXPORTED_SHALLOWCMP(wxImage,WXDLLEXPORT)
 #endif
 
 //-----------------------------------------------------------------------------
-// wxImage
+// global data
+//-----------------------------------------------------------------------------
+
+wxList wxImage::sm_handlers;
+wxImage wxNullImage;
+
+//-----------------------------------------------------------------------------
+// wxImageRefData
 //-----------------------------------------------------------------------------
 
 class wxImageRefData: public wxObjectRefData
@@ -117,58 +124,15 @@ wxImageRefData::~wxImageRefData()
         free( m_alpha );
 }
 
-wxList wxImage::sm_handlers;
-
-wxImage wxNullImage;
 
+//-----------------------------------------------------------------------------
+// wxImage
 //-----------------------------------------------------------------------------
 
 #define M_IMGDATA static_cast<wxImageRefData*>(m_refData)
 
 IMPLEMENT_DYNAMIC_CLASS(wxImage, wxObject)
 
-wxImage::wxImage( int width, int height, bool clear )
-{
-    Create( width, height, clear );
-}
-
-wxImage::wxImage( int width, int height, unsigned char* data, bool static_data )
-{
-    Create( width, height, data, static_data );
-}
-
-wxImage::wxImage( int width, int height, unsigned char* data, unsigned char* alpha, bool static_data )
-{
-    Create( width, height, data, alpha, static_data );
-}
-
-wxImage::wxImage( const wxString& name, wxBitmapType type, int index )
-{
-    LoadFile( name, type, index );
-}
-
-wxImage::wxImage( const wxString& name, const wxString& mimetype, int index )
-{
-    LoadFile( name, mimetype, index );
-}
-
-#if wxUSE_STREAMS
-wxImage::wxImage( wxInputStream& stream, wxBitmapType type, int index )
-{
-    LoadFile( stream, type, index );
-}
-
-wxImage::wxImage( wxInputStream& stream, const wxString& mimetype, int index )
-{
-    LoadFile( stream, mimetype, index );
-}
-#endif // wxUSE_STREAMS
-
-wxImage::wxImage(const char* const* xpmData)
-{
-    Create(xpmData);
-}
-
 bool wxImage::Create(const char* const* xpmData)
 {
 #if wxUSE_XPM
@@ -2438,10 +2402,12 @@ wxImageHandler *wxImage::FindHandler( const wxString& extension, wxBitmapType bi
     while (node)
     {
         wxImageHandler *handler = (wxImageHandler*)node->GetData();
-        if ( (handler->GetExtension().Cmp(extension) == 0) &&
-             ( (bitmapType == wxBITMAP_TYPE_ANY) || (handler->GetType() == bitmapType)) )
+        if ((bitmapType == wxBITMAP_TYPE_ANY) || (handler->GetType() == bitmapType))
         {
-            return handler;
+            if (handler->GetExtension() == extension)
+                return handler;
+            if (handler->GetAltExtensions().Index(extension, false) != wxNOT_FOUND)
+                return handler;
         }
         node = node->GetNext();
     }
@@ -2503,6 +2469,8 @@ wxString wxImage::GetImageExtWildcard()
     {
         wxImageHandler* Handler = (wxImageHandler*)Node->GetData();
         fmts += wxT("*.") + Handler->GetExtension();
+        for (size_t i = 0; i < Handler->GetAltExtensions().size(); i++)
+            fmts += wxT(";*.") + Handler->GetAltExtensions()[i];
         Node = Node->GetNext();
         if ( Node ) fmts += wxT(";");
     }