[Scummvm-cvs-logs] CVS: scummvm/morphos morphos.cpp,1.14,1.15 morphos.h,1.6,1.7

Ruediger Hanke tomjoad at users.sourceforge.net
Mon Apr 29 06:13:02 CEST 2002


Update of /cvsroot/scummvm/scummvm/morphos
In directory usw-pr-cvs1:/tmp/cvs-serv10700

Modified Files:
	morphos.cpp morphos.h 
Log Message:
Sped-up version of AdvMame2x scaler for MorphOS-native interface integrated

Index: morphos.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/morphos/morphos.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** morphos.cpp	22 Apr 2002 15:55:20 -0000	1.14
--- morphos.cpp	29 Apr 2002 13:12:45 -0000	1.15
***************
*** 66,69 ****
--- 66,70 ----
  OSystem_MorphOS::GfxScaler OSystem_MorphOS::ScummScalers[ 10 ] = { { "none", ST_NONE },
  																  { "Point", 		ST_POINT },
+ 																  { "AdvMame2x",  ST_ADVMAME2X },
  																  { "SuperEagle", ST_SUPEREAGLE },
  																  { "Super2xSaI", ST_SUPER2XSAI },
***************
*** 72,76 ****
  																  { NULL, ST_INVALID },
  																  { NULL, ST_INVALID },
- 																  { NULL, ST_INVALID },
  																  { NULL, ST_INVALID }
  																};
