[Scummvm-cvs-logs] CVS: scummex image.cpp,1.15,1.16 image.h,1.9,1.10

Adrien Mercier yoshizf at users.sourceforge.net
Wed Sep 24 12:13:07 CEST 2003


Update of /cvsroot/scummvm/scummex
In directory sc8-pr-cvs1:/tmp/cvs-serv31170

Modified Files:
	image.cpp image.h 
Log Message:
Added codecs used by fonts in .NUT

Index: image.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummex/image.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- image.cpp	24 Sep 2003 11:49:30 -0000	1.15
+++ image.cpp	24 Sep 2003 19:12:16 -0000	1.16
@@ -218,18 +218,23 @@
 	_codec37.init(_blockTable[id].width, _blockTable[id].height);
 	_codec47.init(_blockTable[id].width, _blockTable[id].height);
 	chunk_buffer = (byte *)malloc(_blockTable[id].blockSize - 22);
-	dstorg = dst = (byte *)malloc(_blockTable[id].width*_blockTable[id].height);
+	dstorg = dst = (byte *)malloc(_blockTable[id].width * _blockTable[id].height + 1000);
 	_input.read(chunk_buffer, _blockTable[id].blockSize - 22);
 
 	switch (_blockTable[id].variables) {
 		case 1:
-			bompDecodeLine(dst, chunk_buffer, _blockTable[id].blockSize - 22);
+			decodeCodec1(dst, chunk_buffer, _blockTable[id].height);
 			break;
 
 		case 37:
 			_codec37.decode(dst, chunk_buffer);
 			break;
 
+		case 44:
+		case 22:
+			decodeCodec44(dst, chunk_buffer, _blockTable[id].blockSize - 22);
+			break;
+
 		case 47:
 			_codec47.decode(dst, chunk_buffer);
 			break;
@@ -748,5 +753,67 @@
 				} 
 			} 
 		} 
+	}
+}
+
+void Image::decodeCodec44(byte *dst, const byte *src, uint32 length) {
+	byte val;
+	uint16 size_line, num;
+
+	do {
+		size_line = READ_LE_UINT16(src);
+		src += 2;
+		length -= 2;
+
+		while (size_line != 0) {
+			num = *src++;
+			val = *src++;
+			memset(dst, val, num);
+			dst += num;
+			length -= 2;
+			size_line -= 2;
+			if (size_line != 0) {
+				num = READ_LE_UINT16(src) + 1;
+				src += 2;
+				memcpy(dst, src, num);
+				dst += num;
+				src += num;
+				length -= num + 2;
+				size_line -= num + 2;
+			}
+		}
+		dst--;
+
+	} while (length > 1);
+}
+
+void Image::decodeCodec1(byte *dst, byte *src, int height) {
+	byte val, code;
+	int32 length;
+	int h = height, size_line;
+
+	for (h = 0; h < height; h++) {
+		size_line = READ_LE_UINT16(src);
+		src += 2;
+		while (size_line > 0) {
+			code = *src++;
+			size_line--;
+			length = (code >> 1) + 1;
+			if (code & 1) {
+				val = *src++;
+				size_line--;
+				if (val)
+					memset(dst, val, length);
+				dst += length;
+			} else {
+				size_line -= length;
+				while (length--) {
+					val = *src++;
+					if (val)
+						*dst = val;
+					dst++;
+				}
+			}
+		}
 	}
 }

Index: image.h
===================================================================
RCS file: /cvsroot/scummvm/scummex/image.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- image.h	24 Sep 2003 11:49:30 -0000	1.9
+++ image.h	24 Sep 2003 19:12:17 -0000	1.10
@@ -71,6 +71,8 @@
 	void decode2(uint16 height, uint8 compr, File& _input);
 	void decode2transp(uint16 height, uint8 compr, File& _inpuit);
 	void GetStrip( uint8 pos, File& _input);
+	void decodeCodec44(byte *dst, const byte *src, uint32 length);
+	void decodeCodec1(byte *dst, byte *src, int height);
 };
 
 #endif





More information about the Scummvm-git-logs mailing list