[Scummvm-cvs-logs] scummvm master -> d2a210feb5d511c2aead9ca49bfbaa40cd10add6

lordhoto lordhoto at gmail.com
Fri Jan 6 15:55:10 CET 2012


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

Summary:
abbc87e180 GRAPHICS: Slight formatting fixes in jpeg.cpp.
243de5950f GRAPHICS: Slight cleanup in BDF code.
d2a210feb5 GRAPHICS: Properly return 0 for late BDF cache loading fails.


Commit: abbc87e180243d6918008f680330ded52c478b4c
    https://github.com/scummvm/scummvm/commit/abbc87e180243d6918008f680330ded52c478b4c
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-01-06T06:51:10-08:00

Commit Message:
GRAPHICS: Slight formatting fixes in jpeg.cpp.

Changed paths:
    graphics/jpeg.cpp



diff --git a/graphics/jpeg.cpp b/graphics/jpeg.cpp
index c97a540..de5f5b3 100644
--- a/graphics/jpeg.cpp
+++ b/graphics/jpeg.cpp
@@ -224,7 +224,7 @@ bool JPEG::read(Common::SeekableReadStream *stream) {
 bool JPEG::readJFIF() {
 	uint16 length = _stream->readUint16BE();
 	uint32 tag = _stream->readUint32BE();
-	if (tag != MKTAG('J','F','I','F')) {
+	if (tag != MKTAG('J', 'F', 'I', 'F')) {
 		warning("JPEG::readJFIF() tag mismatch");
 		return false;
 	}
@@ -234,7 +234,7 @@ bool JPEG::readJFIF() {
 	}
 	byte majorVersion = _stream->readByte();
 	byte minorVersion = _stream->readByte();
-	if(majorVersion != 1 || minorVersion != 1)
+	if (majorVersion != 1 || minorVersion != 1)
 		warning("JPEG::readJFIF() Non-v1.1 JPEGs may not be handled correctly");
 	/* byte densityUnits = */ _stream->readByte();
 	/* uint16 xDensity = */ _stream->readUint16BE();
@@ -304,7 +304,7 @@ bool JPEG::readDHT() {
 		// Free the Huffman table
 		delete[] _huff[tableNum].values; _huff[tableNum].values = NULL;
 		delete[] _huff[tableNum].sizes; _huff[tableNum].sizes = NULL;
-		delete[] _huff[tableNum].codes;	_huff[tableNum].codes = NULL;
+		delete[] _huff[tableNum].codes; _huff[tableNum].codes = NULL;
 
 		// Read the number of values for each length
 		uint8 numValues[16];
@@ -511,13 +511,13 @@ void JPEG::idct8x8(float result[64], const int16 dct[64]) {
 	for (int y = 0; y < 8; y++) {
 		for (int x = 0; x < 8; x++) {
 			tmp[y + x * 8] = dct[0] * _idct8x8[x][0]
-							+ dct[1] * _idct8x8[x][1]
-							+ dct[2] * _idct8x8[x][2]
-							+ dct[3] * _idct8x8[x][3]
-							+ dct[4] * _idct8x8[x][4]
-							+ dct[5] * _idct8x8[x][5]
-							+ dct[6] * _idct8x8[x][6]
-							+ dct[7] * _idct8x8[x][7];
+			                 + dct[1] * _idct8x8[x][1]
+			                 + dct[2] * _idct8x8[x][2]
+			                 + dct[3] * _idct8x8[x][3]
+			                 + dct[4] * _idct8x8[x][4]
+			                 + dct[5] * _idct8x8[x][5]
+			                 + dct[6] * _idct8x8[x][6]
+			                 + dct[7] * _idct8x8[x][7];
 		}
 
 		dct += 8;
@@ -528,13 +528,13 @@ void JPEG::idct8x8(float result[64], const int16 dct[64]) {
 		const float *u = tmp + x * 8;
 		for (int y = 0; y < 8; y++) {
 			result[y * 8 + x] = u[0] * _idct8x8[y][0]
-								+ u[1] * _idct8x8[y][1]
-								+ u[2] * _idct8x8[y][2]
-								+ u[3] * _idct8x8[y][3]
-								+ u[4] * _idct8x8[y][4]
-								+ u[5] * _idct8x8[y][5]
-								+ u[6] * _idct8x8[y][6]
-								+ u[7] * _idct8x8[y][7];
+			                    + u[1] * _idct8x8[y][1]
+			                    + u[2] * _idct8x8[y][2]
+			                    + u[3] * _idct8x8[y][3]
+			                    + u[4] * _idct8x8[y][4]
+			                    + u[5] * _idct8x8[y][5]
+			                    + u[6] * _idct8x8[y][6]
+			                    + u[7] * _idct8x8[y][7];
 		}
 	}
 }
@@ -654,9 +654,8 @@ int16 JPEG::readSignedBits(uint8 numBits) {
 		ret = (ret << 1) + readBit();
 
 	// Extend sign bits (PAG109)
-	if (!(ret >> (numBits - 1)))
-	{
-		uint16 tmp = ((uint16)-1 << numBits) + 1;
+	if (!(ret >> (numBits - 1))) {
+		uint16 tmp = ((uint16) - 1 << numBits) + 1;
 		ret = ret + tmp;
 	}
 	return ret;


Commit: 243de5950f8405e5958687b8f733994ca60f0320
    https://github.com/scummvm/scummvm/commit/243de5950f8405e5958687b8f733994ca60f0320
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-01-06T06:52:55-08:00

Commit Message:
GRAPHICS: Slight cleanup in BDF code.

Changed paths:
    graphics/fonts/bdf.cpp



diff --git a/graphics/fonts/bdf.cpp b/graphics/fonts/bdf.cpp
index 2bc0582..36d4455 100644
--- a/graphics/fonts/bdf.cpp
+++ b/graphics/fonts/bdf.cpp
@@ -482,6 +482,9 @@ BdfFont *BdfFont::loadFont(Common::SeekableReadStream &stream) {
 	return new BdfFont(font, DisposeAfterUse::YES);
 }
 
+#define BDF_FONTCACHE_TAG MKTAG('S', 'V', 'F', 'C')
+#define BDF_FONTCACHE_VERSION 1
+
 bool BdfFont::cacheFontData(const BdfFont &font, const Common::String &filename) {
 	Common::DumpFile cacheFile;
 	if (!cacheFile.open(filename)) {
@@ -491,8 +494,8 @@ bool BdfFont::cacheFontData(const BdfFont &font, const Common::String &filename)
 
 	const BdfFontData &data = font._data;
 
-	cacheFile.writeUint32BE(MKTAG('S', 'V', 'F', 'C'));
-	cacheFile.writeUint32BE(1);
+	cacheFile.writeUint32BE(BDF_FONTCACHE_TAG);
+	cacheFile.writeUint32BE(BDF_FONTCACHE_VERSION);
 	cacheFile.writeUint16BE(data.maxAdvance);
 	cacheFile.writeByte(data.height);
 	cacheFile.writeByte(data.defaultBox.width);
@@ -541,11 +544,11 @@ bool BdfFont::cacheFontData(const BdfFont &font, const Common::String &filename)
 
 BdfFont *BdfFont::loadFromCache(Common::SeekableReadStream &stream) {
 	const uint32 magic = stream.readUint32BE();
-	if (magic != MKTAG('S', 'V', 'F', 'C'))
+	if (magic != BDF_FONTCACHE_TAG)
 		return 0;
 
 	const uint32 version = stream.readUint32BE();
-	if (version != 1)
+	if (version != BDF_FONTCACHE_VERSION)
 		return 0;
 
 	BdfFontData data;


Commit: d2a210feb5d511c2aead9ca49bfbaa40cd10add6
    https://github.com/scummvm/scummvm/commit/d2a210feb5d511c2aead9ca49bfbaa40cd10add6
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-01-06T06:53:22-08:00

Commit Message:
GRAPHICS: Properly return 0 for late BDF cache loading fails.

Changed paths:
    graphics/fonts/bdf.cpp



diff --git a/graphics/fonts/bdf.cpp b/graphics/fonts/bdf.cpp
index 36d4455..6fa886a 100644
--- a/graphics/fonts/bdf.cpp
+++ b/graphics/fonts/bdf.cpp
@@ -610,6 +610,7 @@ BdfFont *BdfFont::loadFromCache(Common::SeekableReadStream &stream) {
 		delete[] bitmaps;
 		delete[] advances;
 		delete[] boxes;
+		return 0;
 	}
 
 	data.bitmaps = bitmaps;






More information about the Scummvm-git-logs mailing list