diff options
author | Eugene Sandulenko | 2010-08-23 08:40:39 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2010-10-12 23:17:19 +0000 |
commit | e381bc3c148d2a45e903e71538be393e99143fd2 (patch) | |
tree | 092daecebfaa6c16ffaeab215adcd09c2278e28e | |
parent | a6d909c07f8a99e826f4a102111736e8198a5925 (diff) | |
download | scummvm-rg350-e381bc3c148d2a45e903e71538be393e99143fd2.tar.gz scummvm-rg350-e381bc3c148d2a45e903e71538be393e99143fd2.tar.bz2 scummvm-rg350-e381bc3c148d2a45e903e71538be393e99143fd2.zip |
SWORD25: char * -> byte * in image-related operations
svn-id: r53287
-rw-r--r-- | engines/sword25/gfx/image/b25sloader.cpp | 8 | ||||
-rw-r--r-- | engines/sword25/gfx/image/b25sloader.h | 6 | ||||
-rw-r--r-- | engines/sword25/gfx/image/imageloader.cpp | 6 | ||||
-rw-r--r-- | engines/sword25/gfx/image/imageloader.h | 22 | ||||
-rw-r--r-- | engines/sword25/gfx/image/pngloader.cpp | 14 | ||||
-rw-r--r-- | engines/sword25/gfx/image/pngloader.h | 12 | ||||
-rw-r--r-- | engines/sword25/gfx/opengl/glimage.cpp | 4 | ||||
-rw-r--r-- | engines/sword25/gfx/opengl/swimage.cpp | 4 |
8 files changed, 38 insertions, 38 deletions
diff --git a/engines/sword25/gfx/image/b25sloader.cpp b/engines/sword25/gfx/image/b25sloader.cpp index 38e70102b4..43313ba93e 100644 --- a/engines/sword25/gfx/image/b25sloader.cpp +++ b/engines/sword25/gfx/image/b25sloader.cpp @@ -46,7 +46,7 @@ namespace Sword25 { // ----------------------------------------------------------------------------- namespace { -unsigned int FindEmbeddedPNG(const char *FileDataPtr, unsigned int FileSize) { +unsigned int FindEmbeddedPNG(const byte *FileDataPtr, unsigned int FileSize) { #if 0 // Einen Stringstream mit dem Anfang der Datei intialisieren. 512 Byte sollten hierfür genügen. istringstream StringStream(string(FileDataPtr, FileDataPtr + min(static_cast<unsigned int>(512), FileSize))); @@ -72,7 +72,7 @@ unsigned int FindEmbeddedPNG(const char *FileDataPtr, unsigned int FileSize) { // ----------------------------------------------------------------------------- -bool B25SLoader::IsCorrectImageFormat(const char *FileDataPtr, unsigned int FileSize) { +bool B25SLoader::IsCorrectImageFormat(const byte *FileDataPtr, unsigned int FileSize) { // PNG innerhalb des Spielstandes finden und den Methodenaufruf zu BS_PNGLoader weiterreichen. unsigned int PNGOffset = FindEmbeddedPNG(FileDataPtr, FileSize); if (PNGOffset > 0) { @@ -84,7 +84,7 @@ bool B25SLoader::IsCorrectImageFormat(const char *FileDataPtr, unsigned int File // ----------------------------------------------------------------------------- -bool B25SLoader::DecodeImage(const char *FileDataPtr, unsigned int FileSize, GraphicEngine::COLOR_FORMATS ColorFormat, byte *&UncompressedDataPtr, +bool B25SLoader::DecodeImage(const byte *FileDataPtr, unsigned int FileSize, GraphicEngine::COLOR_FORMATS ColorFormat, byte *&UncompressedDataPtr, int &Width, int &Height, int &Pitch) { // PNG innerhalb des Spielstandes finden und den Methodenaufruf zu BS_PNGLoader weiterreichen. unsigned int PNGOffset = FindEmbeddedPNG(FileDataPtr, FileSize); @@ -97,7 +97,7 @@ bool B25SLoader::DecodeImage(const char *FileDataPtr, unsigned int FileSize, Gra // ----------------------------------------------------------------------------- -bool B25SLoader::ImageProperties(const char *FileDataPtr, unsigned int FileSize, GraphicEngine::COLOR_FORMATS &ColorFormat, int &Width, int &Height) { +bool B25SLoader::ImageProperties(const byte *FileDataPtr, unsigned int FileSize, GraphicEngine::COLOR_FORMATS &ColorFormat, int &Width, int &Height) { // PNG innerhalb des Spielstandes finden und den Methodenaufruf zu BS_PNGLoader weiterreichen. unsigned int PNGOffset = FindEmbeddedPNG(FileDataPtr, FileSize); if (PNGOffset > 0) { diff --git a/engines/sword25/gfx/image/b25sloader.h b/engines/sword25/gfx/image/b25sloader.h index aacac55ddd..922b348021 100644 --- a/engines/sword25/gfx/image/b25sloader.h +++ b/engines/sword25/gfx/image/b25sloader.h @@ -57,10 +57,10 @@ public: } protected: - virtual bool IsCorrectImageFormat(const char *FileDataPtr, unsigned int FileSize); - virtual bool DecodeImage(const char *FileDataPtr, unsigned int FileSize, GraphicEngine::COLOR_FORMATS ColorFormat, byte *&UncompressedDataPtr, + virtual bool IsCorrectImageFormat(const byte *FileDataPtr, unsigned int FileSize); + virtual bool DecodeImage(const byte *FileDataPtr, unsigned int FileSize, GraphicEngine::COLOR_FORMATS ColorFormat, byte *&UncompressedDataPtr, int &Width, int &Height, int &Pitch); - virtual bool ImageProperties(const char *FileDataPtr, unsigned int FileSize, GraphicEngine::COLOR_FORMATS &ColorFormat, int &Width, int &Height); + virtual bool ImageProperties(const byte *FileDataPtr, unsigned int FileSize, GraphicEngine::COLOR_FORMATS &ColorFormat, int &Width, int &Height); }; diff --git a/engines/sword25/gfx/image/imageloader.cpp b/engines/sword25/gfx/image/imageloader.cpp index af16c5cb2f..edfe34b3ee 100644 --- a/engines/sword25/gfx/image/imageloader.cpp +++ b/engines/sword25/gfx/image/imageloader.cpp @@ -46,7 +46,7 @@ bool ImageLoader::_ImageLoaderListInitialized = false; // Lade Methode // ------------ -bool ImageLoader::LoadImage(const char *pFileData, unsigned int FileSize, +bool ImageLoader::LoadImage(const byte *pFileData, unsigned int FileSize, GraphicEngine::COLOR_FORMATS ColorFormat, byte *&pUncompressedData, int &Width, int &Height, @@ -71,7 +71,7 @@ bool ImageLoader::LoadImage(const char *pFileData, unsigned int FileSize, // Info Methode // ------------ -bool ImageLoader::ExtractImageProperties(const char *pFileData, unsigned int FileSize, +bool ImageLoader::ExtractImageProperties(const byte *pFileData, unsigned int FileSize, GraphicEngine::COLOR_FORMATS &ColorFormat, int &Width, int &Height) { // Falls die Liste der BS_ImageLoader noch nicht initialisiert wurde, wird dies getan. @@ -111,7 +111,7 @@ void ImageLoader::_DeinitializeLoaderList() { } } -ImageLoader *ImageLoader::_FindSuitableImageLoader(const char *pFileData, unsigned int FileSize) { +ImageLoader *ImageLoader::_FindSuitableImageLoader(const byte *pFileData, unsigned int FileSize) { // Alle BS_ImageLoader-Objekte durchgehen, bis eins gefunden wurde, dass das Bild laden kann Common::List<ImageLoader *>::iterator Iter = _ImageLoaderList.begin(); for (; Iter != _ImageLoaderList.end(); ++Iter) { diff --git a/engines/sword25/gfx/image/imageloader.h b/engines/sword25/gfx/image/imageloader.h index 0ed896dba2..bafff74934 100644 --- a/engines/sword25/gfx/image/imageloader.h +++ b/engines/sword25/gfx/image/imageloader.h @@ -99,7 +99,7 @@ public: @remark Die Größe der Ausgabedaten in Bytes kann wie folgt berechnet werden: Pitch * Height. @remark Es darf nicht vergessen werden, die Ausgabedaten nach erfolgter Benutzung mit delete freizugeben. */ - static bool LoadImage(const char *pFileData, unsigned int FileSize, + static bool LoadImage(const byte *pFileData, unsigned int FileSize, GraphicEngine::COLOR_FORMATS ColorFormat, byte *&pUncompressedData, int &Width, int &Height, @@ -116,7 +116,7 @@ public: @return Gibt false zurück, wenn die Bildeigenschaften nicht ausgelesen werden konnten. @remark Es darf nicht vergessen werden, die Ausgabedaten nach erfolgter Benutzung mit delete freizugeben. */ - static bool ExtractImageProperties(const char *pFileData, unsigned int FileSize, + static bool ExtractImageProperties(const byte *pFileData, unsigned int FileSize, GraphicEngine::COLOR_FORMATS &ColorFormat, int &Width, int &Height); //@} @@ -148,7 +148,7 @@ protected: @return Gibt true zurück, wenn der #BS_ImageLoader das Bild lesen kann, ansonsten false. @remark Diese Methode muss von allen BS_ImageLoader Klassen implementiert werden. */ - virtual bool IsCorrectImageFormat(const char *pFileData, unsigned int FileSize) = 0; + virtual bool IsCorrectImageFormat(const byte *pFileData, unsigned int FileSize) = 0; /** @brief Lädt eine Bilddatei. @@ -170,7 +170,7 @@ protected: @remark Es darf nicht vergessen werden, die Ausgabedaten nach erfolgter Benutzung mit delete freizugeben. @remark Diese Methode muss von allen BS_ImageLoader Klassen implementiert werden. */ - virtual bool DecodeImage(const char *pFileData, unsigned int FileSize, + virtual bool DecodeImage(const byte *pFileData, unsigned int FileSize, GraphicEngine::COLOR_FORMATS ColorFormat, byte *&pUncompressedData, int &Width, int &Height, @@ -187,7 +187,7 @@ protected: @remark Es darf nicht vergessen werden, die Ausgabedaten nach erfolgter Benutzung mit delete freizugeben. @remark Diese Methode muss von allen BS_ImageLoader Klassen implementiert werden. */ - virtual bool ImageProperties(const char *pFileData, unsigned int FileSize, + virtual bool ImageProperties(const byte *pFileData, unsigned int FileSize, GraphicEngine::COLOR_FORMATS &ColorFormat, int &Width, int &Height) = 0; @@ -204,7 +204,7 @@ protected: @remark Es gilt zu beachten, dass der Zielpuffer ausreichend groß ist.<br> Es sind mindestens Width * 2 Byte notwendig. */ - static void RowARGB32ToRGB16(unsigned char *pSrcData, unsigned char *pDestData, unsigned int Width) { + static void RowARGB32ToRGB16(byte *pSrcData, byte *pDestData, unsigned int Width) { for (unsigned int i = 0; i < Width; i++) { ((uint16_t *)pDestData)[i] = ((pSrcData[2] >> 3) << 11) | ((pSrcData[1] >> 2) << 5) | (pSrcData[0] >> 3); pSrcData += 4; @@ -219,7 +219,7 @@ protected: @remark Es gilt zu beachten, dass der Zielpuffer ausreichend groß ist.<br> Es sind mindestens Width * 2 Byte notwendig. */ - static void RowARGB32ToRGB15(unsigned char *pSrcData, unsigned char *pDestData, unsigned int Width) { + static void RowARGB32ToRGB15(byte *pSrcData, byte *pDestData, unsigned int Width) { for (unsigned int i = 0; i < Width; i++) { ((uint16_t *)pDestData)[i] = ((pSrcData[2] >> 3) << 10) | ((pSrcData[1] >> 3) << 5) | (pSrcData[0] >> 3); pSrcData += 4; @@ -234,7 +234,7 @@ protected: @remark Es gilt zu beachten, dass der Zielpuffer ausreichend groß sein muss.<br> Es sind mindestens ((Width + 3) / 4) * 12 Byte notwendig. */ - static void RowARGB32ToRGB16_INTERLEAVED(unsigned char *pSrcData, unsigned char *pDestData, unsigned int Width) { + static void RowARGB32ToRGB16_INTERLEAVED(byte *pSrcData, byte *pDestData, unsigned int Width) { // Die Pixelblöcke erstellen, dabei werden immer jeweils 4 Pixel zu einem Block zusammengefasst unsigned int BlockFillCount = 0; unsigned int AlphaBlock = 0; @@ -278,7 +278,7 @@ protected: @remark Es gilt zu beachten, dass der Zielpuffer ausreichend groß ist.<br> Es sind mindestens (Width / 4 + Width % 4) * 3 Byte notwendig. */ - static void RowARGB32ToRGB15_INTERLEAVED(unsigned char *pSrcData, unsigned char *pDestData, unsigned int Width) { + static void RowARGB32ToRGB15_INTERLEAVED(byte *pSrcData, byte *pDestData, unsigned int Width) { // Die Pixelblöcke erstellen, dabei werden immer jeweils 4 Pixel zu einem Block zusammengefasst unsigned int BlockFillCount = 0; unsigned int AlphaBlock = 0; @@ -320,7 +320,7 @@ protected: @param pDestData ein Pointer auf den Zielpuffern. @param Width die Anzahl der Pixel in der Bildzeile. */ - static void RowARGB32ToABGR32(unsigned char *pSrcData, unsigned char *pDestData, unsigned int Width) { + static void RowARGB32ToABGR32(byte *pSrcData, byte *pDestData, unsigned int Width) { for (unsigned int i = 0; i < Width; ++i) { *pDestData++ = pSrcData[2]; *pDestData++ = pSrcData[1]; @@ -349,7 +349,7 @@ private: @brief Sucht zu Bilddaten ein BS_ImageLoader Objekt, dass die Bilddaten dekodieren kann. @return Gibt einen Pointer auf ein passendes BS_ImageLoader Objekt zurück, oder NULL, wenn kein passendes Objekt gefunden wurde. */ - static ImageLoader *_FindSuitableImageLoader(const char *pFileData, unsigned int FileSize); + static ImageLoader *_FindSuitableImageLoader(const byte *pFileData, unsigned int FileSize); static Common::List<ImageLoader *> _ImageLoaderList; // Die Liste aller BS_ImageLoader-Objekte static bool _ImageLoaderListInitialized; // Gibt an, ob die Liste schon intialisiert wurde diff --git a/engines/sword25/gfx/image/pngloader.cpp b/engines/sword25/gfx/image/pngloader.cpp index 32a7769313..0fb1fa509e 100644 --- a/engines/sword25/gfx/image/pngloader.cpp +++ b/engines/sword25/gfx/image/pngloader.cpp @@ -62,7 +62,7 @@ static void png_user_read_data(png_structp png_ptr, png_bytep data, png_size_t l // ----------------------------------------------------------------------------- -bool PNGLoader::DoDecodeImage(const char *FileDataPtr, unsigned int FileSize, GraphicEngine::COLOR_FORMATS ColorFormat, byte *&UncompressedDataPtr, +bool PNGLoader::DoDecodeImage(const byte *FileDataPtr, unsigned int FileSize, GraphicEngine::COLOR_FORMATS ColorFormat, byte *&UncompressedDataPtr, int &Width, int &Height, int &Pitch) { png_structp png_ptr = NULL; png_infop info_ptr = NULL; @@ -86,7 +86,7 @@ bool PNGLoader::DoDecodeImage(const char *FileDataPtr, unsigned int FileSize, G } // PNG Signatur überprüfen - if (!png_check_sig(reinterpret_cast<png_bytep>(const_cast<char *>(FileDataPtr)), 8)) { + if (!png_check_sig(reinterpret_cast<png_bytep>(const_cast<byte *>(FileDataPtr)), 8)) { error("png_check_sig failed"); } @@ -259,14 +259,14 @@ bool PNGLoader::DoDecodeImage(const char *FileDataPtr, unsigned int FileSize, G // ----------------------------------------------------------------------------- -bool PNGLoader::DecodeImage(const char *FileDataPtr, unsigned int FileSize, GraphicEngine::COLOR_FORMATS ColorFormat, byte *&UncompressedDataPtr, +bool PNGLoader::DecodeImage(const byte *FileDataPtr, unsigned int FileSize, GraphicEngine::COLOR_FORMATS ColorFormat, byte *&UncompressedDataPtr, int &Width, int &Height, int &Pitch) { return DoDecodeImage(FileDataPtr, FileSize, ColorFormat, UncompressedDataPtr, Width, Height, Pitch); } // ----------------------------------------------------------------------------- -bool PNGLoader::DoImageProperties(const char *FileDataPtr, unsigned int FileSize, GraphicEngine::COLOR_FORMATS &ColorFormat, int &Width, int &Height) { +bool PNGLoader::DoImageProperties(const byte *FileDataPtr, unsigned int FileSize, GraphicEngine::COLOR_FORMATS &ColorFormat, int &Width, int &Height) { // PNG Signatur überprüfen if (!DoIsCorrectImageFormat(FileDataPtr, FileSize)) return false; @@ -310,7 +310,7 @@ bool PNGLoader::DoImageProperties(const char *FileDataPtr, unsigned int FileSize // ----------------------------------------------------------------------------- -bool PNGLoader::ImageProperties(const char *FileDataPtr, unsigned int FileSize, GraphicEngine::COLOR_FORMATS &ColorFormat, int &Width, int &Height) { +bool PNGLoader::ImageProperties(const byte *FileDataPtr, unsigned int FileSize, GraphicEngine::COLOR_FORMATS &ColorFormat, int &Width, int &Height) { return DoImageProperties(FileDataPtr, FileSize, ColorFormat, Width, Height); } @@ -318,7 +318,7 @@ bool PNGLoader::ImageProperties(const char *FileDataPtr, unsigned int FileSize, // Header überprüfen // ----------------------------------------------------------------------------- -bool PNGLoader::DoIsCorrectImageFormat(const char *FileDataPtr, unsigned int FileSize) { +bool PNGLoader::DoIsCorrectImageFormat(const byte *FileDataPtr, unsigned int FileSize) { if (FileSize > 8) return png_check_sig((byte *)FileDataPtr, 8) ? true : false; else @@ -327,7 +327,7 @@ bool PNGLoader::DoIsCorrectImageFormat(const char *FileDataPtr, unsigned int Fil // ----------------------------------------------------------------------------- -bool PNGLoader::IsCorrectImageFormat(const char *FileDataPtr, unsigned int FileSize) { +bool PNGLoader::IsCorrectImageFormat(const byte *FileDataPtr, unsigned int FileSize) { return DoIsCorrectImageFormat(FileDataPtr, FileSize); } diff --git a/engines/sword25/gfx/image/pngloader.h b/engines/sword25/gfx/image/pngloader.h index 68b7224868..f360b92f61 100644 --- a/engines/sword25/gfx/image/pngloader.h +++ b/engines/sword25/gfx/image/pngloader.h @@ -60,20 +60,20 @@ public: // Alle virtuellen Methoden von BS_ImageLoader sind hier als static-Methode implementiert, damit sie von BS_B25SLoader aufgerufen werden können. // Die virtuellen Methoden rufen diese Methoden auf. - static bool DoIsCorrectImageFormat(const char *FileDataPtr, unsigned int FileSize); - static bool DoDecodeImage(const char *FileDataPtr, unsigned int FileSize, GraphicEngine::COLOR_FORMATS ColorFormat, byte *&UncompressedDataPtr, + static bool DoIsCorrectImageFormat(const byte *FileDataPtr, unsigned int FileSize); + static bool DoDecodeImage(const byte *FileDataPtr, unsigned int FileSize, GraphicEngine::COLOR_FORMATS ColorFormat, byte *&UncompressedDataPtr, int &Width, int &Height, int &Pitch); - static bool DoImageProperties(const char *FileDataPtr, unsigned int FileSize, GraphicEngine::COLOR_FORMATS &ColorFormat, int &Width, int &Height); + static bool DoImageProperties(const byte *FileDataPtr, unsigned int FileSize, GraphicEngine::COLOR_FORMATS &ColorFormat, int &Width, int &Height); protected: PNGLoader(); - bool DecodeImage(const char *pFileData, unsigned int FileSize, + bool DecodeImage(const byte *pFileData, unsigned int FileSize, GraphicEngine::COLOR_FORMATS ColorFormat, byte *&pUncompressedData, int &Width, int &Height, int &Pitch); - bool IsCorrectImageFormat(const char *FileDataPtr, unsigned int FileSize); - bool ImageProperties(const char *FileDatePtr, unsigned int FileSize, GraphicEngine::COLOR_FORMATS &ColorFormat, int &Width, int &Height); + bool IsCorrectImageFormat(const byte *FileDataPtr, unsigned int FileSize); + bool ImageProperties(const byte *FileDatePtr, unsigned int FileSize, GraphicEngine::COLOR_FORMATS &ColorFormat, int &Width, int &Height); }; } // End of namespace Sword25 diff --git a/engines/sword25/gfx/opengl/glimage.cpp b/engines/sword25/gfx/opengl/glimage.cpp index abc961c22e..60b2686051 100644 --- a/engines/sword25/gfx/opengl/glimage.cpp +++ b/engines/sword25/gfx/opengl/glimage.cpp @@ -63,9 +63,9 @@ GLImage::GLImage(const Common::String &Filename, bool &Result) : _backSurface = (static_cast<GraphicEngine *>(Kernel::GetInstance()->GetService("gfx")))->getSurface(); // Datei laden - char *pFileData; + byte *pFileData; unsigned int FileSize; - if (!(pFileData = (char *) pPackage->GetFile(Filename, &FileSize))) { + if (!(pFileData = (byte *) pPackage->GetFile(Filename, &FileSize))) { BS_LOG_ERRORLN("File \"%s\" could not be loaded.", Filename.c_str()); return; } diff --git a/engines/sword25/gfx/opengl/swimage.cpp b/engines/sword25/gfx/opengl/swimage.cpp index 4dd8d9fca3..8083e2b34a 100644 --- a/engines/sword25/gfx/opengl/swimage.cpp +++ b/engines/sword25/gfx/opengl/swimage.cpp @@ -60,9 +60,9 @@ SWImage::SWImage(const Common::String &Filename, bool &Result) : BS_ASSERT(pPackage); // Datei laden - char *pFileData; + byte *pFileData; unsigned int FileSize; - if (!(pFileData = (char *) pPackage->GetFile(Filename, &FileSize))) { + if (!(pFileData = (byte *) pPackage->GetFile(Filename, &FileSize))) { BS_LOG_ERRORLN("File \"%s\" could not be loaded.", Filename.c_str()); return; } |