[Scummvm-cvs-logs] SF.net SVN: scummvm: [31532] scummvm/trunk/engines/parallaction/graphics. cpp

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Thu Apr 17 11:31:22 CEST 2008


Revision: 31532
          http://scummvm.svn.sourceforge.net/scummvm/?rev=31532&view=rev
Author:   peres001
Date:     2008-04-17 02:31:22 -0700 (Thu, 17 Apr 2008)

Log Message:
-----------
Replaced unpackBlt with a more general version that can also unpack animation in BRA.

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/graphics.cpp

Modified: scummvm/trunk/engines/parallaction/graphics.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.cpp	2008-04-17 09:30:04 UTC (rev 31531)
+++ scummvm/trunk/engines/parallaction/graphics.cpp	2008-04-17 09:31:22 UTC (rev 31532)
@@ -527,6 +527,7 @@
 // this is the maximum size of an unpacked frame in BRA
 byte _unpackedBitmap[640*401];
 
+#if 0
 void Gfx::unpackBlt(const Common::Rect& r, byte *data, uint size, Graphics::Surface *surf, uint16 z, byte transparentColor) {
 
 	byte *d = _unpackedBitmap;
@@ -548,8 +549,37 @@
 
 	blt(r, _unpackedBitmap, surf, z, transparentColor);
 }
+#endif
+void Gfx::unpackBlt(const Common::Rect& r, byte *data, uint size, Graphics::Surface *surf, uint16 z, byte transparentColor) {
 
+	byte *d = _unpackedBitmap;
+	uint pixelsLeftInLine = r.width();
 
+	while (size > 0) {
+		uint8 p = *data++;
+		size--;
+		uint8 color = p & 0xF;
+		uint8 repeat = (p & 0xF0) >> 4;
+		if (repeat == 0) {
+			repeat = *data++;
+			size--;
+		}
+		if (repeat == 0) {
+			// end of line
+			repeat = pixelsLeftInLine;
+			pixelsLeftInLine = r.width();
+		} else {
+			pixelsLeftInLine -= repeat;
+		}
+
+		memset(d, color, repeat);
+		d += repeat;
+	}
+
+	blt(r, _unpackedBitmap, surf, z, transparentColor);
+}
+
+
 void Gfx::blt(const Common::Rect& r, byte *data, Graphics::Surface *surf, uint16 z, byte transparentColor) {
 
 	Common::Point dp;


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