]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/imagpnm.cpp
vetoing item collapse works again
[wxWidgets.git] / src / common / imagpnm.cpp
index e7de922c9cdf50ee2bd1694793188ac1fd2e7a1a..28bf08eba303e2b2d3cc18d26f7631a6cd4b7273 100644 (file)
 #pragma hdrstop
 #endif
 
+#ifndef WX_PRECOMP
+#  include "wx/setup.h"
+#endif
+
+#if wxUSE_PNM
+
 #include "wx/image.h"
 #include "wx/log.h"
 #include "wx/txtstrm.h"
 
-#ifdef __WXMSW__
-#include <windows.h>
-#endif
-
 //-----------------------------------------------------------------------------
 // wxBMPHandler
 //-----------------------------------------------------------------------------
@@ -37,8 +39,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxPNMHandler,wxImageHandler)
 
 #if wxUSE_STREAMS
 
-//#include <stream.h> // for cout
-
 void Skip_Comment(wxInputStream &stream)
 {
   wxString line;
@@ -64,10 +64,11 @@ bool wxPNMHandler::LoadFile( wxImage *image, wxInputStream& stream, bool WXUNUSE
      * Read the PNM header
      */
 
-    wxTextInputStream text_stream(stream);
+    wxBufferedInputStream buf_stream(stream);
+    wxTextInputStream text_stream(buf_stream);
 
-    Skip_Comment(stream);
-    if (stream.GetC()==_T('P')) c=stream.GetC();
+    Skip_Comment(buf_stream);
+    if (buf_stream.GetC()==_T('P')) c=buf_stream.GetC();
 
     switch (c)
       {
@@ -84,9 +85,9 @@ bool wxPNMHandler::LoadFile( wxImage *image, wxInputStream& stream, bool WXUNUSE
       }
 
     text_stream >> line; // for the \n
-    Skip_Comment(stream);
+    Skip_Comment(buf_stream);
     text_stream >> width >> height ;
-    Skip_Comment(stream); 
+    Skip_Comment(buf_stream); 
     text_stream >> maxval;
 
     //cout << line << " " << width << " " << height << " " << maxval << endl;
@@ -98,8 +99,6 @@ bool wxPNMHandler::LoadFile( wxImage *image, wxInputStream& stream, bool WXUNUSE
        return FALSE;
     }
 
-    wxBufferedInputStream buf_stream(stream);
-
    if (c=='3') // Ascii RBG
       { 
        wxUint32 value, size=3*width*height;
@@ -159,4 +158,4 @@ bool wxPNMHandler::CanRead( wxInputStream& stream )
 
 #endif // wxUSE_STREAMS
 
-
+#endif // wxUSE_PNM