[Scummvm-cvs-logs] CVS: scummvm/backends/PalmOS/Src/arm drawstrip.cpp,NONE,1.1 drawstrip.h,NONE,1.1 proc3.cpp,NONE,1.1 proc3.h,NONE,1.1 PNOMain.cpp,1.3,1.4

Chris Apers chrilith at users.sourceforge.net
Sun Sep 12 05:43:00 CEST 2004


Update of /cvsroot/scummvm/scummvm/backends/PalmOS/Src/arm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31687

Modified Files:
	PNOMain.cpp 
Added Files:
	drawstrip.cpp drawstrip.h proc3.cpp proc3.h 
Log Message:
New ARM optimized functions

--- NEW FILE: drawstrip.cpp ---
#include "native.h"
#include "endianutils.h"

#define MAIN_TYPE	DrawStripType
#include "macros.h"

#define CHARSET_MASK_TRANSPARENCY	253

void Gdi_drawStripToScreen(void *userData68KP) {
// import variables
	SET32	(int			,width				)
	SET32	(int			,height				)
	SETPTR	(const byte *	,src				)
	SETPTR	(byte *			,dst				)
	SETPTR	(const byte *	,text				)
	SET32	(int			,_vm_screenWidth	)
	SET16	(uint16			,vs_pitch			)
	SET16	(uint16			,_textSurface_pitch	)
// end of import

	// Compose the text over the game graphics
	for (int h = 0; h < height; ++h) {
		for (int w = 0; w < width; ++w) {
			if (text[w] == CHARSET_MASK_TRANSPARENCY) 
				dst[w] = src[w];
			else
				dst[w] = text[w];
		}
		src += vs_pitch;
		dst += _vm_screenWidth;
		text += _textSurface_pitch;
	}
}
--- NEW FILE: drawstrip.h ---
#ifndef _OP_COSTUME2_H__
#define _OP_COSTUME2_H__

#include <PalmOS.h>

#define COMPILE_DRAWSTRIP

void Gdi_drawStripToScreen(void *userData68KP);

#endif
--- NEW FILE: proc3.cpp ---
#include "native.h"
#include "endianutils.h"

#define MAIN_TYPE	CostumeProc3Type
#include "macros.h"

#define MSETPTR(type, member)		v1.member = _GETPTR(v1comp, V1CodecType, member, type);
#define MSET32(type, member)		v1.member = _GET32(v1comp, V1CodecType, member, type);
#define MSET8(type, member)			v1.member = _GET8(v1comp, V1CodecType, member, type);

