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

📄 mqrfill.blt

📁 WinCE 3.0 BSP, 包含Inter SA1110, Intel_815E, Advantech_PCM9574 等
💻 BLT
字号:
#if defined( CHECK_8BPP ) || defined( CHECK_16BPP ) || defined( CHECK_32BPP )
SCODE MQGC::RFillBlt( GPEBltParms *pBltParms )
{
	ULONG	dstxy, wh;
	ULONG 	cmd;
	
	cmd = ((MONO_PATTERN | MONO_SOLID | DO_BITBLT) | m_ulRop3);
	
	DEBUGMSG(GPE_ZONE_MQEMUL1,(TEXT("RFILLBlt\r\n")));
	
#ifdef	HW_ROTATE	
	dstxy = (pBltParms->prclDst->top << 16) | pBltParms->prclDst->left;
	wh = ((pBltParms->prclDst->bottom << 16) | pBltParms->prclDst->right)
		- dstxy;
	dstxy += ((MQGCSurf *)(pBltParms->pDst))->m_ulTopLeft;
	
	HW_ROTATE_RECTANGLE(&dstxy, &wh ,&cmd );
	
	geINIT( pBltParms->pDst );
#else

#ifndef	FAST_ROTATE

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

	dstxy = (pBltParms->prclDst->top << 16) | pBltParms->prclDst->left;
	wh = ((pBltParms->prclDst->bottom << 16) | pBltParms->prclDst->right)
			- dstxy;
	dstxy += ((MQGCSurf *)(pBltParms->pDst))->m_ulTopLeft;
#else
	ROTATE_RFILLBLT_PARAMS(pBltParms,dstxy,wh);

#ifdef SUPPORT_ROTATE
	if(!m_nRotate)	
#endif
	{
		dstxy = (pBltParms->prclDst->top << 16) | pBltParms->prclDst->left;
		wh = ((pBltParms->prclDst->bottom << 16) | pBltParms->prclDst->right)
			- dstxy;
		dstxy += ((MQGCSurf *)(pBltParms->pDst))->m_ulTopLeft;
	}
	geINIT( pBltParms->pDst );
#endif	// FAST_ROTATE
	
#endif  // HW_ROTATE

	geWAITCMDFIFO( 4 );
	geREG(WIDTH_HEIGHT, wh);
	geREG(DEST_XY, 		dstxy);
	SET_GE_DEST_STRIDE(m_ulDestStride);
	geREG(PAT_FG_COLOR,	pBltParms->solidColor);
	geREG(DRAW_CMD,	cmd);

	geTERMINATE();
	
#ifndef HW_ROTATE
#ifndef	FAST_ROTATE	

	ROTATE_PARAMS_BACK(pBltParms);
	
#endif // FAST_ROTATE
#endif

	RETURN_RFILLBLT;
}
#endif	//CHECK_s


