📄 mqcm2s.blt
字号:
pSrcBits = (PBYTE)(m_pSrc->Buffer())
+ (pBltParms->prclSrc->top * lSrcStride)
+ (pBltParms->prclSrc->left << m_ulBPPShift); //src rect offset
switch(m_nRotate)
{
case R_0:
ulOffset = (ULONG)pSrcBits & 0x03UL; //leading byte offset
pSrcBits -= ulOffset;
ulSrcBytes = width << m_ulBPPShift; //get exact bytes count
ulByteSpace = ((4UL - ((ulSrcBytes + ulOffset) & 0x03UL)) & 0x03UL) + ulOffset;
ulDWords = (ulSrcBytes + ulByteSpace) >> 2; //num of 16 bytes (128 bits)
ulDWordsTotal = ulDWords * height;
ulExtras = (4UL - (ulDWordsTotal & 0x03UL)) & 0x03UL;
//last 128-bit byte(s) pad
break;
case R_180:
ulSrcBytes = width << m_ulBPPShift; //get exact bytes count
ulByteSpace = (ULONG)pSrcBits & 0x03UL;
ulOffset = (2UL - ((ULONG)pSrcBits+ulSrcBytes-2) & 0x03UL);
ulByteSpace += ulOffset;
pSrcBits = (PBYTE)(((ULONG)(pSrcBits+ulSrcBytes-2)>>2)<<2); // reajust the pSrcBits to end of double word.
ulDWords = (ulSrcBytes + ulByteSpace) >> 2; //num of 16 bytes (128 bits)
ulDWordsTotal = ulDWords * height;
ulExtras = (4UL - (ulDWordsTotal & 0x03UL)) & 0x03UL;
//last 128-bit byte(s) pad
ulCmd |= Y_DIR;
break;
case R_90:
ulOffset = 0L;
ulByteSpace = (height&0x01UL)<<1L;
pSrcBits += (height -1)*lSrcStride;
ulExtras = (4L - (((height + 1L)>>1)*width)& 3L )& 3L;
PixelInc = -(lSrcStride>>1); //Words Count
LineInc = 2L; // BYTE Count
ulTmp = height;
height = width;
width = ulTmp;
ulDWordsTotal = (height * ((width + 0x01UL)>>1))+ulExtras;\
break;
case R_270:
ulOffset = 0L;
ulByteSpace = (height&0x01UL)<<1L;
ulExtras = (4L - (((height + 1L)>>1)*width)& 3L )& 3L;
PixelInc = (lSrcStride>>1); //Words Count
LineInc = 2L; // BYTE Count
ulTmp = height;
height = width;
width = ulTmp;
ulDWordsTotal = (height * ((width + 0x01UL)>>1))+ulExtras;\
ulCmd |= Y_DIR;
break;
}
ulOffset = (ulOffset << 3) | (ulByteSpace << 28);
if ( m_pPatternSetup != NullPatternSetup )
{
if ( m_pBrush )
m_lpPattern = (PULONG)m_pBrush->Buffer();
(this->*m_pPatternSetup)( pBltParms, &ulCmd );
}
#ifdef CM2SBLT_TRANSPARENT
if ( pBltParms->bltFlags & BLT_TRANSPARENT )
{
ulCmd |= TRANS_COLOR;
geWAITCMDFIFO( 1 );
geREG(COLOR_COMPARE, pBltParms->solidColor);
}
#endif //CM2SBLT_TRANSPARENT
geWAITCMDFIFO( 4 );
geWAITSRCFIFO1(ulDWordsTotal);
geREG(WIDTH_HEIGHT, ((height << 16) | width));
geREG(DEST_XY, m_ulDestXY);
geREG(SRC_STRIDE_OFFSET, ulOffset);
SET_GE_DEST_STRIDE(m_ulDestStride);
geREG(DRAW_CMD, ulCmd);
if ( pBltParms->pLookup )
{
if(m_nRotate == R_0)
{
PUMP_PACKED_SRCFIFO_LOOKUP16BPP(pSrcBits, ulDWords, ulExtras,
ulDWordsTotal, lSrcStride, height, (pBltParms->pLookup))
}else{
if(m_nRotate == R_180)
{
PUMP_PACKED_SRCFIFO_LOOKUP16BPP180(pSrcBits, ulDWords, ulExtras,
ulDWordsTotal, lSrcStride, height, (pBltParms->pLookup))
}else{
PUMP_PACKED_SRCFIFO_LOOKUP16BPP90_270(pSrcBits, width, height,
LineInc, PixelInc, ulExtras, (pBltParms->pLookup) )
}
}
}
else
{
if(m_nRotate == R_0)
{
PUMP_PACKED_SRCFIFO(pSrcBits, ulDWords, ulExtras, ulDWordsTotal,
lSrcStride, height)
}else{
if(m_nRotate == R_180)
{
PUMP_PACKED_SRCFIFO16BPP180(pSrcBits, ulDWords, ulExtras,
ulDWordsTotal, lSrcStride, height)
}else{ // R_90 or R_270
PUMP_PACKED_SRCFIFO16BPP90_270(pSrcBits, width, height, LineInc,
PixelInc,ulExtras)
}
}
}
geTERMINATE();
RETURN_CM2SBLT16;
}
#endif //SUPPORT_ROTATE
#endif //CHECK_16BPP
#ifdef CHECK_24BPP
SCODE MQGC::CM2SBlt24( GPEBltParms *pBltParms )
{
// RETAILMSG(1, (TEXT("CM2SBLT24: ***************\r\n"),
DEBUGMSG(GPE_ZONE_MQEMUL1,(TEXT("CM2SBlt24\r\n")));
ROTATE_PARAMS(pBltParms);
geINIT( pBltParms->pDst );
PBYTE pSrcBits;
ULONG dstxy, width, height;
ULONG ulCmd, ulOffset, ulDWords, ulExtras, ulByteSpace;
#ifndef BEN_OPTIMIZED
ULONG ulSrcStride;
#endif
ULONG ulDWordsTotal;
long lSrcStride;
ulCmd = m_ulRop3 | DO_BITBLT | SRC_IS_MEMORY | PACKED_MODE;
dstxy = (pBltParms->prclDst->top << 16) + pBltParms->prclDst->left
+ ((MQGCSurf *)(pBltParms->pDst))->m_ulTopLeft;
width = pBltParms->prclDst->right - pBltParms->prclDst->left;
width += (width << 1); // mult by 3
height = pBltParms->prclDst->bottom - pBltParms->prclDst->top;
lSrcStride = m_pSrc->Stride();
pSrcBits = (PBYTE)(m_pSrc->Buffer())
+ (pBltParms->prclSrc->top * lSrcStride)
+ pBltParms->prclSrc->left;
//source rectangle offset from base
ulOffset = (ULONG)pSrcBits & 0x03UL; //leading byte offset
pSrcBits -= ulOffset; //calc starting source bit
#ifdef BEN_OPTIMIZED // BENTEST
ulByteSpace = ((0x04UL - ((width + ulOffset) & 0x03UL)) & 0x03UL) + ulOffset;
ulDWords = (width + ulByteSpace) >> 2; //num of 16 bytes (128 bits)
ulDWordsTotal = ulDWords * height;
#else
ulSrcStride = abs( lSrcStride );
ulDWords = (width + ulOffset + 3UL) >> 2; //num of DWORDs per rect width
ulByteSpace = ((ulSrcStride - (pBltParms->prclSrc->left + width)) & 0x03UL)
+ ulOffset;
ulDWordsTotal = (ulOffset + ((width + ulByteSpace) * (height - 1))
+ width + 3UL) >> 2; //total DWORDS to pump
#endif
ulExtras = (4UL - (ulDWordsTotal & 0x03UL)) & 0x03UL;
//last 128-bit byte(s) pad
ulOffset = (ulOffset << 3) | (ulByteSpace << 28);
//source offset + bytespace
// >>> Not Supported
// if ( m_pPatternSetup != NullPatternSetup )
// {
// m_lpPattern = (PULONG)m_pBrush->Buffer();
// (this->*m_pPatternSetup)( pBltParms, &ulCmd );
// }
#ifdef CM2SBLT_TRANSPARENT
if ( pBltParms->bltFlags & BLT_TRANSPARENT )
{
ulCmd |= TRANS_COLOR;
geWAITCMDFIFO( 1 );
geREG(COLOR_COMPARE, pBltParms->solidColor);
}
#endif
geWAITCMDFIFO( 4 );
geREG(WIDTH_HEIGHT, ((height << 16) | width));
geREG(DEST_XY, dstxy);
geREG(SRC_STRIDE_OFFSET, ulOffset);
SET_GE_DEST_STRIDE(m_ulDestStride);
geREG(DRAW_CMD, ulCmd);
if ( pBltParms->pLookup )
{
PUMP_PACKED_SRCFIFO_LOOKUP8BPP(pSrcBits, ulDWords, ulExtras,
ulDWordsTotal, lSrcStride, height, (pBltParms->pLookup))
}
else
{
PUMP_PACKED_SRCFIFO(pSrcBits, ulDWords, ulExtras, ulDWordsTotal,
lSrcStride, height)
}
geTERMINATE();
ROTATE_PARAMS_BACK(pBltParms);
RETURN_CM2SBLT24;
}
#endif //CHECK_24BPP
#ifdef CHECK_32BPP
SCODE MQGC::CM2SBlt32( GPEBltParms *pBltParms )
{
// RETAILMSG(1, (TEXT("CM2SBLT32: ***************\r\n"),
DEBUGMSG(GPE_ZONE_MQEMUL1,(TEXT("CM2SBlt32\r\n")));
PBYTE pSrcBits;
ULONG width, height;
ULONG ulCmd, ulOffset, ulSrcBytes, ulDWords, ulExtras, ulByteSpace;
#ifndef BEN_OPTIMIZED
ULONG ulSrcLeftBytes;
ULONG ulSrcStride;
#endif
ULONG ulDWordsTotal;
long lSrcStride;
ROTATE_PARAMS(pBltParms);
ulCmd = m_ulRop3 | DO_BITBLT | SRC_IS_MEMORY | PACKED_MODE;
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();
#ifndef BEN_OPTIMIZED
ulSrcLeftBytes = pBltParms->prclSrc->left << m_ulBPPShift;
//get exact bytes count from left
pSrcBits = (PBYTE)(m_pSrc->Buffer())
+ (pBltParms->prclSrc->top * lSrcStride)
+ ulSrcLeftBytes; //source rectangle offset from base
#else
pSrcBits = (PBYTE)(m_pSrc->Buffer())
+ (pBltParms->prclSrc->top * lSrcStride)
+ (pBltParms->prclSrc->left << m_ulBPPShift); //src rect offset
#endif
ulOffset = (ULONG)pSrcBits & 0x03UL; //leading byte offset
pSrcBits -= ulOffset;
ulSrcBytes = width << m_ulBPPShift; //get exact width bytes cnt
#ifdef BEN_OPTIMIZED // BENTEST
ulByteSpace = ((0x04UL - ((ulSrcBytes + ulOffset) & 0x03UL)) & 0x03UL)
+ ulOffset;
ulDWords = (ulSrcBytes + ulByteSpace) >> 2; //num of 16 bytes (128 bits)
ulDWordsTotal = ulDWords * height;
#else
ulSrcStride = abs( lSrcStride );
ulDWords = (ulSrcBytes + ulOffset + 0x03UL) >> 2; //num of 16 bytes (128 bits)
ulByteSpace = ((ulSrcStride - (ulSrcLeftBytes + ulSrcBytes))
& 0x03UL) + ulOffset;
ulDWordsTotal = (ulOffset + ((ulSrcBytes + ulByteSpace) * (height - 1))
+ ulSrcBytes + 3UL) >> 2; //total 16 bytes to pump
#endif
ulOffset = (ulOffset << 3) | (ulByteSpace << 28);
#ifdef CM2SBLT_TRANSPARENT
if ( pBltParms->bltFlags & BLT_TRANSPARENT )
{
ulCmd |= TRANS_COLOR;
geWAITCMDFIFO( 1 );
geREG(COLOR_COMPARE, pBltParms->solidColor);
}
#endif
if ( m_pPatternSetup != NullPatternSetup )
{
PBYTE pSB;
ULONG dstxy,i,j,hloop,ulExt;
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 (height > 0x4UL)
{
// Calculate total DWORDS and Extras DWORDs to pump for
// FOUR LINES ONLY
#ifdef BEN_OPTIMIZED // BENTEST
ulDWordsTotal = ulDWords * 3;
#else
ulDWordsTotal = (ulOffset + ((ulSrcBytes + ulByteSpace) * 3)
+ ulSrcBytes + 3UL) >> 2; //total 16 bytes to pump
#endif
ulExtras = (4UL - (ulDWordsTotal & 0x03UL)) & 0x03UL;
geWAITCMDFIFO( 1 );
geREG(SRC_STRIDE_OFFSET, ulOffset);
// Start loading color pattern 4 lines at a time
for (i = 2; i > 0; i-- )
{
pSB = 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 BEN_OPTIMIZED // BENTEST
ulDWordsTotal = ulDWords * hloop;
#else
ulDWordsTotal = (ulOffset + ((ulSrcBytes + ulByteSpace)
* (hloop-1)) + ulSrcBytes + 3UL) >> 2;
#endif
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 ( pBltParms->pLookup && !m_ulBPPShift )
{
// Use 8BPP lookup table
PUMP_PACKED_SRCFIFO_LOOKUP32BPP(pSB, ulDWords, ulExt,
ulDWordsTotal, lSrcStride, hloop,
(pBltParms->pLookup))
}
else
{
PUMP_PACKED_SRCFIFO(pSB, ulDWords, ulExt,
ulDWordsTotal, lSrcStride, hloop)
}
j += 0x08UL;
pSB += (0x04UL * lSrcStride);
}
m_ulDestXY += 0x40000UL;
pSrcBits += (0x04UL * lSrcStride);
}
geTERMINATE();
ROTATE_PARAMS_BACK(pBltParms);
RETURN_CM2SBLT32;
}
else
(this->*m_pPatternSetup)( pBltParms, &ulCmd );
}
// Calculate total DWORDS and Extras DWORDs to pump all SRC data at once
#ifdef BEN_OPTIMIZED // BENTEST
ulDWordsTotal = ulDWords * height;
#else
ulDWordsTotal = (ulOffset + ((ulSrcBytes + ulByteSpace) * (height - 1))
+ ulSrcBytes + 3UL) >> 2; //total 16 bytes to pump
#endif
ulExtras = (4UL - (ulDWordsTotal & 0x03UL)) & 0x03UL;
//last 128-bit byte(s) pad
geWAITCMDFIFO( 4 );
geREG(WIDTH_HEIGHT, ((height << 16) | width));
geREG(DEST_XY, m_ulDestXY);
geREG(SRC_STRIDE_OFFSET, ulOffset);
SET_GE_DEST_STRIDE(m_ulDestStride);
geREG(DRAW_CMD, ulCmd);
if ( pBltParms->pLookup )
{
// Use lookup table
PUMP_PACKED_SRCFIFO_LOOKUP32BPP(pSrcBits, ulDWords, ulExtras,
ulDWordsTotal, lSrcStride, height, (pBltParms->pLookup))
}
else
{
PUMP_PACKED_SRCFIFO(pSrcBits, ulDWords, ulExtras, ulDWordsTotal,
lSrcStride, height)
}
geTERMINATE();
ROTATE_PARAMS_BACK(pBltParms);
RETURN_CM2SBLT32;
}
#endif //CHECK_32BPP
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -