# include "wx/defs.h"
#endif
-#if wxUSE_STREAMS && wxUSE_PCX
+#if wxUSE_STREAMS && wxUSE_PCX
#include "wx/image.h"
#include "wx/wfstream.h"
/* PCX header */
-#define HDR_VERSION 1
+#define HDR_VERSION 1
#define HDR_ENCODING 2
#define HDR_BITSPERPIXEL 3
#define HDR_XMIN 4
#define HDR_YMIN 6
-#define HDR_XMAX 8
+#define HDR_XMAX 8
#define HDR_YMAX 10
#define HDR_NPLANES 65
#define HDR_BYTESPERLINE 66
{
*(dst++) = p[i];
*(dst++) = p[i + bytesperline];
- *(dst++) = p[i + 2 * bytesperline];
+ *(dst++) = p[i + 2 * bytesperline];
}
break;
}
IMPLEMENT_DYNAMIC_CLASS(wxPCXHandler,wxImageHandler)
#endif
-bool wxPCXHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose )
+bool wxPCXHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose, int WXUNUSED(index) )
{
int error;
if (!CanRead(stream))
{
if (verbose)
- wxLogError(T("wxPCXHandler: this is not a PCX file"));
+ wxLogError(wxT("wxPCXHandler: this is not a PCX file"));
return FALSE;
}
{
switch (error)
{
- case E_FORMATO: wxLogError(T("wxPCXHandler: image format unsupported")); break;
- case E_MEMORIA: wxLogError(T("wxPCXHandler: couldn't allocate memory")); break;
- case E_VERSION: wxLogError(T("wxPCXHandler: version number too low")); break;
- default: wxLogError(T("wxPCXHandler: unknown error !!!"));
+ case E_FORMATO: wxLogError(wxT("wxPCXHandler: image format unsupported")); break;
+ case E_MEMORIA: wxLogError(wxT("wxPCXHandler: couldn't allocate memory")); break;
+ case E_VERSION: wxLogError(wxT("wxPCXHandler: version number too low")); break;
+ default: wxLogError(wxT("wxPCXHandler: unknown error !!!"));
}
}
image->Destroy();
bool wxPCXHandler::SaveFile( wxImage *WXUNUSED(image), wxOutputStream& WXUNUSED(stream), bool verbose )
{
if (verbose)
- wxLogError(T("wxPCXHandler::SaveFile still not implemented"));
+ wxLogError(wxT("wxPCXHandler::SaveFile still not implemented"));
return FALSE;
}
-bool wxPCXHandler::CanRead( wxInputStream& stream )
+bool wxPCXHandler::DoCanRead( wxInputStream& stream )
{
unsigned char c;
- off_t pos;
- pos = stream.TellI();
- stream.SeekI(0, wxFromStart);
c = stream.GetC();
- stream.SeekI(pos, wxFromStart);
+ stream.SeekI(-1, wxFromCurrent);
// not very safe, but this is all we can get from PCX header :-(
return (c == 10);