📄 blt.cpp
字号:
//
// Copyright(C) Renesas Technology Corp. 1998-2003. All rights reserved.
// Portions Copyright (c) 1995-2000 Microsoft Corporation.
//
// NCG Display Driver for ITS-DS7
//
// FILE : blt.cpp
// CREATED : 2003.08.28
// MODIFIED : 2003.11.28
// AUTHOR : Renesas Technology Corp.
// HARDWARE : RENESAS ITS-DS7
// HISTORY :
// 2003.08.28
// - Created prototype code.
// (based on Q2SD Display Driver for PFM-DS6C Ver.3.1.0)
//
#include "precomp.h"
SCODE NCG::BltPrepare(
GPEBltParms *pBltParms )
{
NCGSurf* pSrc = (NCGSurf*)(pBltParms->pSrc);
NCGSurf* pDst = (NCGSurf*)(pBltParms->pDst);
DWORD srcLeft, srcTop, srcRight, srcBottom;
DWORD dstLeft, dstTop, dstRight, dstBottom;
if (pBltParms->prclDst) {
dstLeft = pBltParms->prclDst->left;
dstTop = pBltParms->prclDst->top;
dstRight = pBltParms->prclDst->right;
dstBottom = pBltParms->prclDst->bottom;
}
else {
dstLeft = 0;
dstTop = 0;
dstRight = pDst->Width();
dstBottom = pDst->Height();
}
DEBUGMSG(GPE_ZONE_BLT_HI,
(TEXT("BltPrepare: Dest is (%d, %d) - (%d, %d)\r\n"),
dstLeft, dstTop, dstRight, dstBottom));
if (pDst->InVideoMemory())
DEBUGMSG(GPE_ZONE_BLT_HI,
(TEXT("BltPrepare: %dbpp, VideoMemory, offset=%x.\r\n"),
EGPEFormatToBpp[pDst->Format()], pDst->OffsetInVideoMemory()));
else
DEBUGMSG(GPE_ZONE_BLT_HI,
(TEXT("BltPrepare: %dbpp, SystemMemory, address=%x.\r\n"),
EGPEFormatToBpp[pDst->Format()], pDst->Buffer()));
if (pSrc) {
if (pBltParms->prclSrc) {
srcLeft = pBltParms->prclSrc->left;
srcTop = pBltParms->prclSrc->top;
srcRight = pBltParms->prclSrc->right;
srcBottom = pBltParms->prclSrc->bottom;
}
else {
srcLeft = 0;
srcTop = 0;
srcRight = pSrc->Width();
srcBottom = pSrc->Height();
}
DEBUGMSG(GPE_ZONE_BLT_HI,
(TEXT("BltPrepare: Src is (%d, %d) - (%d, %d)\r\n"),
srcLeft, srcTop, srcRight, srcBottom));
if (pSrc->InVideoMemory())
DEBUGMSG(GPE_ZONE_BLT_HI,
(TEXT("BltPrepare: %dbpp, VideoMemory, offset=%x.\r\n"),
EGPEFormatToBpp[pSrc->Format()], pSrc->OffsetInVideoMemory()));
else
DEBUGMSG(GPE_ZONE_BLT_HI,
(TEXT("BltPrepare: %dbpp, SystemMemory, address=%x.\r\n"),
EGPEFormatToBpp[pSrc->Format()], pSrc->Buffer()));
}
DEBUGMSG(GPE_ZONE_BLT_HI,
(TEXT("BltPrepare: ROP4=%04x\r\n"), pBltParms->rop4));
DEBUGWAIT(GPE_ZONE_BLT_LO);
/* currently no GDI BitBlt acceleration */
pBltParms->pBlt = EmulatedBlt;
#ifdef ENABLE_EMULATION
/* This part is copied from S3Virge DDGPE display driver. */
#define FUNCNAME(basename) \
(SCODE (GPE::*)(struct GPEBltParms *))Emulator::Emulated##basename
// If there wasn't any accelerated function available, let's see if there
// is an emulated function that will be a little faster.
if (pBltParms->pBlt == EmulatedBlt)
{
if (pBltParms->rop4 == 0xAAF0) // Special PATCOPY rop for text output -- fill where mask is set.
{ // Not a pattern brush?
if( (pBltParms->solidColor != -1) &&
(pBltParms->pDst->Format() == gpe16Bpp) )
{
WaitForNotBusy();
if (pBltParms->pMask->Format() == gpe1Bpp)
{
pBltParms->pBlt = FUNCNAME(BltText16);
}
else // Anti-aliased text
{
pBltParms->pBlt = FUNCNAME(BltAlphaText16);
}
}
}
//
// Bail on any parameter values that would make this
// blt non-emulatable
//
if (!(EGPEFormatToBpp[pBltParms->pDst->Format()] != 8 ||
(pBltParms->bltFlags & (BLT_TRANSPARENT | BLT_STRETCH)) ||
pBltParms->pLookup ||
pBltParms->pConvert))
{
switch (pBltParms->rop4)
{
case 0x0000: // BLACKNESS
DEBUGMSG(GPE_ZONE_BLT_LO,
(TEXT("NCG::Blt - BLACKNESS\r\n")));
pBltParms->solidColor = 0;
pBltParms->pBlt = FUNCNAME(BltFill08);
break;
case 0xFFFF: // WHITENESS
DEBUGMSG(GPE_ZONE_BLT_LO,
(TEXT("NCG::Blt - WHITENESS\r\n")));
pBltParms->solidColor = 0x00ffffff;
pBltParms->pBlt = FUNCNAME(BltFill08);
break;
case 0xF0F0: // PATCOPY
if( pBltParms->solidColor != -1 )
{
DEBUGMSG(GPE_ZONE_BLT_LO,
(TEXT("NCG::Blt - PATCOPY - solid brush\r\n")));
pBltParms->pBlt = FUNCNAME(BltFill08);
}
break;
case 0xCCCC: // SRCCOPY
if (pBltParms->pSrc->Format() == gpe8Bpp)
{
WaitForNotBusy();
pBltParms->pBlt = FUNCNAME(BltSrcCopy0808);
}
break;
#if 0
case 0xAAF0: // Special PATCOPY rop for text output --
// fill where mask is set.
// Not a pattern brush?
if( pBltParms->solidColor != -1 )
{
WaitForNotBusy();
pBltParms->pBlt = FUNCNAME(BltText08);
}
break;
#endif
case 0x5A5A : // PATINVERT
if( pBltParms->solidColor != -1 )
{
DEBUGMSG(GPE_ZONE_BLT_LO,
(TEXT("NCG::Blt - PATINVERT - solid brush\r\n")));
pBltParms->pBlt = FUNCNAME(BltPatInvert08);
}
break;
case 0x5555: // DSTINVERT
DEBUGMSG(GPE_ZONE_BLT_LO,
(TEXT("NCG::Blt - DSTINVERT\r\n")));
pBltParms->pBlt = FUNCNAME(BltDstInvert08);
break;
case 0x8888: // SRCAND
DEBUGMSG(GPE_ZONE_BLT_LO,
(TEXT("NCG::Blt - SRCAND\r\n")));
if (pBltParms->pSrc->Format() == gpe8Bpp)
{
pBltParms->pBlt = FUNCNAME(BltSrcAnd0808);
}
break;
case 0xEEEE: // SRCPAINT
DEBUGMSG(GPE_ZONE_BLT_LO,
(TEXT("NCG::Blt - SRCPAINT\r\n")));
if (pBltParms->pSrc->Format() == gpe8Bpp)
{
pBltParms->pBlt = FUNCNAME(BltSrcPaint0808);
}
break;
case 0x6666: // SRCINVERT
DEBUGMSG(GPE_ZONE_BLT_LO,
(TEXT("NCG::Blt - SRCINVERT\r\n")));
if (pBltParms->pSrc->Format() == gpe8Bpp)
{
pBltParms->pBlt = FUNCNAME(BltSrcInvert0808);
}
break;
default: // some random ROP4
;
}
}
}
#endif
return S_OK;
}
SCODE NCG::BltComplete( GPEBltParms *pBltParms )
{
return S_OK;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -