[Scummvm-cvs-logs] SF.net SVN: scummvm:[53312] scummvm/trunk/engines/sword25/gfx

sev at users.sourceforge.net sev at users.sourceforge.net
Wed Oct 13 01:33:23 CEST 2010


Revision: 53312
          http://scummvm.svn.sourceforge.net/scummvm/?rev=53312&view=rev
Author:   sev
Date:     2010-10-12 23:33:23 +0000 (Tue, 12 Oct 2010)

Log Message:
-----------
SWORD25: Remove redundant colorspace defines and code.

Modified Paths:
--------------
    scummvm/trunk/engines/sword25/gfx/graphicengine.h
    scummvm/trunk/engines/sword25/gfx/image/imageloader.h
    scummvm/trunk/engines/sword25/gfx/image/pngloader.cpp
    scummvm/trunk/engines/sword25/gfx/opengl/swimage.cpp

Modified: scummvm/trunk/engines/sword25/gfx/graphicengine.h
===================================================================
--- scummvm/trunk/engines/sword25/gfx/graphicengine.h	2010-10-12 23:32:55 UTC (rev 53311)
+++ scummvm/trunk/engines/sword25/gfx/graphicengine.h	2010-10-12 23:33:23 UTC (rev 53312)
@@ -91,33 +91,7 @@
 	enum COLOR_FORMATS {
 		/// Undefined/unknown colour format
 		CF_UNKNOWN = 0,
-		/// 16-bit colour format (R5G5B5)
-		CF_RGB15,
-		/// 16-bit colour format (R5G6R5)
-		CF_RGB16,
 		/**
-		 * Special alpha colour format of the engine, which supports very quick display using MMX instructions.
-		 * The pixels are 16-bits wide and have the same format as #CF_RGB15. In addition, each pixel has an 8-bit
-		 * alpha value.
-		 * It summarises groupings of pixels pixels and four alpha values in a 12-byte data block.
-		 * The data is stored in the following order:
-		 * Alpha0 Alpha1 Alpha2 Alpha3 Pixel0 Pixel1 Pixel2 Pixel3
-		 * If the number of pixels in a line is not divisible by 4, then unused pixels and alpha values can have
-		 * arbitrary values.
-		 */
-		CF_RGB15_INTERLEAVED,
-		/**
-		 * Special alpha colour format of the engine, which supports very quick display using MMX instructions.
-		 * The pixels are 16-bits wide and have the same format as #CF_RGB16. In addition, each pixel has an 8-bit
-		 * alpha value.
-		 * It summarises groupings of pixels pixels and four alpha values in a 12-byte data block.
-		 * The data is stored in the following order:
-		 * Alpha0 Alpha1 Alpha2 Alpha3 Pixel0 Pixel1 Pixel2 Pixel3
-		 * If the number of pixels in a line is not divisible by 4, then unused pixels and alpha values can have
-		 * arbitrary values.
-		 */
-		CF_RGB16_INTERLEAVED,
-		/**
 		 * 24-bit colour format (R8G8B8)
 		 */
 		CF_RGB24,
@@ -314,14 +288,6 @@
 	 */
 	static int GetPixelSize(GraphicEngine::COLOR_FORMATS ColorFormat) {
 		switch (ColorFormat) {
-		case GraphicEngine::CF_RGB16:
-		case GraphicEngine::CF_RGB15:
-			return 2;
-
-		case GraphicEngine::CF_RGB16_INTERLEAVED:
-		case GraphicEngine::CF_RGB15_INTERLEAVED:
-			return 3;
-
 		case GraphicEngine::CF_ARGB32:
 			return 4;
 		default:
@@ -338,16 +304,7 @@
 	 */
 	static int CalcPitch(GraphicEngine::COLOR_FORMATS ColorFormat, int Width) {
 		switch (ColorFormat) {
-		case GraphicEngine::CF_RGB16:
-		case GraphicEngine::CF_RGB15:
-			return Width * 2;
-
-		case GraphicEngine::CF_RGB16_INTERLEAVED:
-		case GraphicEngine::CF_RGB15_INTERLEAVED:
-			return (Width + 3) / 4 * 12;
-
 		case GraphicEngine::CF_ARGB32:
-		case GraphicEngine::CF_ABGR32:
 			return Width * 4;
 
 		default:

Modified: scummvm/trunk/engines/sword25/gfx/image/imageloader.h
===================================================================
--- scummvm/trunk/engines/sword25/gfx/image/imageloader.h	2010-10-12 23:32:55 UTC (rev 53311)
+++ scummvm/trunk/engines/sword25/gfx/image/imageloader.h	2010-10-12 23:33:23 UTC (rev 53312)
@@ -60,12 +60,7 @@
     - Die Klasse muss eine statische Methode haben, die eine Instanz von ihr erzeugt und einen Pointer darauf zur\xFCckgibt.
     - Diese Methode muss in der Liste in der Datei imageloader_ids.h eingetragen werden.
     - Die Klasse muss JEDES Eingabebild seines Bildformates in die folgenden Farbformate konvertieren k\xF6nnen:
-        - BS_GraphicEngine::CF_RGB16
-        - BS_GraphicEngine::CF_RGB15
-        - BS_GraphicEngine::CF_RGB16_INTERLEAVED
-        - BS_GraphicEngine::CF_RGB15_INTERLEAVED
         - BS_GraphicEngine::CF_ARGB32
-        - BS_GraphicEngine::CF_BGRA32
     - Zum Konvertieren der Bilddaten k\xF6nnen die Hilfsmethoden dieser Klasse benutzt werden, die ARGB Bilddaten in alle ben\xF6tigten
       Farbformate konvertieren.
 */
@@ -86,10 +81,6 @@
 	    @param FileSize die Gr\xF6\xDFe der Bilddaten in Byte.
 	    @param ColorFormat gibt das gew\xFCnschte Farbformat an, in das die Bilddaten konvertiert werden sollen.<br>
 	                       Folgende Farbformate werden unterst\xFCtzt:
-	                       - BS_GraphicEngine::CF_RGB16
-	                       - BS_GraphicEngine::CF_RGB15
-	                       - BS_GraphicEngine::CF_RGB16_INTERLEAVED
-	                       - BS_GraphicEngine::CF_RGB15_INTERLEAVED
 	                       - BS_GraphicEngine::CF_ARGB32
 	    @param pUncompressedData nach erfolgreichen Laden zeigt dieser Pointer auf die enpackten und konvertierten Bilddaten.
 	    @param Width gibt nach erfolgreichen Laden die Breite des geladenen Bildes an.
@@ -156,10 +147,6 @@
 	    @param FileSize die Gr\xF6\xDFe der Bilddaten in Byte.
 	    @param ColorFormat gibt das gew\xFCnschte Farbformat an, in das die Bilddaten konvertiert werden sollen.<br>
 	                       Folgende Farbformate werden unterst\xFCtzt:
-	                       - BS_GraphicEngine::CF_RGB16
-	                       - BS_GraphicEngine::CF_RGB15
-	                       - BS_GraphicEngine::CF_RGB16_INTERLEAVED
-	                       - BS_GraphicEngine::CF_RGB15_INTERLEAVED
 	                       - BS_GraphicEngine::CF_ARGB32
 	    @param pUncompressedData nach erfolgreichen Laden zeigt dieser Pointer auf die enpackten und konvertierten Bilddaten.
 	    @param Width gibt nach erfolgreichen Laden die Breite des geladenen Bildes an.
@@ -193,144 +180,6 @@
 
 	//@}
 
-	//@{
-	/** @name Konvertierungsmethoden */
-
-	/**
-	    @brief Konvertiert eine Bildzeile mit ARGB Pixeldaten in das BS_GraphicEngine::CF_RGB16 Farbformat.
-	    @param pSrcData ein Pointer auf die Quelldaten.
-	    @param pDestData ein Pointer auf den Zielpuffern.
-	    @param Width die Anzahl der Pixel in der Bildzeile.
-	    @remark Es gilt zu beachten, dass der Zielpuffer ausreichend gro\xDF ist.<br>
-	            Es sind mindestens Width * 2 Byte notwendig.
-	*/
-	static void RowARGB32ToRGB16(byte *pSrcData, byte *pDestData, uint Width) {
-		for (uint i = 0; i < Width; i++) {
-			((uint16_t *)pDestData)[i] = ((pSrcData[2] >> 3) << 11) | ((pSrcData[1] >> 2) << 5) | (pSrcData[0] >> 3);
-			pSrcData += 4;
-		}
-	}
-
-	/**
-	    @brief Konvertiert eine Bildzeile mit ARGB Pixeldaten in das BS_GraphicEngine::CF_RGB15 Farbformat.
-	    @param pSrcData ein Pointer auf die Quelldaten.
-	    @param pDestData ein Pointer auf den Zielpuffern.
-	    @param Width die Anzahl der Pixel in der Bildzeile.
-	    @remark Es gilt zu beachten, dass der Zielpuffer ausreichend gro\xDF ist.<br>
-	            Es sind mindestens Width * 2 Byte notwendig.
-	*/
-	static void RowARGB32ToRGB15(byte *pSrcData, byte *pDestData, uint Width) {
-		for (uint i = 0; i < Width; i++) {
-			((uint16_t *)pDestData)[i] = ((pSrcData[2] >> 3) << 10) | ((pSrcData[1] >> 3) << 5) | (pSrcData[0] >> 3);
-			pSrcData += 4;
-		}
-	}
-
-	/**
-	    @brief Konvertiert eine Bildzeile mit ARGB Pixeldaten in das BS_GraphicEngine::CF_RGB16_INTERLEAVED Farbformat.
-	    @param pSrcData ein Pointer auf die Quelldaten.
-	    @param pDestData ein Pointer auf den Zielpuffern.
-	    @param Width die Anzahl der Pixel in der Bildzeile.
-	    @remark Es gilt zu beachten, dass der Zielpuffer ausreichend gro\xDF sein muss.<br>
-	            Es sind mindestens ((Width + 3) / 4) * 12 Byte notwendig.
-	*/
-	static void RowARGB32ToRGB16_INTERLEAVED(byte *pSrcData, byte *pDestData, uint Width) {
-		// Die Pixelbl\xF6cke erstellen, dabei werden immer jeweils 4 Pixel zu einem Block zusammengefasst
-		uint BlockFillCount = 0;
-		uint AlphaBlock = 0;
-		for (uint i = 0; i < Width; i++) {
-			// Alphawert in den Alphablock schreiben
-			AlphaBlock = (AlphaBlock >> 8) | (pSrcData[BlockFillCount * 4 + 3] << 24);
-
-			// F\xFCllstand der Pixelblockes aktualisieren
-			BlockFillCount++;
-
-			// Sobald 4 Alphawerte gesammelt wurden, oder die Zeile zu Ende ist wird der Pixelblock in den Zielpuffer geschrieben
-			if (BlockFillCount == 4 || i == (Width - 1)) {
-				// Falls der AlphaBlock nicht ganz gef\xFCllt ist muss geshiftet werden um sicherzustellen, dass die Alphawerte
-				// "left aligned" sind.
-				AlphaBlock >>= (4 - BlockFillCount) * 8;
-
-				// Alphablock schreiben
-				*((uint *)pDestData) = AlphaBlock;
-				pDestData += 4;
-
-				// Pixel konvertieren und schreiben
-				RowARGB32ToRGB16(pSrcData, pDestData, BlockFillCount);
-
-				// Pointer auf den n\xE4chsten Platz im Zielpuffer setzen
-				pDestData += 8;
-
-				// Pointer auf die n\xE4chsten 4 Pixel im Quellpuffer setzen
-				pSrcData += 16;
-
-				// Neuen Pixelblock beginnen
-				BlockFillCount = 0;
-			}
-		}
-	}
-
-	/**
-	    @brief Konvertiert eine Bildzeile mit ARGB Pixeldaten in das BS_GraphicEngine::CF_RGB15_INTERLEAVED Farbformat.
-	    @param pSrcData ein Pointer auf die Quelldaten.
-	    @param pDestData ein Pointer auf den Zielpuffern.
-	    @param Width die Anzahl der Pixel in der Bildzeile.
-	    @remark Es gilt zu beachten, dass der Zielpuffer ausreichend gro\xDF ist.<br>
-	            Es sind mindestens (Width / 4 + Width % 4) * 3 Byte notwendig.
-	*/
-	static void RowARGB32ToRGB15_INTERLEAVED(byte *pSrcData, byte *pDestData, uint Width) {
-		// Die Pixelbl\xF6cke erstellen, dabei werden immer jeweils 4 Pixel zu einem Block zusammengefasst
-		uint BlockFillCount = 0;
-		uint AlphaBlock = 0;
-		for (uint i = 0; i < Width; i++) {
-			// Alphawert in den Alphablock schreiben
-			AlphaBlock = (AlphaBlock >> 8) | (pSrcData[BlockFillCount * 4 + 3] << 24);
-
-			// F\xFCllstand der Pixelblockes aktualisieren
-			BlockFillCount++;
-
-			// Sobald 4 Alphawerte gesammelt wurden, oder die Zeile zu Ende ist wird der Pixelblock in den Zielpuffer geschrieben
-			if (BlockFillCount == 4 || i == (Width - 1)) {
-				// Falls der AlphaBlock nicht ganz gef\xFCllt ist muss geshiftet werden um sicherzustellen, dass die Alphawerte
-				// "left aligned" sind.
-				AlphaBlock >>= (4 - BlockFillCount) * 8;
-
-				// Alphablock schreiben
-				*((uint *)pDestData) = AlphaBlock;
-				pDestData += 4;
-
-				// Pixel konvertieren und schreiben
-				RowARGB32ToRGB15(pSrcData, pDestData, BlockFillCount);
-
-				// Pointer auf den n\xE4chsten Platz im Zielpuffer setzen
-				pDestData += 8;
-
-				// Pointer auf die n\xE4chsten 4 Pixel im Quellpuffer setzen
-				pSrcData += 16;
-
-				// Neuen Pixelblock beginnen
-				BlockFillCount = 0;
-			}
-		}
-	}
-
-	/**
-	    @brief Konvertiert eine Bildzeile mit ARGB Pixeldaten in das BS_GraphicEngine::CF_BGRA32 Farbformat.
-	    @param pSrcData ein Pointer auf die Quelldaten.
-	    @param pDestData ein Pointer auf den Zielpuffern.
-	    @param Width die Anzahl der Pixel in der Bildzeile.
-	*/
-	static void RowARGB32ToABGR32(byte *pSrcData, byte *pDestData, uint Width) {
-		for (uint i = 0; i < Width; ++i) {
-			*pDestData++ = pSrcData[2];
-			*pDestData++ = pSrcData[1];
-			*pDestData++ = pSrcData[0];
-			*pDestData++ = pSrcData[3];
-
-			pSrcData += 4;
-		}
-	}
-
 private:
 
 	/**

Modified: scummvm/trunk/engines/sword25/gfx/image/pngloader.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/image/pngloader.cpp	2010-10-12 23:32:55 UTC (rev 53311)
+++ scummvm/trunk/engines/sword25/gfx/image/pngloader.cpp	2010-10-12 23:33:23 UTC (rev 53312)
@@ -75,12 +75,7 @@
 	int         i;
 
 	// Zielfarbformat \xFCberpr\xFCfen
-	if (ColorFormat != GraphicEngine::CF_RGB16 &&
-	        ColorFormat != GraphicEngine::CF_RGB15 &&
-	        ColorFormat != GraphicEngine::CF_RGB16_INTERLEAVED &&
-	        ColorFormat != GraphicEngine::CF_RGB15_INTERLEAVED &&
-	        ColorFormat != GraphicEngine::CF_ARGB32 &&
-	        ColorFormat != GraphicEngine::CF_ABGR32) {
+	if (ColorFormat != GraphicEngine::CF_ARGB32) {
 		BS_LOG_ERRORLN("Illegal or unsupported color format.");
 		return false;
 	}
@@ -157,31 +152,9 @@
 
 			// Zeile konvertieren
 			switch (ColorFormat) {
-			case GraphicEngine::CF_RGB16:
-				RowARGB32ToRGB16((byte *)RawDataBuffer, (byte *)&UncompressedDataPtr[i * Pitch], Width);
-				break;
-
-			case GraphicEngine::CF_RGB15:
-				RowARGB32ToRGB15((byte *)RawDataBuffer, (byte *)&UncompressedDataPtr[i * Pitch], Width);
-				break;
-
-			case GraphicEngine::CF_RGB16_INTERLEAVED:
-				RowARGB32ToRGB16_INTERLEAVED((byte *)RawDataBuffer, (byte *)&UncompressedDataPtr[i * Pitch], Width);
-				break;
-
-			case GraphicEngine::CF_RGB15_INTERLEAVED:
-				RowARGB32ToRGB15_INTERLEAVED((byte *)RawDataBuffer,
-											 (byte *)&UncompressedDataPtr[i * Pitch], Width);
-				break;
-
 			case GraphicEngine::CF_ARGB32:
 				memcpy(&UncompressedDataPtr[i * Pitch], RawDataBuffer, Pitch);
 				break;
-
-			case GraphicEngine::CF_ABGR32:
-				RowARGB32ToABGR32((byte *)RawDataBuffer, (byte *)&UncompressedDataPtr[i * Pitch], Width);
-				break;
-
 			default:
 				assert(0);
 			}
@@ -209,30 +182,6 @@
 
 		// Bilddaten zeilenweise in das gew\xFCnschte Ausgabeformat konvertieren
 		switch (ColorFormat) {
-		case GraphicEngine::CF_RGB16:
-			for (i = 0; i < Height; i++)
-				RowARGB32ToRGB16((byte *)(&RawDataBuffer[i * png_get_rowbytes(png_ptr, info_ptr)]),
-								 (byte *)&UncompressedDataPtr[i * Pitch], Width);
-			break;
-
-		case GraphicEngine::CF_RGB15:
-			for (i = 0; i < Height; i++)
-				RowARGB32ToRGB15((byte *)(&RawDataBuffer[i * png_get_rowbytes(png_ptr, info_ptr)]),
-								 (byte *)&UncompressedDataPtr[i * Pitch], Width);
-			break;
-
-		case GraphicEngine::CF_RGB16_INTERLEAVED:
-			for (i = 0; i < Height; i++)
-				RowARGB32ToRGB16_INTERLEAVED((byte *)(&RawDataBuffer[i * png_get_rowbytes(png_ptr, info_ptr)]),
-											 (byte *)&UncompressedDataPtr[i * Pitch], Width);
-			break;
-
-		case GraphicEngine::CF_RGB15_INTERLEAVED:
-			for (i = 0; i < Height; i++)
-				RowARGB32ToRGB15_INTERLEAVED((byte *)(&RawDataBuffer[i * png_get_rowbytes(png_ptr, info_ptr)]),
-											 (byte *)&UncompressedDataPtr[i * Pitch], Width);
-			break;
-
 		case GraphicEngine::CF_ARGB32:
 			for (i = 0; i < Height; i++)
 				memcpy(&UncompressedDataPtr[i * Pitch], &RawDataBuffer[i * png_get_rowbytes(png_ptr, info_ptr)], Pitch);

Modified: scummvm/trunk/engines/sword25/gfx/opengl/swimage.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/opengl/swimage.cpp	2010-10-12 23:32:55 UTC (rev 53311)
+++ scummvm/trunk/engines/sword25/gfx/opengl/swimage.cpp	2010-10-12 23:33:23 UTC (rev 53312)
@@ -77,7 +77,7 @@
 
 	// Das Bild dekomprimieren
 	byte *pUncompressedData;
-	if (!ImageLoader::LoadImage(pFileData, fileSize, GraphicEngine::CF_ABGR32, pUncompressedData, _width, _height, pitch)) {
+	if (!ImageLoader::LoadImage(pFileData, fileSize, GraphicEngine::CF_ARGB32, pUncompressedData, _width, _height, pitch)) {
 		BS_LOG_ERRORLN("Could not decode image.");
 		return;
 	}


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list