aboutsummaryrefslogtreecommitdiff
path: root/scumm/smush
diff options
context:
space:
mode:
authorPaweł Kołodziejski2003-01-19 11:00:21 +0000
committerPaweł Kołodziejski2003-01-19 11:00:21 +0000
commit8f2b07260a7200e573a86f21a959ec5fa2b6a6ab (patch)
tree384ee9624423b6c6e50c1059c92798d8ee1bc12d /scumm/smush
parent5a42eb62a34c19184635936df6e36cde4fbc81fd (diff)
downloadscummvm-rg350-8f2b07260a7200e573a86f21a959ec5fa2b6a6ab.tar.gz
scummvm-rg350-8f2b07260a7200e573a86f21a959ec5fa2b6a6ab.tar.bz2
scummvm-rg350-8f2b07260a7200e573a86f21a959ec5fa2b6a6ab.zip
some cleanup
svn-id: r6515
Diffstat (limited to 'scumm/smush')
-rw-r--r--scumm/smush/codec44.cpp28
-rw-r--r--scumm/smush/codec44.h17
2 files changed, 14 insertions, 31 deletions
diff --git a/scumm/smush/codec44.cpp b/scumm/smush/codec44.cpp
index 8d872573aa..ece5faa06f 100644
--- a/scumm/smush/codec44.cpp
+++ b/scumm/smush/codec44.cpp
@@ -25,16 +25,14 @@
#include "blitter.h"
bool Codec44Decoder::decode(Blitter & dst, Chunk & src) {
- int32 size_line;
- int32 num;
+ int32 size_line, num;
int32 length = src.getSize() - 14;
int32 width = getRect().width();
int32 height = getRect().height();
byte * src2 = (byte*)malloc(length);
byte * org_src2 = src2;
src.read(src2, length);
- byte * dst2 = (byte*)malloc(2000);
- byte * org_dst2 = dst2;
+ byte * dst2 = _buffer;
byte val;
do {
@@ -49,25 +47,23 @@ bool Codec44Decoder::decode(Blitter & dst, Chunk & src) {
dst2 += num;
length -= 2;
size_line -= 2;
- if (size_line == 0)
- break;
-
- num = READ_LE_UINT16(src2) + 1;
- src2 += 2;
- memcpy(dst2, src2, num);
- dst2 += num;
- src2 += num;
- length -= num + 2;
- size_line -= num + 2;
+ if (size_line != 0) {
+ num = READ_LE_UINT16(src2) + 1;
+ src2 += 2;
+ memcpy(dst2, src2, num);
+ dst2 += num;
+ src2 += num;
+ length -= num + 2;
+ size_line -= num + 2;
+ }
}
dst2--;
} while (length > 1);
- dst.blit(org_dst2, width * height);
+ dst.blit(_buffer, width * height);
free(org_src2);
- free(org_dst2);
return true;
}
diff --git a/scumm/smush/codec44.h b/scumm/smush/codec44.h
index 4929efbc54..239c30099b 100644
--- a/scumm/smush/codec44.h
+++ b/scumm/smush/codec44.h
@@ -22,24 +22,11 @@
#ifndef CODEC44_H
#define CODEC44_H
-#include "config.h"
-
-#ifdef DEBUG
-# ifndef NO_DEBUG_CODEC44
-# define DEBUG_CODEC44
-# endif
-#else
-# ifdef DEBUG_CODEC44
-# error DEBUG_CODEC44 defined without DEBUG
-# endif
-#endif
-
#include "decoder.h"
-/*! @brief ::decoder for codec 21 and 44.
-
-*/
class Codec44Decoder : public Decoder {
+ byte _buffer[1000];
+
public:
bool decode(Blitter & dst, Chunk & src);
};