UInt32 CostumeRenderer_proc3(void *userData68KP) {
// import variables
	V1Type v1;
	
	SETPTRV	(V1CodecType *	, v1, v1comp				)

	SETPTR	(const byte *	,revBitMask					)
	SETPTR	(const byte *	,_srcptr					)
	SET32	(int			,_height					)
	SET8	(byte			,_scaleIndexX				)
	SET8	(byte			,_scaleIndexY				)
	SET8	(byte			,_scaleX					)
	SET8	(byte			,_scaleY					)
	SET32	(int32			,_numStrips					)
	SET32	(int			,_outwidth					)
	SET32	(int			,_outheight					)
	SETPTR	(byte *			,_shadow_table				)
	SETPTR	(byte *			,_vm_proc_special_palette	)
	SETPTR	(byte *			,_palette					)
	SET8	(byte			,_shadow_mode				)
	
	MSETPTR	(const byte *	,scaletable					)
	MSET8	(byte			,mask						)
	MSET8	(byte			,shr						)
	MSET8	(byte			,repcolor					)
	MSET8	(byte			,replen						)
	MSET32	(int			,scaleXstep					)
	MSET32	(int			,x							)
	MSET32	(int			,y							)
	MSET32	(int			,scaleXindex				)
	MSET32	(int			,scaleYindex				)
	MSET32	(int			,skip_width					)
	MSETPTR	(byte *			,destptr					)
	MSETPTR	(byte *			,mask_ptr					)
// end of import

	const byte *mask, *src;
	byte *dst;
	byte len, maskbit;
	int y;
	uint color, height, pcolor;
	const byte *scaleytab;
	bool masked;

	y = v1.y;
	src = _srcptr;
	dst = v1.destptr;
	len = v1.replen;
	color = v1.repcolor;
	height = _height;

	scaleytab = &v1.scaletable[_scaleIndexY];
	maskbit = revBitMask[v1.x & 7];
	mask = v1.mask_ptr + v1.x / 8;

	if (len)
		goto StartPos;

	do {
		len = *src++;
		color = len >> v1.shr;
		len &= v1.mask;

		if (!len)
			len = *src++;

		do {
			if (_scaleY == 255 || *scaleytab++ < _scaleY) {
				masked = (y < 0 || y >= _outheight) || (v1.mask_ptr && (mask[0] & maskbit));

				if (color && !masked) {
					// FIXME: Fully implement _shadow_mode.in Sam & Max
					// For now, it's enough for transparency.
					if (_shadow_mode & 0x20) {
						pcolor = _vm_proc_special_palette[*dst];
					} else {
						pcolor = _palette[color];
						if (pcolor == 13 && _shadow_table)
							pcolor = _shadow_table[*dst];
					}
					*dst = pcolor;
				}
				dst += _outwidth;
				mask += _numStrips;
				y++;
			}
			if (!--height) {
				if (!--v1.skip_width)
					goto end_jump;
				height = _height;
				y = v1.y;

				scaleytab = &v1.scaletable[_scaleIndexY];


				if (_scaleX == 255 || v1.scaletable[_scaleIndexX] < _scaleX) {
					v1.x += v1.scaleXstep;
					if (v1.x < 0 || v1.x >= _outwidth)
						goto end_jump;
					maskbit = revBitMask[v1.x & 7];
					v1.destptr += v1.scaleXstep;
				}
				_scaleIndexX += v1.scaleXstep;
				dst = v1.destptr;
				mask = v1.mask_ptr + v1.x / 8;
			}
		StartPos:;
		} while (--len);
	} while (1);

end_jump:
//	v1comp->x		= ByteSwap32(v1.x);
//	v1comp->destptr	= (byte *)ByteSwap32(v1.destptr);

	return _scaleIndexX;
}
--- NEW FILE: proc3.h ---
#ifndef _OP_COSTUME_H__
#define _OP_COSTUME_H__

#include <PalmOS.h>

#define COMPILE_COSTUMEPROC3

UInt32 CostumeRenderer_proc3(void *userData68KP);

#endif
Index: PNOMain.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/PalmOS/Src/arm/PNOMain.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- PNOMain.cpp	25 May 2004 13:43:00 -0000	1.3
+++ PNOMain.cpp	12 Sep 2004 12:42:07 -0000	1.4
@@ -1,5 +1,5 @@
 #include "PACEInterfaceLib.h"
-#include "ArmNative.h"
+#include "native.h"
 
 // Linker still looks for ARMlet_Main as entry point, but the
 // "ARMlet" name is now officially discouraged.  Compare an
@@ -23,29 +23,25 @@
 	InitPACEInterface(emulStateP, call68KFuncP);
 #endif
 
-#ifdef COMPILE_PA1SND
-	ARMPa1SndPtr userData = (ARMPa1SndPtr)userData68KP;
-	pcm2adpcm	(	(Int16 *)ReadUnaligned32(&(userData->srcP)),
-					(UInt8 *)ReadUnaligned32(&(userData->dstP)),
-					ReadUnaligned32(&(userData->length))
-				);
+#ifdef COMPILE_WIDELANDSCAPE
+	OSystem_updateScreen_wideLandscape(userData68KP);
 #endif
 
-#ifdef COMPILE_STREAMSND
-	retVal = (unsigned long)sndCallback;
+#ifdef COMPILE_WIDEPORTRAIT
+	OSystem_updateScreen_widePortrait(userData68KP);
 #endif
 
-#ifdef COMPILE_OWIDELS
-	O_WideLandscape(userData68KP);
+#ifdef COMPILE_COPYRECT
+	OSystem_CopyRectToScreen(userData68KP);
 #endif
 
-#ifdef COMPILE_OWIDEPT
-	O_WidePortrait(userData68KP);
+#ifdef COMPILE_COSTUMEPROC3
+	retVal = CostumeRenderer_proc3(userData68KP);
 #endif
 
-#ifdef COMPILE_OCOPYRECT
-	O_CopyRectToScreen(userData68KP);
+#ifdef COMPILE_DRAWSTRIP
+	Gdi_drawStripToScreen(userData68KP);
 #endif
 
-	return retVal;
+	return ByteSwap32(retVal);
 }





More information about the Scummvm-git-logs mailing list