[Scummvm-cvs-logs] scummvm master -> 5df8c99768205ad6e2380dbc7cbc838e4ab5cc85

lordhoto lordhoto at gmail.com
Tue Aug 21 02:21:14 CEST 2012


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
5df8c99768 GPRAHICS: Slight cleanup in png.cpp.


Commit: 5df8c99768205ad6e2380dbc7cbc838e4ab5cc85
    https://github.com/scummvm/scummvm/commit/5df8c99768205ad6e2380dbc7cbc838e4ab5cc85
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-08-20T17:19:51-07:00

Commit Message:
GPRAHICS: Slight cleanup in png.cpp.

This adds an explanation why we use FORBIDDEN_SYMBOL_ALLOW_ALL and removes
some trailing whitespaces.

Changed paths:
    graphics/decoders/png.cpp



diff --git a/graphics/decoders/png.cpp b/graphics/decoders/png.cpp
index f047189..bfaab6d 100644
--- a/graphics/decoders/png.cpp
+++ b/graphics/decoders/png.cpp
@@ -19,6 +19,9 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
  */
+
+// Since we need to work with libpng here, we need to allow all symbols
+// to avoid compilation issues.
 #define FORBIDDEN_SYMBOL_ALLOW_ALL
 #include "common/scummsys.h"
 
@@ -84,7 +87,7 @@ bool PNGDecoder::loadStream(Common::SeekableReadStream &stream) {
 	destroy();
 
 	_stream = &stream;
-	
+
 	// First, check the PNG signature
 	if (_stream->readUint32BE() != MKTAG(0x89, 'P', 'N', 'G')) {
 		delete _stream;
@@ -155,7 +158,7 @@ bool PNGDecoder::loadStream(Common::SeekableReadStream &stream) {
 			_palette[(i * 3)] = palette[i].red;
 			_palette[(i * 3) + 1] = palette[i].green;
 			_palette[(i * 3) + 2] = palette[i].blue;
-			
+
 		}
 		_outputSurface->create(width, height, Graphics::PixelFormat::createFormatCLUT8());
 		png_set_packing(pngPtr);
@@ -173,7 +176,7 @@ bool PNGDecoder::loadStream(Common::SeekableReadStream &stream) {
 		if (colorType == PNG_COLOR_TYPE_GRAY ||
 			colorType == PNG_COLOR_TYPE_GRAY_ALPHA)
 			png_set_gray_to_rgb(pngPtr);
-		
+
 		// PNGs are Big-Endian:
 #ifdef SCUMM_LITTLE_ENDIAN
 		png_set_bgr(pngPtr);
@@ -186,7 +189,7 @@ bool PNGDecoder::loadStream(Common::SeekableReadStream &stream) {
 #endif
 
 	}
-	
+
 	// After the transformations have been registered, the image data is read again.
 	png_read_update_info(pngPtr, infoPtr);
 	png_get_IHDR(pngPtr, infoPtr, &w, &h, &bitDepth, &colorType, NULL, NULL, NULL);
@@ -201,24 +204,24 @@ bool PNGDecoder::loadStream(Common::SeekableReadStream &stream) {
 	} else {
 		// PNGs with interlacing require us to allocate an auxillary
 		// buffer with pointers to all row starts.
-		
+
 		// Allocate row pointer buffer
 		png_bytep *rowPtr = new png_bytep[height];
 		if (!rowPtr) {
 			error("Could not allocate memory for row pointers.");
 		}
-		
+
 		// Initialize row pointers
 		for (int i = 0; i < height; i++)
 			rowPtr[i] = (png_bytep)_outputSurface->getBasePtr(0, i);
-		
+
 		// Read image data
 		png_read_image(pngPtr, rowPtr);
-		
+
 		// Free row pointer buffer
 		delete[] rowPtr;
 	}
-	
+
 	// Read additional data at the end.
 	png_read_end(pngPtr, NULL);
 






More information about the Scummvm-git-logs mailing list