📄 lcdcclass.cpp
字号:
// pPalette Handle of palette
//
// RETURNS:
// S_OK successful
// others failed
//
//------------------------------------------------------------------------------
SCODE LcdcClass::SetMode(int modeId, HPALETTE *pPalette)
{
DEBUGMSG(GPE_ZONE_INIT, (TEXT("Tahiti LcdcClass::SetMode(%d,0x%x)\r\n"), modeId, *pPalette));
BSPSetMode(modeId, pPalette);
return S_OK; // Mode is inherently set
}
//------------------------------------------------------------------------------
//
// FUNCTION: GetModeInfo
//
// DESCRIPTION: This method populates a GPEMode structure with data for the requested mode.
//
// PARAMETERS:
// pMode [out] Pointer to a GPEMode structure.
// modeNo [in] Integer specifying the mode to return information about.
//
// RETURNS:
// S_OK successful
// others failed
//
//------------------------------------------------------------------------------
SCODE LcdcClass::GetModeInfo(GPEMode * pMode, int modeNo)
{
DEBUGMSG(GPE_ZONE_INIT, (TEXT("LCDClass::GetModeInfo(%d)\r\n"), modeNo));
if( modeNo<0 || modeNo >= NumModes() )
return E_INVALIDARG;
BSPGetModeInfo(pMode, modeNo);
return S_OK;
}
//------------------------------------------------------------------------------
//
// FUNCTION: GetModeInfo
//
// DESCRIPTION: This method returns the number of
// display modes supported by a driver.
//
// PARAMETERS:
//
// RETURNS:
// The number of supported display modes
//
//------------------------------------------------------------------------------
int LcdcClass::NumModes()
{
DEBUGMSG(GPE_ZONE_INIT, (TEXT("LCDClass::NumModes\r\n")));
return BSPGetModeNum();
}
//------------------------------------------------------------------------------
//
// FUNCTION: PowerHandler
//
// DESCRIPTION: Turn on/off LCDC
//
// PARAMETERS:
// boff switch status
//
// RETURNS:
//
//------------------------------------------------------------------------------
VOID LcdcClass::PowerHandler(BOOL bOff)
{
}
//------------------------------------------------------------------------------
//
// FUNCTION: BltPrepare
//
// DESCRIPTION: This method identifies the appropriate functions
// needed to perform individual blits.
//
// PARAMETERS:
//
// RETURNS:
// S_OK successful
// others failed
//
//------------------------------------------------------------------------------
SCODE LcdcClass::BltPrepare(GPEBltParms * pBltParms)
{
RECTL rectl;
BOOL bRotate = FALSE;
DEBUGMSG (GPE_ZONE_INIT, (TEXT("RGPEFlat::BltPrepare\r\n")));
// default to base EmulatedBlt routine
pBltParms->pBlt = &GPE::EmulatedBlt;
// see if we need to deal with cursor
// check for destination overlap with cursor and turn off cursor if overlaps
if (pBltParms->pDst == m_pPrimarySurface) // only care if dest is main display surface
{
if (m_CursorVisible && !m_CursorDisabled)
{
if (pBltParms->prclDst != NULL) // make sure there is a valid prclDst
{
rectl = *pBltParms->prclDst; // if so, use it
}
else
{
rectl = m_CursorRect; // if not, use the Cursor rect - this forces the cursor to be turned off in this case
}
if (m_CursorRect.top < rectl.bottom && m_CursorRect.bottom > rectl.top &&
m_CursorRect.left < rectl.right && m_CursorRect.right > rectl.left)
{
CursorOff();
m_CursorForcedOff = TRUE;
}
}
if (m_iRotate )
{
bRotate = TRUE;
}
}
// check for source overlap with cursor and turn off cursor if overlaps
if (pBltParms->pSrc == m_pPrimarySurface) // only care if source is main display surface
{
if (m_CursorVisible && !m_CursorDisabled)
{
if (pBltParms->prclSrc != NULL) // make sure there is a valid prclSrc
{
rectl = *pBltParms->prclSrc; // if so, use it
}
else
{
rectl = m_CursorRect; // if not, use the CUrsor rect - this forces the cursor to be turned off in this case
}
if (m_CursorRect.top < rectl.bottom && m_CursorRect.bottom > rectl.top &&
m_CursorRect.left < rectl.right && m_CursorRect.right > rectl.left)
{
CursorOff();
m_CursorForcedOff = TRUE;
}
}
if (m_iRotate) //if rotated
{
bRotate = TRUE;
}
}
if (bRotate)
pBltParms->pBlt = (SCODE (GPE::*)(GPEBltParms *))(&GPE::EmulatedBltRotate);
return S_OK;
}
//------------------------------------------------------------------------------
//
// FUNCTION: BltComplete
//
// DESCRIPTION: This method executes to complete
// a blit sequence initiated by GPE::BltPrepare
//
// PARAMETERS:
//
// RETURNS:
// S_OK successful
// others failed
//
//------------------------------------------------------------------------------
SCODE LcdcClass::BltComplete(GPEBltParms * pBltParms)
{
DEBUGMSG (GPE_ZONE_INIT, (TEXT("RGPEFlat::BltComplete\r\n")));
// see if cursor was forced off because of overlap with source or destination and turn back on
if (m_CursorForcedOff)
{
m_CursorForcedOff = FALSE;
CursorOn();
}
return S_OK;
}
//------------------------------------------------------------------------------
//
// FUNCTION: AllocSurface
//
// DESCRIPTION: This method executes when the driver
// must allocate storage for surface pixels.
//
// PARAMETERS:
//
// RETURNS:
// S_OK successful
// others failed
//
//------------------------------------------------------------------------------
SCODE LcdcClass::AllocSurface( GPESurf **ppSurf,
int width,
int height,
EGPEFormat format,
int surfaceFlags)
{
if ((surfaceFlags & GPE_REQUIRE_VIDEO_MEMORY) || (format == m_pMode->format) && (surfaceFlags & GPE_PREFER_VIDEO_MEMORY))
{
if (!(format == m_pMode->format))
{
DEBUGMSG(GPE_ZONE_ERROR, (TEXT("AllocSurface - Invalid format value\n")));
return E_INVALIDARG;
}
// Attempt to allocate from video memory
Node2D *pNode = m_p2DVideoMemory->Alloc(width, height);
if (pNode)
{
ULONG offset = (m_nScreenStride * pNode->Top()) + ((pNode->Left()* EGPEFormatToBpp[format]) / 8);
*ppSurf = new LcdcSurf(width, height, offset, (PVOID)(m_pLinearVideoMem + offset), m_nScreenStride, format, pNode);
if (!(*ppSurf))
{
pNode->Free();
DEBUGMSG(GPE_ZONE_ERROR, (TEXT("AllocSurface - Out of Memory 1\n")));
return E_OUTOFMEMORY;
}
return S_OK;
}
if (surfaceFlags & GPE_REQUIRE_VIDEO_MEMORY)
{
*ppSurf = (GPESurf *)NULL;
DEBUGMSG(GPE_ZONE_ERROR, (TEXT("AllocSurface - Out of Memory 2\n")));
return E_OUTOFMEMORY;
}
}
if (surfaceFlags & GPE_REQUIRE_VIDEO_MEMORY)
{
*ppSurf = (GPESurf *)NULL;
DEBUGMSG(GPE_ZONE_ERROR, (TEXT("AllocSurface - Out of Memory 3\n")));
return E_OUTOFMEMORY;
}
// Allocate from system memory
DEBUGMSG(GPE_ZONE_CREATE, (TEXT("Creating a GPESurf in system memory. EGPEFormat = %d\r\n"), (int) format));
#ifdef OEM_ALLOC_MEM
*ppSurf = new LcdcSurf(width, height, format);
#else
*ppSurf = new GPESurf(width, height, format);
#endif
if (*ppSurf != NULL)
{
// check we allocated bits succesfully
if (((*ppSurf)->Buffer()) == NULL)
{
delete *ppSurf;
}
else
{
return S_OK;
}
}
DEBUGMSG(GPE_ZONE_ERROR, (TEXT("AllocSurface - Out of Memory 4\n")));
return E_OUTOFMEMORY;
}
//------------------------------------------------------------------------------
//
// FUNCTION: Line
//
// DESCRIPTION: This method executes before and
// after a sequence of line segments.
//
// PARAMETERS:
//
// RETURNS:
// S_OK successful
// others failed
//
//------------------------------------------------------------------------------
SCODE LcdcClass::Line(GPELineParms * pLineParms, EGPEPhase phase)
{
DEBUGMSG(GPE_ZONE_LINE, (TEXT("LcdcClass::Line\r\n")));
pLineParms->pLine = &GPE::EmulatedLine;
return S_OK;
}
//------------------------------------------------------------------------------
//
// FUNCTION: SetPalette
//
// DESCRIPTION: Palette methods
//
// PARAMETERS:
//
// RETURNS:
// S_OK successful
// others failed
//
//------------------------------------------------------------------------------
SCODE LcdcClass::SetPalette(const PALETTEENTRY *src,
unsigned short firstEntry,
unsigned short numEntries)
{
//In 16bpp display mode,
//the LCDC of Tahiti doesn't support palette change
//put codes here in future expansion if 4bpp or 8bpp is supported
return S_OK;
}
//------------------------------------------------------------------------------
//
// FUNCTION: InVBlank
//
// DESCRIPTION: Timing method
//
// PARAMETERS:
//
// RETURNS:
// S_OK successful
// others failed
//
//------------------------------------------------------------------------------
int LcdcClass::InVBlank(void)
{
DEBUGMSG (GPE_ZONE_INIT, (TEXT("LcdcClass::InVBlank()\r\n")));
//hardware of Tahiti-Lite do not support this function
return 1;
}
//------------------------------------------------------------------------------
//
// FUNCTION: ContrastControl
//
// DESCRIPTION: Sorfware contrast control method
//
// PARAMETERS:
// cmd [in] contrast control command
// pValue [in/out] pointer to the parameter to be passed
//
// RETURNS:
// TRUE successful
// FALSE failed
//
//------------------------------------------------------------------------------
BOOL LcdcClass::ContrastControl(ULONG cmd, ULONG *pValue)
{
bool bRet = FALSE;
return bRet;
}
//------------------------------------------------------------------------------
//
// FUNCTION: SetPointerShape
//
// DESCRIPTION: This method sets the shape of the pointer
//
// PARAMETERS:
//
// RETURNS:
// S_OK successful
// others failed
//
//------------------------------------------------------------------------------
SCODE LcdcClass::SetPointerShape(GPESurf * pMask,
GPESurf * pColorSurf,
int xHot,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -