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

📄 mqmm2s.blt

📁 WinCE 3.0 BSP, 包含Inter SA1110, Intel_815E, Advantech_PCM9574 等
💻 BLT
📖 第 1 页 / 共 2 页
字号:
			else
				lDWords = (lOffset + width + 31) >> 5;
			lExtras += lDWords;
	#ifdef CHECK_SRCFIFO
			lExtras2 = lDWords & 0x1fL;
			lDWords = lDWords >> 5;				//number of 32 dwords
			while( lDWords-- )
			{
				i = 32;
				geWAITSRCFIFO( 32 );
				while( i-- )
					geSID( (*pulSrc++) );
			}
			if ( lExtras2 )
			{
				geWAITSRCFIFO( lExtras2 );
				while( lExtras2-- )
					geSID( (*pulSrc++) );
			}
	#else	//CHECK_SRCFIFO
			while( lDWords-- )
				geSID( (*pulSrc++) );
	#endif	//CHECK_SRCFIFO

			lOffset += lSrcStride;				//Advance bit offset
			pulSrc = (PULONG)(lSpace + ((lOffset & ~0x1F) >> 3));
												//lSpace has prev pulSrc
			lOffset &= 0x1FL;					//only keep 32bit offset
		}

		//No need to wait for srcfifo here since any previous call to
		//wait-for-srcfifo actually waits for 128bit aligned number of slots
		lExtras = -lExtras & 0x03L;
		while( lExtras-- )
			geSID( 0UL );							//Padded to total of 128bit
													//aligned
		//PUMP_PACKED_SRCFIFO(pulSrc, ulDWords, lExtras, ulDWordsTotal,
		//		lSrcStride, height)
	}

	geTERMINATE();

	ROTATE_PARAMS_BACK(pBltParms);

	RETURN_MM2SBLT;
}
#endif	//CHECK_s

#if 0
SCODE MQGC::MM2SBlt24( GPEBltParms *pBltParms )
{
	DEBUGMSG(GPE_ZONE_MQEMUL1,(TEXT("MM2SBlt24-E\r\n")));
	RETURN_MM2SBLT24;
}
#endif

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

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

	PBYTE	pSrcBits;
	PULONG	pulSrc;
	ULONG	width, height;
	ULONG	ulCmd, ulOffset, ulDWordsTotal, ulExtras, ulBitSpace, ulSrcStride;
	ULONG	ulDWords;
	long	lSrcStride;
	BOOL	bReallyPacked;

	m_ulDestXY = (pBltParms->prclDst->top << 16) + pBltParms->prclDst->left
				+ ((MQGCSurf *)(pBltParms->pDst))->m_ulTopLeft;
	width = pBltParms->prclDst->right - pBltParms->prclDst->left;
	height = pBltParms->prclDst->bottom - pBltParms->prclDst->top;
	//lSrcStride = m_pSrc->Stride();
	lSrcStride = pBltParms->pSrc->Stride();
	ulSrcStride = abs( lSrcStride );

	//pSrcBits = (PBYTE)(m_pSrc->Buffer())
	pSrcBits = (PBYTE)(pBltParms->pSrc->Buffer())
				+ (pBltParms->prclSrc->top * lSrcStride);
	ulOffset = (((ULONG)pSrcBits & 0x03UL) << 3) + pBltParms->prclSrc->left;
	pSrcBits = (PBYTE)((((ULONG)pSrcBits & ~0x03UL)
				+ (ulOffset >> 3)) & ~0x03UL);  // aligned to dword
	ulOffset &= 0x01FUL;

	//Compute bit space.
	if (ulSrcStride & 0x03UL)
		ulBitSpace = ((ulSrcStride << 3) - width) & 0x3FUL;
	else
		ulBitSpace = (((ulSrcStride << 3)
					- (pBltParms->prclSrc->left + width)) & 0x1FUL)
					+ (pBltParms->prclSrc->left & 0x1FUL);

	bReallyPacked = (lSrcStride > 0) &&
			(((width + ulBitSpace + 31UL) & ~0x1FUL) >= (ulSrcStride << 3)); 

	m_pLookup = pBltParms->pLookup;
	ulCmd = m_ulRop3 | DO_BITBLT | MONO_SRC | SRC_IS_MEMORY | PACKED_MODE;

#ifdef	MM2SBLT_TRANSPARENT
	if ( pBltParms->bltFlags & BLT_TRANSPARENT )
	{
	#ifdef _USE_MQEMUL	//emulation is not doing a good job on trans_mono.
						//bg_color is required
		geWAITCMDFIFO( 1 );
		geREG(BG_COLOR,				~(*(m_pLookup+1)));
	#endif
		ulCmd |= TRANS_MONO;
	}
	else
