aboutsummaryrefslogtreecommitdiff
path: root/engines/parallaction/graphics.cpp
diff options
context:
space:
mode:
authorNicola Mettifogo2008-04-17 09:31:22 +0000
committerNicola Mettifogo2008-04-17 09:31:22 +0000
commit984e42569e263505f2e13000613d2c35aee49b43 (patch)
tree60beaffe73c8fac66adf68301815a7b3c97f3c96 /engines/parallaction/graphics.cpp
parentff2dfb6a4ea34389e71ea6ea3afbd4449c333dfa (diff)
downloadscummvm-rg350-984e42569e263505f2e13000613d2c35aee49b43.tar.gz
scummvm-rg350-984e42569e263505f2e13000613d2c35aee49b43.tar.bz2
scummvm-rg350-984e42569e263505f2e13000613d2c35aee49b43.zip
Replaced unpackBlt with a more general version that can also unpack animation in BRA.
svn-id: r31532
Diffstat (limited to 'engines/parallaction/graphics.cpp')
-rw-r--r--engines/parallaction/graphics.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp
index 314a97a8b4..f92a58cdb0 100644
--- a/engines/parallaction/graphics.cpp
+++ b/engines/parallaction/graphics.cpp
@@ -527,6 +527,7 @@ void Gfx::invertBackground(const Common::Rect& r) {
// 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,6 +549,35 @@ void Gfx::unpackBlt(const Common::Rect& r, byte *data, uint size, Graphics::Surf
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) {