📄 blt.cpp
字号:
else
{
m_oG2D->SetRopEtype(ROP_SRC_ONLY);
}
m_oG2D->FillRect((WORD)prcDst->left, (WORD)prcDst->top, (WORD)prcDst->right, (WORD)prcDst->bottom, pBltParms->solidColor); // (LONG) -> (WORD)
return S_OK;
}
SCODE S3C6400Disp::AcceleratedDestInvert(GPEBltParms *pBltParms)
{
int dstX = pBltParms->prclDst->left;
int dstY = pBltParms->prclDst->top;
int width = pBltParms->prclDst->right - pBltParms->prclDst->left;
int height = pBltParms->prclDst->bottom - pBltParms->prclDst->top;
// printf("DestInvert need to implement");
return S_OK;
}
// From Frame Buffer to Frame Buffer Directly
// Constraints
// Source Surface's width is same with Destination Surface's width.
// Source and Dest must be in Video FrameBuffer Region
SCODE
S3C6400Disp::AcceleratedSrcCopyBlt (GPEBltParms *pBltParms)
{
CSPACE ColorMode;
#if G2D_PROFILE
RopProfiler *ropProfiler;
ropProfiler = RopProfiler::Instance();
ropProfiler->Log(true, pBltParms->rop4);
#endif
// Set Destination Offset In Video Memory, this point is Dest lefttop point
//
//
if ( pBltParms->pSrc->Format() == gpe16Bpp)
{
ColorMode = RGB16;
}
else if( pBltParms->pSrc->Format() == gpe24Bpp)
{
ColorMode = RGB24;
}
else
{
ColorMode = RGB16;
}
m_oG2D->InitSetting(
m_VideoMemoryPhysicalBase + (( S3C6400Surf *)(pBltParms->pDst))->OffsetInVideoMemory(),
ColorMode,
m_nScreenWidth, m_nScreenHeight,
0, 0,
m_nScreenWidth, m_nScreenHeight
);
m_oG2D->SetAlphaMode(G2D_NO_ALPHA_MODE);
m_oG2D->SetAlphaValue(0xcf);
m_oG2D->Set3rdOperand(G2D_OPERAND3_PAT);
if (pBltParms->bltFlags & BLT_TRANSPARENT)
{
m_oG2D->SetTransparentMode(1, pBltParms->solidColor); // turn on transparency & set comparison color
}
switch (pBltParms->rop4)
{
case 0x6666: // SRCINVERT
RETAILMSG (G2D_MSG, (TEXT("SRCINVERT\r\n")));
m_oG2D->SetRopEtype(ROP_SRC_XOR_DST);
break;
case 0x8888: // SRCAND
RETAILMSG (G2D_MSG, (TEXT("SRCAND\r\n")));
m_oG2D->SetRopEtype(ROP_SRC_AND_DST);
break;
case 0xCCCC: // SRCCOPY
RETAILMSG (G2D_MSG, (TEXT("SRCCOPY\r\n")));
m_oG2D->SetRopEtype(ROP_SRC_ONLY);
break;
case 0xEEEE: // SRCPAINT
RETAILMSG (G2D_MSG, (TEXT("SRCPAINT\r\n")));
m_oG2D->SetRopEtype(ROP_SRC_OR_DST);
break;
}
m_oG2D->BitBlt(pBltParms);
if (pBltParms->bltFlags & BLT_TRANSPARENT)
{
m_oG2D->SetTransparentMode(0, pBltParms->solidColor); // turn off Transparency
}
return S_OK;
}
SCODE AcceleratedBltSelect02( GPEBltParms *pBltParms )
{
return EmulatedBltSelect02(pBltParms); // todo
}
SCODE AcceleratedBltSelect08( GPEBltParms *pBltParms )
{
return EmulatedBltSelect08(pBltParms); // todo
}
SCODE S3C6400Disp::AcceleratedBltSelect16( GPEBltParms *pBltParms )
{
#if G2D_PROFILE
RopProfiler *ropProfiler = RopProfiler::Instance();
#endif
// In SMDK6400, Stretch function support only integer multipling calculation
// Do not support shrink, fractional stretching
if ((pBltParms->pDst->Format() != gpe16Bpp) ||
(pBltParms->pLookup) || (pBltParms->pConvert) || // // Emulate if color conversion required
(pBltParms->bltFlags & BLT_ALPHABLEND) ||
(pBltParms->bltFlags & BLT_TRANSPARENT) ||
(pBltParms->bltFlags & BLT_STRETCH)
) // // Emulate if Stretching or AlphaBlend required
{
return S_OK;
}
if ((pBltParms->bltFlags & BLT_STRETCH)) // Stretch Bllitting with X or Y axis mirroring
{
if(!pBltParms->prclDst)
{
goto emulsel;
}
else
{
if ((pBltParms->prclDst->left > pBltParms->prclDst->right) && (pBltParms->prclDst->top > pBltParms->prclDst->bottom) )
{
goto emulsel;
}
if ((pBltParms->prclDst->left > pBltParms->prclDst->right) || (pBltParms->prclDst->top > pBltParms->prclDst->bottom) )
{
if(pBltParms->prclSrc) // PtInRect(Src, Dst's all four point)
{
if((pBltParms->prclSrc->right < pBltParms->prclDst->left))
{
if((pBltParms->prclSrc->top < pBltParms->prclDst->bottom))
{
goto emulsel;
}
if((pBltParms->prclSrc->bottom > pBltParms->prclDst->top))
{
goto emulsel;
}
}
else if((pBltParms->prclSrc->left > pBltParms->prclDst->right))
{
if((pBltParms->prclSrc->top < pBltParms->prclDst->bottom))
{
goto emulsel;
}
if((pBltParms->prclSrc->bottom > pBltParms->prclDst->top))
{
goto emulsel;
}
}
}
}
}
}
// select accelerated function based on rop value
switch (pBltParms->rop4)
{
case 0x0000: // BLACKNESS
pBltParms->solidColor = 0;
pBltParms->pBlt = (SCODE (GPE::*)(struct GPEBltParms *)) &Emulator::EmulatedBltFill16;
#if 0
// pBltParms->pBlt = (SCODE (GPE::*)(struct GPEBltParms *)) &S3C6400Disp::AcceleratedBltFill;
#endif
return S_OK;
case 0xFFFF: // WHITENESS // Done have prclSrc, and pMask
pBltParms->solidColor = 0x00ffffff;
pBltParms->pBlt = (SCODE (GPE::*)(struct GPEBltParms *)) &Emulator::EmulatedBltFill16;
#if 0
// pBltParms->solidColor = 0x0000ffff;
// pBltParms->pBlt = (SCODE (GPE::*)(struct GPEBltParms *)) &S3C6400Disp::AcceleratedBltFill;
#endif
return S_OK;
case 0x5555: // DSTINVERT
// pBltParms->pBlt = (SCODE (GPE::*)(struct GPEBltParms *)) &Emulator::EmulatedBltDstInvert16;
goto emulsel;
// return S_OK;
case 0xAAF0: // Special PATCOPY rop for text output -- fill where mask is set.
// Not a pattern brush?
if (pBltParms->solidColor != -1)
{
if (pBltParms->pMask->Format() == gpe1Bpp)
{
pBltParms->pBlt = (SCODE (GPE::*)(struct GPEBltParms *)) &Emulator::EmulatedBltText16;
}
else if (pBltParms->pMask->Format() == gpe4Bpp)
{
pBltParms->pBlt = (SCODE (GPE::*)(struct GPEBltParms *)) &Emulator::EmulatedBltAlphaText16;
}
}
return S_OK;
case 0x5A5A: // PATINVERT
return S_OK;
case 0xF0F0: // PATCOPY
RETAILMSG (G2D_MSG, (TEXT("PATCOPY\r\n")));
if( pBltParms->solidColor != -1) // must be a solid colored brush
{
#if 0 // use sw opt. code
if( (!pBltParms->prclDst) ||
( (pBltParms->prclDst->left < 0) ||
(pBltParms->prclDst->top < 0) ||
(pBltParms->prclDst->right < 0 ) ||
(pBltParms->prclDst->bottom < 0 )) )
{
#if G2D_PROFILE
ropProfiler->Log(true, pBltParms->rop4);
#endif
pBltParms->pBlt = (SCODE (GPE::*)(struct GPEBltParms *)) &S3C6400Disp::AcceleratedBltFill;
// printf("sel ac fill\n");
return S_OK;
}else
{
#endif
pBltParms->pBlt = (SCODE (GPE::*)(struct GPEBltParms *)) &Emulator::EmulatedBltFill16;
return S_OK;
#if 0
}
#endif
}
return S_OK;
case 0x6666: // SRCINVERT
#if 0 // Performance is not good
if( pBltParms->prclDst &&
((pBltParms->prclDst->left >= 0) &&
(pBltParms->prclDst->top >= 0) &&
(pBltParms->prclDst->right >= 0 ) &&
(pBltParms->prclDst->bottom >= 0 )) &&
pBltParms->pSrc &&
((S3C6400Surf *)(pBltParms->pSrc))->InVideoMemory() &&
(pBltParms->pSrc->Width() == pBltParms->pDst->Width()) &&
(pBltParms->pSrc->Height() == pBltParms->pDst->Height())
)
{
#if G2D_PROFILE
ropProfiler->Log(true, pBltParms->rop4);
#endif
pBltParms->pBlt = (SCODE (GPE::*)(struct GPEBltParms *)) &S3C6400Disp::AcceleratedSrcCopyBlt;
return S_OK;
}
#endif
if (pBltParms->pSrc && pBltParms->pSrc->Format() == gpe16Bpp)
{
pBltParms->pBlt = (SCODE (GPE::*)(struct GPEBltParms *)) &Emulator::EmulatedBltSrcInvert1616;
}
return S_OK;
case 0xCCCC: // SRCCOPY
#if 0 // Performance is not good
if( pBltParms->prclDst &&
((pBltParms->prclDst->left >= 0) &&
(pBltParms->prclDst->top >= 0) &&
(pBltParms->prclDst->right >= 0 ) &&
(pBltParms->prclDst->bottom >= 0 )) &&
pBltParms->pSrc &&
((S3C6400Surf *)(pBltParms->pSrc))->InVideoMemory() &&
(pBltParms->pSrc->Width() == pBltParms->pDst->Width()) &&
(pBltParms->pSrc->Height() == pBltParms->pDst->Height())
)
{
pBltParms->pBlt = (SCODE (GPE::*)(struct GPEBltParms *)) &S3C6400Disp::AcceleratedSrcCopyBlt;
return S_OK;
}
#endif
if(pBltParms->pSrc)
{
if ((pBltParms->pSrc->Format() == gpe16Bpp) &&
(NULL == pBltParms->pLookup) && (NULL == pBltParms->pConvert))
{
pBltParms->pBlt = (SCODE (GPE::*)(struct GPEBltParms *)) &Emulator::EmulatedBltSrcCopy1616;
}
else if (pBltParms->pSrc->Format() == gpe4Bpp)
{
pBltParms->pBlt = (SCODE (GPE::*)(struct GPEBltParms *)) &Emulator::EmulatedBltSrcCopy0416;
}
else if (pBltParms->pSrc->Format() == gpe1Bpp)
{
pBltParms->pBlt = (SCODE (GPE::*)(struct GPEBltParms *)) &Emulator::EmulatedBltSrcCopy0116;
}
}
return S_OK;
case 0x8888: // SRCAND
#if 0 // Performance is not good
if( pBltParms->prclDst &&
((pBltParms->prclDst->left >= 0) &&
(pBltParms->prclDst->top >= 0) &&
(pBltParms->prclDst->right >= 0 ) &&
(pBltParms->prclDst->bottom >= 0 )) &&
pBltParms->pSrc &&
((S3C6400Surf *)(pBltParms->pSrc))->InVideoMemory() &&
(pBltParms->pSrc->Width() == pBltParms->pDst->Width()) &&
(pBltParms->pSrc->Height() == pBltParms->pDst->Height())
)
{
pBltParms->pBlt = (SCODE (GPE::*)(struct GPEBltParms *)) &S3C6400Disp::AcceleratedSrcCopyBlt;
return S_OK;
}
#endif
if (pBltParms->pSrc && pBltParms->pSrc->Format() == gpe16Bpp)
{
pBltParms->pBlt = (SCODE (GPE::*)(struct GPEBltParms *)) &Emulator::EmulatedBltSrcAnd1616;
}
return S_OK;
case 0xEEEE: // SRCPAINT
#if 0 // Performance is not good
if( pBltParms->prclDst &&
((pBltParms->prclDst->left >= 0) &&
(pBltParms->prclDst->top >= 0) &&
(pBltParms->prclDst->right >= 0 ) &&
(pBltParms->prclDst->bottom >= 0 )) &&
pBltParms->pSrc &&
((S3C6400Surf *)(pBltParms->pSrc))->InVideoMemory() &&
(pBltParms->pSrc->Width() == pBltParms->pDst->Width()) &&
(pBltParms->pSrc->Height() == pBltParms->pDst->Height())
)
{
pBltParms->pBlt = (SCODE (GPE::*)(struct GPEBltParms *)) &S3C6400Disp::AcceleratedSrcCopyBlt;
return S_OK;
}
#endif
if (pBltParms->pSrc && pBltParms->pSrc->Format() == gpe16Bpp)
{
pBltParms->pBlt = (SCODE (GPE::*)(struct GPEBltParms *)) &Emulator::EmulatedBltSrcPaint1616;
}
return S_OK;
default: // some random ROP4
return S_OK;
}
emulsel:
#if G2D_PROFILE
ropProfiler->Log(false, pBltParms->rop4);
#endif
return EmulatedBltSelect16(pBltParms);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -