]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/image.cpp
reformat for readability
[wxWidgets.git] / src / common / image.cpp
index c888353fd9b801ee1bd972f4bc67ed7d23c02d78..8d1794a51d84497cbebe6715b97c1b4f2dfdb4d3 100644 (file)
@@ -380,7 +380,7 @@ wxImage wxImage::ShrinkBy( int xFactor , int yFactor ) const
         }
     }
 
-    // In case this is a cursor, make sure the hotspot is scalled accordingly:
+    // In case this is a cursor, make sure the hotspot is scaled accordingly:
     if ( HasOption(wxIMAGE_OPTION_CUR_HOTSPOT_X) )
         image.SetOption(wxIMAGE_OPTION_CUR_HOTSPOT_X,
                 (GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_X))/xFactor);
@@ -466,7 +466,7 @@ wxImage wxImage::Scale( int width, int height ) const
         y += y_delta;
     }
 
-    // In case this is a cursor, make sure the hotspot is scalled accordingly:
+    // In case this is a cursor, make sure the hotspot is scaled accordingly:
     if ( HasOption(wxIMAGE_OPTION_CUR_HOTSPOT_X) )
         image.SetOption(wxIMAGE_OPTION_CUR_HOTSPOT_X,
                 (GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_X)*width)/old_width);
@@ -1554,7 +1554,13 @@ bool wxImage::LoadFile( wxInputStream& stream, long type, int index )
         return false;
     }
 
-    return handler->LoadFile(this, stream, true/*verbose*/, index);
+    if (!handler->CanRead(stream))
+    {
+        wxLogError(_("Image file is not of type %d."), type);
+        return false;
+    }
+    else
+        return handler->LoadFile(this, stream, true/*verbose*/, index);
 }
 
 bool wxImage::LoadFile( wxInputStream& stream, const wxString& mimetype, int index )
@@ -1572,7 +1578,13 @@ bool wxImage::LoadFile( wxInputStream& stream, const wxString& mimetype, int ind
         return false;
     }
 
-    return handler->LoadFile( this, stream, true/*verbose*/, index );
+    if (!handler->CanRead(stream))
+    {
+        wxLogError(_("Image file is not of type %s."), (const wxChar*) mimetype);
+        return false;
+    }
+    else
+        return handler->LoadFile( this, stream, true/*verbose*/, index );
 }
 
 bool wxImage::SaveFile( wxOutputStream& stream, int type ) const