#ifdef	CHECK_24BPP
// To do more complete 24bpp Rectangle Fill, need at least one
// off screen line.  Use the first for-loop in this routine to
// draw that line.  Duplicate it to whatever off-screen lines
// we can get.  Then, using Screen-to-screen and duplicates of
// screen-to-screen operation with off-screen lines we just filled
// as source.
SCODE MQGC::RFillBlt24( GPEBltParms *pBltParms )
{
	
	ULONG	i, dstxy2, dstxy1, dstx, dsty, width, height, width8, height8, 
			drawcmd1, drawcmd2, bltChunk;
	ULONG 	ulColor1, ulColor2;
	LPBYTE	pBuffer;
	
	if ( m_ulRop3 == 0xAAUL )
		return S_OK;

	DEBUGMSG(GPE_ZONE_MQEMUL1,(TEXT("RFILLBlt24--")));

	ROTATE_PARAMS(pBltParms);
	
	geINIT( pBltParms->pDst );
	
	// Initialize Rectangle blt parameters
	dstx = pBltParms->prclDst->left;
	width = pBltParms->prclDst->right - dstx;
	dstx = (dstx << 1) + dstx;
	dsty = pBltParms->prclDst->top;
	height = pBltParms->prclDst->bottom - dsty;
	height8 = height << 16;
	width8 = (width << 1) + width;		//mult 3
	dstxy2 = ((dsty << 16)  | dstx)
			+ ((MQGCSurf *)(pBltParms->pDst))->m_ulTopLeft;
		
#if 0
	#define GPE_ZONE_MQEMUL1  1
	//if ((pBltParms->prclDst->top < 300 && pBltParms->prclDst->bottom > 300) &&
	//   (pBltParms->prclDst->left < 400 && pBltParms->prclDst->right > 400))
	if (1)
	{
		RETAILMSG(GPE_ZONE_MQEMUL1,(TEXT("ROP=%x - %x, w: %x, h: %x, d2: %x\r\n"),
					m_ulRop3,
					pBltParms->solidColor,
					width,
					height,
					((dsty << 16) | dstx)
					));
	}
#endif
	
	if (m_ulRop3 == 0x00UL || m_ulRop3 == 0xFFUL || m_ulRop3 == 0x55UL)
	{
		DEBUGMSG(GPE_ZONE_MQEMUL1,(TEXT("Solid=%x\r\n"),pBltParms->solidColor));
		geWAITCMDFIFO( 3 );
		geREG(WIDTH_HEIGHT,	( height8 | width8 ));
		geREG(DEST_XY, 		dstxy2);
		SET_GE_DEST_STRIDE(m_ulDestStride);
		geREG(DRAW_CMD,		(DO_BITBLT | MONO_PATTERN | MONO_SOLID | m_ulRop3));
	}
	else 
	{
		ulColor1 = pBltParms->solidColor & 0x0000FFFF;
		ulColor2 = (pBltParms->solidColor >> 8)	& 0x0000FFFF;

		if (ulColor1 == ulColor2)
		{
			DEBUGMSG(GPE_ZONE_MQEMUL1,(TEXT("Grey Color\r\n")));
			geWAITCMDFIFO( 4 );
			geREG(PAT_FG_COLOR, ulColor1 & 0xFFUL);
			geREG(WIDTH_HEIGHT,	( height8 | width8));
			geREG(DEST_XY, 		dstxy2);
			SET_GE_DEST_STRIDE(m_ulDestStride);
			geREG(DRAW_CMD,		(DO_BITBLT | MONO_PATTERN | MONO_SOLID | m_ulRop3));
		}
		else if ( width >= 1UL && height8 >= 0x10000UL )
		{
			drawcmd1 = (DO_BITBLT | CLIP_ENABLE | 0xCCUL);
				
			// Determine ROP
			switch (m_ulRop3)
			{
				case 0xF0UL:  // Pattern Blt
					DEBUGMSG(GPE_ZONE_MQEMUL1,(TEXT("PatBlt\r\n")));
				case 0x0FUL:  // Pattern Invert
					dstxy1 = dstxy2;
					drawcmd2 = drawcmd1;
					pBuffer = (LPBYTE)(pBltParms->pDst->Buffer()) +
							dstx + (dsty * pBltParms->pDst->Stride());
			    	break;
				
				default:
					DEBUGMSG(GPE_ZONE_MQEMUL1,(TEXT("Other=")));
					// Do SRCCOPY blt to offscreen first for 1 line width.
					// Then, do screen to screen blt using the transformed
					// ROP2 cmd.
					dstxy1 = m_ulScratchTopLeft;
				#ifdef _CALC_ROP2
					ULONG rop = ((m_ulRop3 & 0xC0UL) >> 4) + (m_ulRop3 & 0x03UL);
					rop = (rop << 4) | rop;
					drawcmd2 = (DO_BITBLT | CLIP_ENABLE | rop);
				#else
					drawcmd2 = (DO_BITBLT | CLIP_ENABLE | ROP2_ENABLE |
							(((m_ulRop3 & 0xC0UL) >> 4) + (m_ulRop3 & 0x03UL)));
				#endif
					
					//@@@@@@@ SET SCRATCH OFF-SCREEN BUFFER POINTER HERE @@@@@
					pBuffer = (LPBYTE)m_pScratchBuffer;
					break;
			}
			switch(m_ulRop3)
			{
				case 0x0FUL:  // Pattern Invert
					DEBUGMSG(GPE_ZONE_MQEMUL1,(TEXT("PatInvert\r\n")));
					for(i=0; i < 3; i++)
						*(pBuffer+i) = (BYTE)~((pBltParms->solidColor >> (i*8)) & 0xFF);
					break;	
				default:
					DEBUGMSG(GPE_ZONE_MQEMUL1,(TEXT("ROP2, c1:%x,c2:%x\r\n"),drawcmd1,drawcmd2));
					for(i=0; i < 3; i++)
						*(pBuffer+i) = (BYTE)((pBltParms->solidColor >> (i*8)) & 0xFF);
					break;	
			}
		
			// Prepare GE Registers
			geWAITCMDFIFO( 3 );
			geREG(SRC_XY,		dstxy1);
			geREG(CLIP_LeftT,   dstxy1);
			geREG(CLIP_RightB,	(dstxy1 + (height8 | width8) - 0x10001UL));

			// SRCCOPY from first 3-byte pixel until one full line is filled
			bltChunk = 3;						//init to 3
			for( i = 3; i < width8; )
			{
				geWAITCMDFIFO( 3 );
				geREG(WIDTH_HEIGHT,	( 0x10000UL | bltChunk ));
				geREG(DEST_XY, 		(dstxy1 + i));
				SET_GE_DEST_STRIDE(m_ulDestStride);
				geREG(DRAW_CMD,		drawcmd1);
				i += bltChunk;
				bltChunk = bltChunk << 1;
			}	
			// Perform second GE cmd
			WaitGENotBusy();
			geWAITCMDFIFO( 2 );
			geREG(CLIP_LeftT,   dstxy2);
			geREG(CLIP_RightB,	(dstxy2 + (height8 | width8) - 0x10001UL));

			// SRCCOPY from first line until last line is filled
			bltChunk = 0x10000UL;				//init to 1
			// Check for Pattern blt
			if (drawcmd1 == drawcmd2)
			{
				for( i = bltChunk; i < height8; )
				{
					geWAITCMDFIFO( 3 );
					geREG(WIDTH_HEIGHT,	( bltChunk | width8 ));
					geREG(DEST_XY, 		(dstxy2 + i));
					SET_GE_DEST_STRIDE(m_ulDestStride);
					geREG(DRAW_CMD,		drawcmd2);
					i += bltChunk;
					bltChunk = bltChunk << 1;
				}
			}
			else  // ROP2 case
			{
				for( i = bltChunk; i < height8; )
				{
					geWAITCMDFIFO( 3 );
					geREG(WIDTH_HEIGHT,	( bltChunk | width8 ));
					geREG(DEST_XY, 		(dstxy2 + i));
					SET_GE_DEST_STRIDE(m_ulDestStride);
					geREG(DRAW_CMD,		drawcmd2);
					i += bltChunk;
				}
			}
		}
	}	
	
	WaitGENotBusy();
	
	geTERMINATE();
	
	ROTATE_PARAMS_BACK(pBltParms);
	
	RETURN_RFILLBLT24;
}
#endif	//CHECK_24BPP

⌨️ 快捷键说明

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