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

📄 blt.cpp

📁 WinCE 3.0 BSP, 包含Inter SA1110, Intel_815E, Advantech_PCM9574 等
💻 CPP
字号:
#include "precomp.h"

#include "mqrfill.blt"
#include "mqpat.blt"
#include "mqmpat.blt"
#include "mqcpat.blt"
#include "mqs2s.blt"
#include "mqmm2s.blt"
#include "mqcm2s.blt"
#include "mqcm2slk.blt"
#include "mqaafont.blt"
#include "mqxptext.blt"
#include "mqutils.blt"

SCODE MQGC::BltPrepare(
	GPEBltParms *pBltParms )
{
	// default to base EmulatedBlt routine
//	pBltParms->pBlt = EmulatedBlt;
//
//	return	S_OK;

	DEBUGMSG(GPE_ZONE_BLT_LO,(TEXT("MQ200DRV::BltPrepare rop4: 0x%04x\r\n"),
								pBltParms->rop4 ));
	DEBUGMSG(GPE_ZONE_BLT_LO,(TEXT("Dest Format: %d, "),
								(int)pBltParms->pDst->Format() ));
	DEBUGMSG(GPE_ZONE_BLT_LO,(TEXT("Dest Rect: t:%d,l:%d,b:%d,r:%d "),
								pBltParms->prclDst->top,
								pBltParms->prclDst->left,
								pBltParms->prclDst->bottom,
								pBltParms->prclDst->right ));
	DEBUGMSG(GPE_ZONE_BLT_LO,(TEXT("Dest GPESurf 0x%08x\r\n"),
								pBltParms->pDst ));
#ifdef DDIDBG
	if( pBltParms->prclSrc && pBltParms->pSrc )
	{
		DEBUGMSG(GPE_ZONE_BLT_LO,(TEXT("Src format: %d, "),
								(int)pBltParms->pSrc->Format() ));
		DEBUGMSG(GPE_ZONE_BLT_LO,(TEXT("Src Rect: %d,%d,%d,%d "),
								pBltParms->prclSrc->top,
								pBltParms->prclSrc->left,
								pBltParms->prclSrc->bottom,
								pBltParms->prclSrc->right ));
		DEBUGMSG(GPE_ZONE_BLT_LO,(TEXT("Src GPESurf 0x%08x\r\n"),
								pBltParms->pSrc ));
	}
#endif
	DEBUGMSG(GPE_ZONE_BLT_LO,(TEXT("Blt preparation phase\r\n")));
	DEBUGWAIT(GPE_ZONE_BLT_LO)

	pBltParms->pBlt = EmulatedBlt;

	if ( m_ulBPP < 8 )
		return S_OK;
	if ( !pBltParms->pDst->InVideoMemory() )
	{
		if ( pBltParms->pSrc && pBltParms->pSrc->InVideoMemory() )
			geWAITNOTBUSY;			//if src involve disp mem, serialize it
		return S_OK;
	}

	m_ulRop3 = pBltParms->rop4 & 0xFF;
	if ( m_ulRop3 != (ULONG)(pBltParms->rop4 >> 8) )
	{
		if ( pBltParms->rop4 == 0xAAF0 )
		{
			m_eFormat = pBltParms->pMask->Format();

			//Check if Mono Transparent Text or Anti-Aliased Font Text
			if ( m_eFormat == gpe1Bpp )
			{
				pBltParms->pBlt = MQFUNC( XPTextBlt );
			}
	#ifdef	AAFONT_ON
			else
		#ifdef CHECK_24BPP
			if ( m_ulBPPSelect != CDEPTH_24BPP )
		#endif	//CHECK_24BPP
			{
				//It's assume that for 8bpp, AAFont will not be called.
				//pBltParms->pBlt = MQFUNC( AAFontBlt );
				//RETAILMSG(1,(TEXT("AAFontBlt:\r\n")));
				pBltParms->pBlt = (SCODE (GPE::*)(GPEBltParms *))AAFontBlt;
			}
	#endif	//AAFONT_ON
		}
	}
	else
	{
		m_pBrush = pBltParms->pBrush;
		m_pSrc = (MQGCSurf *)(pBltParms->pSrc);
		if ( m_pSrc == NULL )
		{
			//NO SOURCE Operand operations handling
			if ( m_pBrush == NULL )
			{
				//RETAILMSG(1,(TEXT("RFillBlt:\r\n")));
				pBltParms->pBlt = MQFUNC( RFillBlt );
			}
			else
			{
				if ( m_pBrush->Width() == 0x0008
						&& m_pBrush->Height() == 0x0008 )
				{
					m_eFormat = m_pBrush->Format();
					if ( m_eFormat == pBltParms->pDst->Format() )
					{
						//RETAILMSG(1,(TEXT("CPATBlt:\r\n")));
//						m_pPatternSetup = PATSETUP_IDX( m_eFormat );
//						pBltParms->pBlt = MQFUNC( CPATBlt );
					}
			#ifdef MPATBLT_ON
					else if ( m_eFormat == gpe1Bpp )
					{
//						m_pPatternSetup =
//								(void (MQGC::*)(GPEBltParms *, ULONG *))
//								PatternSetup1BPP;
//						pBltParms->pBlt = MQFUNC( MPATBlt );
					//	RETAILMSG(1,(TEXT("MPATBlt:\r\n")));
					}
			#endif	//MPATBLT_ON
				}
				//else if ( ((m_pBrush->Height() << 16) | m_pBrush->Width())
				//				 == pBltParms->pDst->m_ulHeightWidth )
				//{
				//	//Switch the Rop code from Pat/Dst to Src/Dst
				//	//iff width/height equals dst width/height
				//	m_ulRop3 = xxxx;
				//}
			}
		}
		else if ( !(pBltParms->bltFlags & BLT_STRETCH)
					&& !(pBltParms->pConvert)	//If has Convert, don't do it
				)
		{
			//HAS SOURCE Operand operations handling

			m_pPatternSetup = NullPatternSetup;
			if ( (((m_ulRop3 >> 4) ^ m_ulRop3) & 0x0FUL)
		#ifdef CHECK_24BPP
				&& ( 24UL != m_ulBPP )			//exclude all rops involve
												//pattern for 24bpp
		#endif	//CHECK_24BPP
			)
			{
				if ( (m_ulSolidColor = pBltParms->solidColor) != (ULONG)-1L )
					m_pPatternSetup = (void (MQGC::*)(GPEBltParms *, ULONG *))
												PatternSetupSolid;
				else if ( m_pBrush
					#ifdef CHECK_32BPP
						 && 32UL != m_ulBPP
					#endif	//CHECK_32BPP
						)
				{
					if ( m_pBrush->Width() == 0x0008
						 && m_pBrush->Height() == 0x0008 )
					{
						EGPEFormat	eBrushFormat = m_pBrush->Format();
						if ( eBrushFormat == pBltParms->pDst->Format() )
							m_pPatternSetup = PATSETUP_IDX( eBrushFormat );
				#ifdef MPATBLT_ON
						else if ( eBrushFormat == gpe1Bpp )
							m_pPatternSetup =
								(void (MQGC::*)(GPEBltParms *, ULONG *))
								PatternSetup1BPP;
				#endif	//MPATBLT_ON
					}
				}
			}

			if ( !m_pBrush || m_pPatternSetup != NullPatternSetup )
			{
				if ( m_pSrc->InVideoMemory() )
				{
					//RETAILMSG(1,(TEXT("S2SBlt:\r\n")));
					pBltParms->pBlt = MQFUNC( S2SBlt );
				}
				else
				{
					m_eFormat = m_pSrc->Format();
					if ( m_eFormat == pBltParms->pDst->Format() )
					{
						//RETAILMSG(1,(TEXT("CM2SBlt:\r\n")));
						pBltParms->pBlt = MQFUNC2( CM2SBlt );
					}
					else if ( m_eFormat == gpe8Bpp || m_eFormat == gpe4Bpp )
					//else if ( m_eFormat == gpe8Bpp )
					{
						//RETAILMSG(1,(TEXT("CM2SLKBlt:\r\n")));
						pBltParms->pBlt = MQFUNC2( CM2SLKBlt );
					}
					else if ( m_eFormat == gpe1Bpp )
					{
						//RETAILMSG(1,(TEXT("MM2SBlt:\r\n")));
						pBltParms->pBlt = MQFUNC( MM2SBlt );
					}
				}
			}
		}
	}
	if ( pBltParms->pBlt == EmulatedBlt )
	{
		// see if there are any optimized software blits available
		EmulatedBltSelect02(pBltParms);
		EmulatedBltSelect08(pBltParms);
		EmulatedBltSelect16(pBltParms);

		geWAITNOTBUSY;		//Catch all op not involving GE but display memory
	}

	return S_OK;
}

// This function would be used to undo the setting of clip registers etc
SCODE MQGC::BltComplete( GPEBltParms *pBltParms )
{
	ROTATE_PARAMS_BACK(pBltParms);

	return S_OK;
}

⌨️ 快捷键说明

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