aboutsummaryrefslogtreecommitdiff
path: root/backends/PalmOS/Src/arm/decompressrle7.cpp
blob: 49976d6a95733258e75597ba69d6b0161e67098c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include "native.h"
#include "endianutils.h"

#define MAIN_TYPE	CompressType
#include "macros.h"

UInt32 Screen_decompressRLE7(void *userData68KP) {
// import variables
	SETPTR	(UInt8 *	,src	);
	SET32	(UInt32,	compSize);
	SETPTR	(UInt8 *	,dest	);
// end of import

	uint8 *compBufEnd = src + compSize;
	while (src < compBufEnd) {
		uint8 code = *src++;
		if ((code > 127) || (code == 0))
			*dest++ = code;
		else {
			code++;
			MemSet(dest, code, *src++);
			dest += code;
		}
	}
	
	return 0;
}