2007-05-30 21:56:52 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
2002-08-24 15:31:37 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2014-02-18 01:34:24 +00:00
|
|
|
*
|
2002-08-24 15:31:37 +00:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2014-02-18 01:34:24 +00:00
|
|
|
*
|
2002-08-24 15:31:37 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2005-10-18 01:30:26 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2002-08-24 15:31:37 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2007-09-19 08:40:12 +00:00
|
|
|
|
2006-03-29 15:59:37 +00:00
|
|
|
#include "common/endian.h"
|
2002-08-24 15:31:37 +00:00
|
|
|
|
2003-10-03 18:33:57 +00:00
|
|
|
namespace Scumm {
|
|
|
|
|
2005-06-17 18:10:51 +00:00
|
|
|
void smush_decode_codec1(byte *dst, const byte *src, int left, int top, int width, int height, int pitch) {
|
2003-03-17 12:28:50 +00:00
|
|
|
byte val, code;
|
|
|
|
int32 length;
|
|
|
|
int h = height, size_line;
|
2002-08-24 15:31:37 +00:00
|
|
|
|
2005-06-17 18:10:51 +00:00
|
|
|
dst += top * pitch;
|
2003-06-07 00:45:32 +00:00
|
|
|
for (h = 0; h < height; h++) {
|
2003-03-17 12:28:50 +00:00
|
|
|
size_line = READ_LE_UINT16(src);
|
2003-03-13 01:24:02 +00:00
|
|
|
src += 2;
|
2004-01-30 02:14:29 +00:00
|
|
|
dst += left;
|
2003-06-07 00:45:32 +00:00
|
|
|
while (size_line > 0) {
|
2003-03-13 01:24:02 +00:00
|
|
|
code = *src++;
|
2003-03-13 00:37:03 +00:00
|
|
|
size_line--;
|
2002-08-24 15:31:37 +00:00
|
|
|
length = (code >> 1) + 1;
|
2003-06-07 00:45:32 +00:00
|
|
|
if (code & 1) {
|
2003-03-13 01:24:02 +00:00
|
|
|
val = *src++;
|
2003-03-13 00:37:03 +00:00
|
|
|
size_line--;
|
|
|
|
if (val)
|
|
|
|
memset(dst, val, length);
|
|
|
|
dst += length;
|
2002-08-24 15:31:37 +00:00
|
|
|
} else {
|
|
|
|
size_line -= length;
|
2003-06-07 00:45:32 +00:00
|
|
|
while (length--) {
|
2003-03-13 01:24:02 +00:00
|
|
|
val = *src++;
|
2003-03-13 00:37:03 +00:00
|
|
|
if (val)
|
|
|
|
*dst = val;
|
|
|
|
dst++;
|
2002-08-24 15:31:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2005-06-17 18:10:51 +00:00
|
|
|
dst += pitch - left - width;
|
2002-08-24 15:31:37 +00:00
|
|
|
}
|
|
|
|
}
|
2003-10-03 18:33:57 +00:00
|
|
|
|
|
|
|
} // End of namespace Scumm
|