diff --git a/IO/config/ImageLoader.h.in b/IO/config/ImageLoader.h.in index 9da8400..eb5f1b7 100644 --- a/IO/config/ImageLoader.h.in +++ b/IO/config/ImageLoader.h.in @@ -51,6 +51,9 @@ class ImageLoader { protected: + const uint8 *const m_RawData; + uint8 *m_PixelData; + uint32 m_Width; uint32 m_Height; @@ -66,9 +69,6 @@ class ImageLoader { uint32 m_AlphaChannelPrecision; uint8 *m_AlphaData; - uint8 *m_PixelData; - const uint8 *const m_RawData; - ImageLoader(const uint8 *rawData) : m_RawData(rawData) , m_PixelData(0) diff --git a/IO/config/ImageWriter.h.in b/IO/config/ImageWriter.h.in index 24d1982..0c5cb06 100644 --- a/IO/config/ImageWriter.h.in +++ b/IO/config/ImageWriter.h.in @@ -51,18 +51,18 @@ class ImageWriter { protected: + const uint8 *m_PixelData; + uint32 m_RawFileDataSz; + uint8 *m_RawFileData; + uint32 m_Width; uint32 m_Height; - const uint8 *m_PixelData; - uint32 m_RawFileDataSz; - uint8 *m_RawFileData; - ImageWriter(const int width, const int height, const uint8 *rawData) : m_PixelData(rawData) + , m_RawFileDataSz(256) + , m_RawFileData(new uint8[m_RawFileDataSz]) , m_Width(width), m_Height(height) - , m_RawFileDataSz(256) - , m_RawFileData(new uint8[m_RawFileDataSz]) { } uint32 GetChannelForPixel(uint32 x, uint32 y, uint32 ch); diff --git a/IO/include/FileStream.h b/IO/include/FileStream.h index 0ec588f..c165b5a 100644 --- a/IO/include/FileStream.h +++ b/IO/include/FileStream.h @@ -99,11 +99,11 @@ class FileStream { private: - EFileMode m_Mode; - // Platform specific implementation FileStreamImpl *m_Impl; + EFileMode m_Mode; + static const uint32 kMaxFilenameSz = 256; CHAR m_Filename[kMaxFilenameSz]; }; diff --git a/IO/include/ImageFile.h b/IO/include/ImageFile.h index 9f13fc0..2d449aa 100644 --- a/IO/include/ImageFile.h +++ b/IO/include/ImageFile.h @@ -59,7 +59,7 @@ public: ImageFile(const char *filename); ImageFile(const char *filename, EImageFileFormat format); - ImageFile(const char *filename, EImageFileFormat format, const Image &); + ImageFile(const char *filename, EImageFileFormat format, const Image &); ~ImageFile(); unsigned int GetWidth() const { return m_Width; } @@ -67,20 +67,21 @@ public: CompressedImage *Compress(const SCompressionSettings &) const; Image *GetImage() const { return m_Image; } - bool Load(); - bool Write(); + bool Load(); + bool Write(); private: - static const unsigned int kMaxFilenameSz = 256; - char m_Filename[kMaxFilenameSz]; + + static const unsigned int kMaxFilenameSz = 256; + char m_Filename[kMaxFilenameSz]; unsigned int m_Handle; unsigned int m_Width; unsigned int m_Height; - Image *m_Image; - const EImageFileFormat m_FileFormat; + Image *m_Image; + static unsigned char *ReadFileData(const CHAR *filename); static bool WriteImageDataToFile(const uint8 *data, const uint32 dataSz, const CHAR *filename); static EImageFileFormat DetectFileFormat(const CHAR *filename); diff --git a/IO/src/ImageFile.cpp b/IO/src/ImageFile.cpp index c9ceca3..9189e67 100644 --- a/IO/src/ImageFile.cpp +++ b/IO/src/ImageFile.cpp @@ -245,7 +245,6 @@ unsigned char *ImageFile::ReadFileData(const CHAR *filename) { // Read all of the data uint64 totalBytesRead = 0; uint64 totalBytesLeft = fileSize; - uint32 bytesToRead = uint32(std::min(totalBytesLeft, uint64(1 << 31))); int32 bytesRead; while((bytesRead = fstr.Read(rawData, uint32(fileSize))) > 0) { totalBytesRead += bytesRead;