]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/imagpcx.cpp
basic support for encodings for wxMSW::wxFont
[wxWidgets.git] / src / common / imagpcx.cpp
index 7c8c0c0c05efeb1e42357ba60ab8c86bef8b76e0..2c29b90489a79dfdf102b04f701e14a3859d3d3d 100644 (file)
 #pragma hdrstop
 #endif
 
+#ifndef WX_PRECOMP
+#  include "wx/defs.h"
+#endif
+
+#if wxUSE_STREAMS && wxUSE_PCX 
+
 #include "wx/image.h"
 #include "wx/wfstream.h"
 #include "wx/module.h"
 #include "wx/log.h"
 
+
 //-----------------------------------------------------------------------------
 // PCX decoding
 //-----------------------------------------------------------------------------
@@ -142,14 +149,17 @@ int ReadPCX(wxImage *image, wxInputStream& stream)
     // palette at the end of the file. Read it now before
     // proceeding.
     //
-    pos = stream.TellI();
-    stream.SeekI(-769, wxFromEnd);
+    if (format == IMAGE_8BIT)
+    {
+        pos = stream.TellI();
+        stream.SeekI(-769, wxFromEnd);
 
-    if (stream.GetC() != 12)
-        return E_FORMATO;
+        if (stream.GetC() != 12)
+            return E_FORMATO;
 
-    stream.Read(pal, 768);
-    stream.SeekI(pos, wxFromStart);
+        stream.Read(pal, 768);
+        stream.SeekI(pos, wxFromStart);
+    }
 
     // Allocate memory for a scanline and resize the image.
     //
@@ -212,8 +222,6 @@ int ReadPCX(wxImage *image, wxInputStream& stream)
 IMPLEMENT_DYNAMIC_CLASS(wxPCXHandler,wxImageHandler)
 #endif
 
-#if wxUSE_STREAMS
-
 bool wxPCXHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose )
 {
     int error;
@@ -269,7 +277,5 @@ bool wxPCXHandler::CanRead( wxInputStream& stream )
     return (c == 10);
 }
 
-
-#endif // wxUSE_STREAMS
-
+#endif // wxUSE_STREAMS && wxUSE_PCX