X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a2b8bd55375cde48319475e174f6eb86e4dcdd33..9f6af110ffc427b7cd660523f693105176fe63c4:/src/common/imagpnm.cpp diff --git a/src/common/imagpnm.cpp b/src/common/imagpnm.cpp index e7de922c9c..28bf08eba3 100644 --- a/src/common/imagpnm.cpp +++ b/src/common/imagpnm.cpp @@ -19,14 +19,16 @@ #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 -#endif - //----------------------------------------------------------------------------- // wxBMPHandler //----------------------------------------------------------------------------- @@ -37,8 +39,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxPNMHandler,wxImageHandler) #if wxUSE_STREAMS -//#include // 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