--- 73,76 ----
***************
*** 78,82 ****
  struct TagItem musicProcTags[] = { { NP_Entry, 	     0							     		},
  											  { NP_Name, 	     (ULONG)"ScummVM Music Thread" 	},
- 											  { NP_StackSize,	  8192 									},
  											  { NP_Priority,    0  								      },
  											  { TAG_DONE,       0 						     			}
--- 78,81 ----
***************
*** 84,88 ****
  struct TagItem soundProcTags[] = { { NP_Entry, 	     0							     		},
  											  { NP_Name, 	     (ULONG)"ScummVM Sound Thread" 	},
- 											  { NP_StackSize,	  8192 									},
  											  { NP_Priority,    0  								      },
  											  { TAG_DONE,       0 						     			}
--- 83,86 ----
***************
*** 524,528 ****
  		if( RealDepth != ScummDepth )
  		{
! 			warning( "Screen did not open in expected depth." );
  			ScummDepth = RealDepth;
  		}
--- 522,526 ----
  		if( RealDepth != ScummDepth )
  		{
! 			warning( "Screen did not open in expected depth" );
  			ScummDepth = RealDepth;
  		}
***************
*** 1321,1324 ****
--- 1319,1412 ----
  }
  
+ void OSystem_MorphOS::AdvMame2xScaler( uint32 src_x, uint32 src_y, uint32 dest_x, uint32 dest_y, uint32 width, uint32 height )
+ {
+ 	byte  *dest;
+ 	uint32 dest_bpp;
+ 	uint32 dest_pitch;
+ 	APTR handle;
+ 
+ 	if( (handle = LockBitMapTags( ScummRenderTo, LBMI_BYTESPERPIX, &dest_bpp, LBMI_BYTESPERROW, &dest_pitch, LBMI_BASEADDRESS, &dest, TAG_DONE )) == 0 )
+ 		return;
+ 
+ 	byte *src = (byte *)ScummBuffer+src_y*320+src_x;
+ 
+ 	src_line[0] = src;
+ 	src_line[1] = src;
+ 	src_line[2] = src + 320;
+ 
+ 	dst_line[0] = dest+dest_y*2*dest_pitch+dest_x*2*dest_bpp;
+ 	dst_line[1] = dst_line[0]+dest_pitch;
+ 
+ 	for( int y = 0; y < height; y++ )
+ 	{
+ 		for( int x = 0; x < width; x++ )
+ 		{
+ 			uint32 B, D, E, F, H;
+ 
+ 			if( PixelsPerMask == 2 )
+ 			{
+ 				// short A = *(src + i - nextlineSrc - 1);
+ 				B = ScummColors16[ src_line[ 0 ][ x ] ];
+ 				// short C = *(src + i - nextlineSrc + 1);
+ 				D = ScummColors16[ src_line[ 1 ][ x-1 ] ];
+ 				E = ScummColors16[ src_line[ 1 ][ x ] ];
+ 				F = ScummColors16[ src_line[ 1 ][ x+1 ] ];
+ 				// short G = *(src + i + nextlineSrc - 1);
+ 				H = ScummColors16[ src_line[ 2 ][ x ] ];
+ 				// short I = *(src + i + nextlineSrc + 1);
+ 			}
+ 			else
+ 			{
+ 				// short A = *(src + i - nextlineSrc - 1);
+ 				B = ScummColors[ src_line[ 0 ][ x ] ];
+ 				// short C = *(src + i - nextlineSrc + 1);
+ 				D = ScummColors[ src_line[ 1 ][ x-1 ] ];
+ 				E = ScummColors[ src_line[ 1 ][ x ] ];
+ 				F = ScummColors[ src_line[ 1 ][ x+1 ] ];
+ 				// short G = *(src + i + nextlineSrc - 1);
+ 				H = ScummColors[ src_line[ 2 ][ x ] ];
+ 				// short I = *(src + i + nextlineSrc + 1);
+ 			}
+ 
+ 
+ 			if (PixelsPerMask == 2)
+ 			{
+ 				if( ScummPCMode )
+ 				{
+ 					SWAP_WORD( B );
+ 					SWAP_WORD( D );
+ 					SWAP_WORD( E );
+ 					SWAP_WORD( F );
+ 					SWAP_WORD( H );
+ 				}
+ 				*((unsigned long *) (&dst_line[0][x * 4])) = ((D == B && B != F && D != H ? D : E) << 16) | (B == F && B != D && F != H ? F : E);
+ 				*((unsigned long *) (&dst_line[1][x * 4])) = ((D == H && D != B && H != F ? D : E) << 16) | (H == F && D != H && B != F ? F : E);
+ 			}
+ 			else
+ 			{
+ 				*((unsigned long *) (&dst_line[0][x * 8])) = D == B && B != F && D != H ? D : E;
+ 				*((unsigned long *) (&dst_line[0][x * 8 + 4])) = B == F && B != D && F != H ? F : E;
+ 				*((unsigned long *) (&dst_line[1][x * 8])) = D == H && D != B && H != F ? D : E;
+ 				*((unsigned long *) (&dst_line[1][x * 8 + 4])) = H == F && D != H && B != F ? F : E;
+ 			}
+ 		}
+ 
+ 		src_line[0] = src_line[1];
+ 		src_line[1] = src_line[2];
+ 		if (y + 2 >= height)
+ 			src_line[2] = src_line[1];
+ 		else
+ 			src_line[2] = src_line[1] + 320;
+ 
+ 		if( y < height - 1 )
+ 		{
+ 			dst_line[0] = dst_line[1]+dest_pitch;
+ 			dst_line[1] = dst_line[0]+dest_pitch;
+ 		}
+ 	}
+ 
+ 	UnLockBitMap( handle );
+ }
+ 
  void OSystem_MorphOS::PointScaler( uint32 src_x, uint32 src_y, uint32 dest_x, uint32 dest_y, uint32 width, uint32 height )
  {
***************
*** 1442,1445 ****
--- 1530,1537 ----
  			case ST_POINT:
  				PointScaler( 0, src_y, 0, dest_y, 320, 200-src_y-dest_y );
+ 				break;
+ 
+ 			case ST_ADVMAME2X:
+ 				AdvMame2xScaler( 0, src_y, 0, dest_y, 320, 200-src_y-dest_y );
  				break;
  

Index: morphos.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/morphos/morphos.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** morphos.h	22 Apr 2002 15:55:20 -0000	1.6
--- morphos.h	29 Apr 2002 13:12:45 -0000	1.7
***************
*** 28,32 ****
  {
  	public:
! 		typedef enum { ST_INVALID = 0, ST_NONE, ST_POINT, ST_SUPEREAGLE, ST_SUPER2XSAI } SCALERTYPE;
  
  					OSystem_MorphOS( int game_id, SCALERTYPE gfx_mode, bool full_screen );
--- 28,32 ----
  {
  	public:
! 		typedef enum { ST_INVALID = 0, ST_NONE, ST_POINT, ST_ADVMAME2X, ST_SUPEREAGLE, ST_SUPER2XSAI } SCALERTYPE;
  
  					OSystem_MorphOS( int game_id, SCALERTYPE gfx_mode, bool full_screen );
***************
*** 116,119 ****
--- 116,120 ----
  		void   		  Super2xSaI		( uint32 src_x, uint32 src_y, uint32 dest_x, uint32 dest_y, uint32 width, uint32 height );
  		void   		  SuperEagle		( uint32 src_x, uint32 src_y, uint32 dest_x, uint32 dest_y, uint32 width, uint32 height );
+ 		void 			  AdvMame2xScaler ( uint32 src_x, uint32 src_y, uint32 dest_x, uint32 dest_y, uint32 width, uint32 height );
  		void   		  PointScaler		( uint32 src_x, uint32 src_y, uint32 dest_x, uint32 dest_y, uint32 width, uint32 height );
  





More information about the Scummvm-git-logs mailing list