⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mqs2s.blt

📁 WinCE 3.0 BSP, 包含Inter SA1110, Intel_815E, Advantech_PCM9574 等
💻 BLT
字号:
#if defined( CHECK_8BPP ) || defined( CHECK_16BPP )
#if 1
SCODE MQGC::S2SBlt( GPEBltParms *pBltParms )
{
	DEBUGMSG(GPE_ZONE_MQEMUL1,(TEXT("S2SBlt\r\n")));
	ULONG	xPositive = pBltParms->xPositive;
	ULONG	yPositive = pBltParms->yPositive;
#ifdef	HW_ROTATE
	BOOL	bDoHW;
	if ( m_pPatternSetup )
		bDoHW=FALSE;
	else
		bDoHW=TRUE;	
#endif

#ifdef	HW_ROTATE
	if(!bDoHW)	
#endif
		ROTATE_PARAMS(pBltParms);
		
	geINIT( pBltParms->pDst );

	ULONG	ulCmd, srcxy, wh;
	ulCmd = m_ulRop3 | DO_BITBLT;
	m_ulDestXY = (pBltParms->prclDst->top << 16) | pBltParms->prclDst->left;
	wh = ((pBltParms->prclDst->bottom << 16) | pBltParms->prclDst->right)
			- m_ulDestXY;
	m_ulDestXY += ((MQGCSurf *)(pBltParms->pDst))->m_ulTopLeft;

	// NOTE: MUST USE pBltParms->prclSrc here, or else gdibench 
	// will not work well. (benny 2/1/99)
	srcxy = ((pBltParms->prclSrc->top << 16) | pBltParms->prclSrc->left)
			+ ((MQGCSurf *)(pBltParms->pSrc))->m_ulTopLeft;

#ifdef HW_ROTATE
//	DEBUGMSG(GPE_ZONE_INIT, (TEXT("Before Rotate:srcxy=0x%08x, dstxy=0x%08x,wh=0x%08x,cmd=0x%08x.\r\n"),
//					srcxy,m_ulDestXY,wh,ulCmd ));
	if(bDoHW)
	HW_ROTATE_S2S(&srcxy,&m_ulDestXY,&wh,&xPositive,&yPositive);
#endif

	if ( !xPositive )
	{
		ULONG	w = (wh & 0x0000FFFFUL) - 0x01UL;
		m_ulDestXY += w;
		srcxy += w;
		ulCmd |= X_DIR;
	}
	if ( !yPositive )
	{ 
		ULONG	h = (wh & 0xFFFF0000UL) - 0x10000UL;
		m_ulDestXY += h;
		srcxy += h;
		ulCmd |= Y_DIR;
	}

	if ( m_pPatternSetup )
	{
		DEBUGMSG(GPE_ZONE_INIT, (TEXT("S2S ROP3 patten exists.\r\n") ));
		if ( m_pBrush )
			m_lpPattern = (PULONG)m_pBrush->Buffer();
		(this->*m_pPatternSetup)(pBltParms, &ulCmd);
	}

//	DEBUGMSG(GPE_ZONE_INIT, (TEXT("After Rotate:srcxy=0x%08x, dstxy=0x%08x,wh=0x%08x,cmd=0x%08x.\r\n"),
//					srcxy,m_ulDestXY,wh,ulCmd ));

	geWAITCMDFIFO( 4 );
	geREG(WIDTH_HEIGHT,		wh);
	geREG(DEST_XY,			m_ulDestXY);
	geREG(SRC_XY,			srcxy);
	SET_GE_DEST_STRIDE(m_ulDestStride);
	geREG(DRAW_CMD,			ulCmd);

	geTERMINATE();
	
#ifdef	HW_ROTATE
	if(!bDoHW)	
#endif
	ROTATE_PARAMS_BACK(pBltParms);
	
	RETURN_S2SBLT;
}
#else

