Fixed wxBufferedInputStream support ...
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3520 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -64,11 +64,10 @@ bool wxPNMHandler::LoadFile( wxImage *image, wxInputStream& stream, bool WXUNUSE
|
|||||||
* Read the PNM header
|
* Read the PNM header
|
||||||
*/
|
*/
|
||||||
|
|
||||||
wxBufferedInputStream buf_stream(stream);
|
wxTextInputStream text_stream(stream);
|
||||||
wxTextInputStream text_stream(buf_stream);
|
|
||||||
|
|
||||||
Skip_Comment(buf_stream);
|
Skip_Comment(stream);
|
||||||
if (buf_stream.GetC()==_T('P')) c=buf_stream.GetC();
|
if (stream.GetC()==_T('P')) c=stream.GetC();
|
||||||
|
|
||||||
switch (c)
|
switch (c)
|
||||||
{
|
{
|
||||||
@@ -85,12 +84,12 @@ bool wxPNMHandler::LoadFile( wxImage *image, wxInputStream& stream, bool WXUNUSE
|
|||||||
}
|
}
|
||||||
|
|
||||||
text_stream >> line; // for the \n
|
text_stream >> line; // for the \n
|
||||||
Skip_Comment(buf_stream);
|
Skip_Comment(stream);
|
||||||
text_stream >> width >> height ;
|
text_stream >> width >> height ;
|
||||||
Skip_Comment(buf_stream);
|
Skip_Comment(stream);
|
||||||
text_stream >> maxval;
|
text_stream >> maxval;
|
||||||
|
|
||||||
//cout << width << " " << height << " " << maxval << endl;
|
//cout << line << " " << width << " " << height << " " << maxval << endl;
|
||||||
image->Create( width, height );
|
image->Create( width, height );
|
||||||
unsigned char *ptr = image->GetData();
|
unsigned char *ptr = image->GetData();
|
||||||
if (!ptr)
|
if (!ptr)
|
||||||
@@ -99,6 +98,8 @@ bool wxPNMHandler::LoadFile( wxImage *image, wxInputStream& stream, bool WXUNUSE
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxBufferedInputStream buf_stream(stream);
|
||||||
|
|
||||||
if (c=='3') // Ascii RBG
|
if (c=='3') // Ascii RBG
|
||||||
{
|
{
|
||||||
wxUint32 value, size=3*width*height;
|
wxUint32 value, size=3*width*height;
|
||||||
|
Reference in New Issue
Block a user