From 6f09c6d2bfa2e6f6fba1b24e06e5fcbcc5742842 Mon Sep 17 00:00:00 2001 From: hybrid Date: Thu, 30 Oct 2008 00:34:31 +0000 Subject: [PATCH] Forgot the endianess. git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1661 dfc29bdd-3216-0410-991c-e03cc46cb475 --- source/Irrlicht/CImageWriterPCX.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/source/Irrlicht/CImageWriterPCX.cpp b/source/Irrlicht/CImageWriterPCX.cpp index 219c2492..561cbb4f 100644 --- a/source/Irrlicht/CImageWriterPCX.cpp +++ b/source/Irrlicht/CImageWriterPCX.cpp @@ -54,10 +54,19 @@ bool CImageWriterPCX::writeImage(io::IWriteFile *file, IImage *image,u32 param) file->write(&d2, 2); file->write(&d2, 2); d2 = image->getDimension().Width-1; // width +#ifdef __BIG_ENDIAN__ + d2 = os::Byteswap::byteswap(d2); +#endif file->write(&d2, 2); d2 = image->getDimension().Height-1; // height +#ifdef __BIG_ENDIAN__ + d2 = os::Byteswap::byteswap(d2); +#endif file->write(&d2, 2); d2 = 300; // dpi +#ifdef __BIG_ENDIAN__ + d2 = os::Byteswap::byteswap(d2); +#endif file->write(&d2, 2); file->write(&d2, 2); d2 = 0; // palette (not used) @@ -72,12 +81,24 @@ bool CImageWriterPCX::writeImage(io::IWriteFile *file, IImage *image,u32 param) d2 = image->getDimension().Width; // pitch if (d2&0x0001) // must be even ++d2; +#ifdef __BIG_ENDIAN__ + d2 = os::Byteswap::byteswap(d2); +#endif file->write(&d2, 2); d2 = 1; // color mode +#ifdef __BIG_ENDIAN__ + d2 = os::Byteswap::byteswap(d2); +#endif file->write(&d2, 2); d2 = 800; // screen width +#ifdef __BIG_ENDIAN__ + d2 = os::Byteswap::byteswap(d2); +#endif file->write(&d2, 2); d2 = 600; // screen height +#ifdef __BIG_ENDIAN__ + d2 = os::Byteswap::byteswap(d2); +#endif file->write(&d2, 2); d2 = 0; // filler (not used) for (i=0; i<27; ++i)