#endif	//MM2SBLT_TRANSPRENT
	{
		geWAITCMDFIFO( 1 );
		geREG(BG_COLOR,				*m_pLookup);
	}

	if ( m_pPatternSetup != NullPatternSetup )
	{
		ULONG dstxy,i,j,hloop,ulExt;
		if ( m_pBrush )
			m_lpPattern = (PULONG)m_pBrush->Buffer();

		if (height > 0x4UL)
		{
			// Calculate total DWORDS and Extras DWORDs to pump for
			// FOUR LINES ONLY
			if ( bReallyPacked ) 
			{
				//Src data packed.  Calculate total and extra dwords first.
				ulDWordsTotal = (((width + ulBitSpace) * 3) + width
								+ ulOffset + 31UL) >> 5;
			}
			else
			{
				//Need to skip dwords.  Offset should be consistent across
				//each line
				ulDWords = (width + ulOffset + 31UL) >> 5;
				ulDWordsTotal = (ulOffset + ((width + ulBitSpace) * 3)
										+ width + 31UL) >> 5;
			}
			ulExtras = (4UL - (ulDWordsTotal & 0x03UL)) & 0x03UL; 
			ulOffset |= (ulBitSpace << 25); 		//Or bit offset with
													//bit space

			geWAITCMDFIFO( 2 );
			geREG(FG_COLOR,				*(m_pLookup+1));
			geREG(SRC_STRIDE_OFFSET,	ulOffset);
			//Start loading color pattern 4 lines at a time
			for (i = 2; i > 0; i-- )
			{
				pulSrc = (PULONG)pSrcBits;
				dstxy = m_ulDestXY;
				(this->*m_pPatternSetup)( pBltParms, &ulCmd );
				//Execute ROP3 command 4 lines at a time
				for (j = 0; j < height; dstxy += 0x80000UL)
				{
					if ((height-j) < 0x04UL)
					{
						// Calculate total DWORDS and Extras DWORDs to pump
						// for remainder number of lines.
						hloop = height - j;
						if ( bReallyPacked )
						{
							//Src data packed.  Calculate total and extra
							//dwords first.
							ulDWordsTotal = (((width + ulBitSpace) * (hloop-1))
											+ width + ulOffset + 31UL) >> 5;
						}
						else
						{
							//Need to skip dwords.  Offset should be
							//consistent across each line
							ulDWords = (width + ulOffset + 31UL) >> 5;
							ulDWordsTotal = (ulOffset + ((width + ulBitSpace) 
										 * (hloop-1)) + width + 31UL) >> 5;
						}
						ulExt = (4UL - (ulDWordsTotal & 0x03UL)) & 0x03UL; 
					}
					else
					{
						hloop = 0x04UL;
						ulExt = ulExtras;
					}
					// Execute pattern blt
					geWAITCMDFIFO( 3 );
					geREG(WIDTH_HEIGHT,  ((hloop << 16) | width));
					geREG(DEST_XY, 		dstxy);
					SET_GE_DEST_STRIDE(m_ulDestStride);
					geREG(DRAW_CMD,		ulCmd);

					// Pump SRC FIFO with pattern
					if ( bReallyPacked )
					{
						PUMP_REALLY_PACKED_SRCFIFO(pulSrc, ulDWordsTotal, ulExt)
					}
					else
					{
						PUMP_PACKED_SRCFIFO(pulSrc, ulDWords, ulExt,
									ulDWordsTotal, lSrcStride, height)
					}
					j += 0x08UL;
					pulSrc += (0x04UL * lSrcStride);
				}
				m_ulDestXY += 0x40000UL;		
				pSrcBits += (0x04UL * lSrcStride);
			}
			geTERMINATE();
				
			ROTATE_PARAMS_BACK(pBltParms);
				
			RETURN_CM2SBLT32;
		}
		else
			(this->*m_pPatternSetup)( pBltParms, &ulCmd );
	}
	if ( bReallyPacked )
	{
		//Src data packed.  Calculate total and extra dwords first.
		ulDWordsTotal = (((width + ulBitSpace) * (height - 1)) + width
							+ ulOffset + 31UL) >> 5;
		pulSrc = (PULONG)pSrcBits;
	}
	else
	{
		//Need to skip dwords.  Offset should be consistent across each line
		ulDWords = (width + ulOffset + 31UL) >> 5;
		ulDWordsTotal = (ulOffset + ((width + ulBitSpace) * (height - 1))
							+ width + 31UL) >> 5;
	}
	ulExtras = (4UL - (ulDWordsTotal & 0x3UL)) & 0x3UL;
	ulOffset |= (ulBitSpace << 25); 		//Or bit offset with bit space

	geWAITCMDFIFO( 5 );
	geREG(WIDTH_HEIGHT,			((height << 16) | width));
	geREG(DEST_XY,					m_ulDestXY);
	geREG(FG_COLOR,				*(m_pLookup+1));
	geREG(SRC_STRIDE_OFFSET,	ulOffset);
	SET_GE_DEST_STRIDE(m_ulDestStride);
	geREG(DRAW_CMD,				ulCmd);

	if ( bReallyPacked )
	{
		PUMP_REALLY_PACKED_SRCFIFO(pulSrc, ulDWordsTotal, ulExtras)
	}
	else
	{
		PUMP_PACKED_SRCFIFO(pSrcBits, ulDWords, ulExtras, ulDWordsTotal,
				lSrcStride, height)
	}

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

⌨️ 快捷键说明

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