SCODE MQGC::S2SBlt( GPEBltParms *pBltParms )
{
	DEBUGMSG(GPE_ZONE_MQEMUL1,(TEXT("S2SBlt\r\n")));
	
#ifndef HW_ROTATE
//#if 1
	ROTATE_PARAMS(pBltParms);
#endif
	
	geINIT( pBltParms->pDst );

	ULONG	ulCmd, srcxy, wh;
	ulCmd = m_ulRop3 | DO_BITBLT;
	m_ulDestXY = (pBltParms->prclDst->top << 16) | pBltParms->prclDst->left;
	wh = ((pBltParms->prclDst->bottom << 16) | pBltParms->prclDst->right)
			- m_ulDestXY;
	m_ulDestXY += ((MQGCSurf *)(pBltParms->pDst))->m_ulTopLeft;

	// NOTE: MUST USE pBltParms->prclSrc here, or else gdibench 
	// will not work well. (benny 2/1/99)
	srcxy = ((pBltParms->prclSrc->top << 16) | pBltParms->prclSrc->left)
			+ ((MQGCSurf *)(pBltParms->pSrc))->m_ulTopLeft;

	if ( !pBltParms->xPositive )
	{
		ULONG	w = (wh & 0x0000FFFFUL) - 0x01UL;
		m_ulDestXY += w;
		srcxy += w;
		ulCmd |= X_DIR;
	}
	if ( !pBltParms->yPositive )
	{ 
		ULONG	h = (wh & 0xFFFF0000UL) - 0x10000UL;
		m_ulDestXY += h;
		srcxy += h;
		ulCmd |= Y_DIR;
	}

	if ( m_pPatternSetup )
	{
		DEBUGMSG(GPE_ZONE_INIT, (TEXT("S2S ROP3 patten exists.\r\n") ));
		if ( m_pBrush )
			m_lpPattern = (PULONG)m_pBrush->Buffer();
		(this->*m_pPatternSetup)(pBltParms, &ulCmd);
	}

#ifdef HW_ROTATE

//#if 0
	DEBUGMSG(GPE_ZONE_INIT, (TEXT("Before Rotate:srcxy=0x%08x, dstxy=0x%08x,wh=0x%08x,cmd=0x%08x.\r\n"),
					srcxy,m_ulDestXY,wh,ulCmd ));
	HW_ROTATE_S2S(&srcxy,&m_ulDestXY,&wh,&ulCmd);
#endif
	DEBUGMSG(GPE_ZONE_INIT, (TEXT("After Rotate:srcxy=0x%08x, dstxy=0x%08x,wh=0x%08x,cmd=0x%08x.\r\n"),
					srcxy,m_ulDestXY,wh,ulCmd ));
	geWAITCMDFIFO( 4 );
	geREG(WIDTH_HEIGHT,		wh);
	geREG(DEST_XY,			m_ulDestXY);
	geREG(SRC_XY,			srcxy);
	SET_GE_DEST_STRIDE(m_ulDestStride);
	geREG(DRAW_CMD,			ulCmd);

	geTERMINATE();
	
#ifndef	HW_ROTATE
//#if 1
	ROTATE_PARAMS_BACK(pBltParms);
#endif
	
	RETURN_S2SBLT;
}
#endif

#endif	//CHECK_s

#ifdef	CHECK_24BPP
SCODE MQGC::S2SBlt24( GPEBltParms *pBltParms )
{
	DEBUGMSG(GPE_ZONE_MQEMUL1,(TEXT("S2sBlt24\r\n")));

	ROTATE_PARAMS(pBltParms);
	
	geINIT( pBltParms->pDst );

	MQGCSurf *pDst = (MQGCSurf *)(pBltParms->pDst);

	ULONG	ulCmd, srcxy, dstxy, wh;
	ulCmd = m_ulRop3 | DO_BITBLT;
	dstxy = pBltParms->prclDst->left;
	wh = pBltParms->prclDst->right - dstxy;
	wh = ((pBltParms->prclDst->bottom - pBltParms->prclDst->top) << 16)
				| ((wh << 1) + wh);
	dstxy = ((pBltParms->prclDst->top << 16) | ((dstxy << 1) + dstxy))
				+ ((MQGCSurf *)(pBltParms->pDst))->m_ulTopLeft;

	// NOTE: MUST USE pBltParms->prclSrc here, or else gdibench 
	// will not work well. (benny 2/1/99)
	srcxy = pBltParms->prclSrc->left;
	srcxy = ((pBltParms->prclSrc->top << 16) | ((srcxy << 1) + srcxy))
				+ ((MQGCSurf *)(pBltParms->pSrc))->m_ulTopLeft;

	if ( !pBltParms->xPositive )
	{
		ULONG	w = (wh & 0x0000FFFFUL) - 1UL;
		dstxy += w;
		srcxy += w;
		ulCmd |= X_DIR;
	}
	if ( !pBltParms->yPositive )
	{
		ULONG	h = (wh & 0xFFFF0000UL) - 0x10000UL;
		dstxy += h;
		srcxy += h;
		ulCmd |= Y_DIR;
	}

	//// Not supported!!!
	//// if ( m_pPatternSetup != NullPatternSetup )
	////	(this->*m_pPatternSetup)( pBltParms, &ulCmd );

	geWAITCMDFIFO( 4 );
	geREG(WIDTH_HEIGHT,		wh);
	geREG(DEST_XY,			dstxy);
	geREG(SRC_XY,			srcxy);
	SET_GE_DEST_STRIDE(m_ulDestStride);
	geREG(DRAW_CMD,			ulCmd);

	geTERMINATE();

	ROTATE_PARAMS_BACK(pBltParms);
	
	RETURN_S2SBLT24;
}
#endif	//CHECK_24BPP

#ifdef	CHECK_32BPP
SCODE MQGC::S2SBlt32( GPEBltParms *pBltParms )
{
	DEBUGMSG(GPE_ZONE_MQEMUL1,(TEXT("S2SBlt32\r\n")));

	ROTATE_PARAMS(pBltParms);
	
	geINIT( pBltParms->pDst );

	ULONG	ulCmd, srcxy, width, height, dstxy, i;
	ulCmd = m_ulRop3 | DO_BITBLT;
	m_ulDestXY = (pBltParms->prclDst->top << 16) | pBltParms->prclDst->left;
	m_ulWidthHeight = ((pBltParms->prclDst->bottom << 16)
							| pBltParms->prclDst->right) - m_ulDestXY;
	m_ulDestXY += ((MQGCSurf *)(pBltParms->pDst))->m_ulTopLeft;

	// NOTE: MUST USE pBltParms->prclSrc here, or else gdibench 
	// will not work well. (benny 2/1/99)
	srcxy = ((pBltParms->prclSrc->top << 16) | pBltParms->prclSrc->left)
			+ ((MQGCSurf *)(pBltParms->pSrc))->m_ulTopLeft;

	if ( !pBltParms->xPositive )
	{
		//X-Negative case
		ULONG	w = (m_ulWidthHeight & 0x0000FFFFUL) - 1UL;
		m_ulDestXY += w;
		srcxy += w;
		ulCmd |= X_DIR;
	}
	if ( !pBltParms->yPositive )
	{
		//Y-Negative case
		ULONG	h = (m_ulWidthHeight & 0xFFFF0000UL) - 0x10000UL;
		m_ulDestXY += h;
		srcxy += h;
		ulCmd |= Y_DIR;
	}

	if ( m_pPatternSetup )
	{
		if ( m_pBrush )
			m_lpPattern = (PULONG)m_pBrush->Buffer();

		// Set Pattern Offset
		m_ulDestXY |=
				((((m_ulDestXY & 0x0FFFUL) - pBltParms->pptlBrush->x)
					& 0x7UL) << 13)
				| (((((m_ulDestXY >> 16) & 0x0FFFUL) - pBltParms->pptlBrush->y)
					& 0x7UL) << 29);

		if ((m_ulWidthHeight >> 16) > 4)
		{
			geWAITCMDFIFO( 1 );
			geREG(SRC_XY,			srcxy);
			width = m_ulWidthHeight & 0xFFFFUL;
			// Start color pattern blt
			for (i = 2; i > 0; i-- )
			{
				dstxy = m_ulDestXY;
				(this->*m_pPatternSetup)( pBltParms, &ulCmd );
				for (height = m_ulWidthHeight & 0xFFFF0000UL; TRUE;
												dstxy += 0x80000UL)
				{
					geWAITCMDFIFO( 3 );
					if (height > 0x40000UL)
						geREG(WIDTH_HEIGHT, (0x40000UL | width));
					else
						geREG(WIDTH_HEIGHT, (height | width));
					// Execute pattern blt
					geREG(DEST_XY, 		dstxy);
					SET_GE_DEST_STRIDE(m_ulDestStride);
					geREG(DRAW_CMD,		ulCmd);
					if (height > 0x80000UL)
						height -= 0x80000UL;
					else
						break;
				}
				m_ulDestXY += 0x40000UL;		
				m_ulWidthHeight -= 0x40000UL;
			}
			geTERMINATE();
			
			ROTATE_PARAMS_BACK(pBltParms);
	
			RETURN_S2SBLT32;
		}
		else
			(this->*m_pPatternSetup)( pBltParms, &ulCmd );
	}
	geWAITCMDFIFO( 4 );
	geREG(WIDTH_HEIGHT,		m_ulWidthHeight);
	geREG(DEST_XY,			m_ulDestXY);
	geREG(SRC_XY,			srcxy);
	SET_GE_DEST_STRIDE(m_ulDestStride);
	geREG(DRAW_CMD,			ulCmd);

	geTERMINATE();
	
	ROTATE_PARAMS_BACK(pBltParms);
	
	RETURN_S2SBLT32;
}
#endif	//CHECK_32BPP

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -