📄 gpeflat.cpp
字号:
delete ucTempCursor;
return S_FALSE;
}
//Rotate the matrix:
switch( m_iRotate ) {
case DMDO_180:
for( row=0; row< cY; row++ ){
for (col = 0; col < cX ; col++) {
//ucTempCursor[row][col]=m_ucCusorValue[cY-1-row][cX-1-col];
ucTempCursor[row*cX + col]=m_ucCusorValue[(cY-1-row)*cX + (cX-1-col)];
}
}
//Since the data has been copied to m_ucCusorValue, the next line is useless.
pValue=ucTempCursor;
break;
case DMDO_90:
{
for( row=0; row< cY; row++ ){
for (col = 0; col < cX ; col++) {
//ucTempCursor[row][col]=m_ucCusorValue[col][cY-1-row];
ucTempCursor[row*cX+col]=m_ucCusorValue[col*cX +( cY-1-row ) ];
}
}
pValue=ucTempCursor;
}
break;
case DMDO_270:
{
for( row=0; row< cY; row++ ){
for (col = 0; col < cX ; col++) {
//ucTempCursor[row][col]=m_ucCusorValue[cX-1-col][row];
ucTempCursor[row*cX+col]=m_ucCusorValue[(cX-1-col)*cX + row];
}
}
pValue=ucTempCursor;
}
break;
default:
break;
}
#endif
pos=0;
for (row = 0; row < cY; row++) {
for (col = 0; col < iMaxCol; col++) {
usMask=0;
for( i=0; i< 4; i++){
usMask|= (pValue[pos++] << (6-2*i) );
}
((PUCHAR)m_pCursor)[iCursorBit++ ] = (UCHAR)usMask;
}
}
//
// Cursor has been initialized.
//
m_bCursorHasShape = TRUE;
//
// Enable the cursor and display the new cursor.
//
if(m_bCursorEnabled)
{
//
// Compute new cursor rect
//
m_CursorRect.left = m_xPosition - m_CursorHotspot.x;
//m_CursorRect.right = m_CursorRect.left + m_CursorSize.x;
m_CursorRect.top = m_yPosition - m_CursorHotspot.y;
//m_CursorRect.bottom = m_CursorRect.top + m_CursorSize.y;
ulXYLOC = CURSORXYLOC_XMASK & ((m_StartStop.ulHActiveStart - m_CursorRect.left)<<CURSORXYLOC_XSHIFT);
ulXYLOC |= CURSORXYLOC_YMASK & ((m_StartStop.ulVActiveStart - m_CursorRect.top)<<CURSORXYLOC_YSHIFT);
// ulXYLOC |= m_bCursorEnabled? CURSORXYLOC_CEN: 0;
ulXYLOC |= CURSORXYLOC_CEN;
//
// Write the New XY Cursor value.
//
*RASTER_CURSORXYLOC = ulXYLOC;
}
//
// Renable the cursor if the size has changed.
//
if(m_bCursorEnabled && bSizeChanged)
{
*RASTER_CURSORXYLOC |= CURSORXYLOC_CEN;
}
#ifdef BSP_EP93XX_DISPLAY_ROTATION
if(ucTempCursor)
delete ucTempCursor;
#endif
return S_OK;
}
//****************************************************************************
// GPEFlat::MovePointer
//****************************************************************************
//
SCODE GPEFlat::MovePointer(INT xPosition, INT yPosition)
{
ULONG ulXYLOC;
static INT iLastRotate=0;
if (xPosition != -1 || yPosition != -1)
{
// Compute new cursor rect
m_CursorRect.left = xPosition- m_CursorHotspot.x;
m_CursorRect.top = yPosition - m_CursorHotspot.y;
m_CursorRect.right = m_CursorRect.left + m_CursorSize.x;
m_CursorRect.bottom = m_CursorRect.top + m_CursorSize.y;
#ifdef BSP_EP93XX_DISPLAY_ROTATION
RotateRectl( &m_CursorRect );
if( iLastRotate != m_iRotate ){
FlushPointer( m_CursorSize.x, m_CursorSize.y ,TRUE);
//yPosition=-1;
iLastRotate=m_iRotate;
}
#endif
m_xPosition = m_CursorRect.left;
m_yPosition = m_CursorRect.top;
if(m_bCursorHasShape)
{
ulXYLOC = CURSORXYLOC_XMASK & ((m_StartStop.ulHActiveStart - m_CursorRect.left)<<CURSORXYLOC_XSHIFT);
ulXYLOC |= CURSORXYLOC_YMASK & ((m_StartStop.ulVActiveStart - m_CursorRect.top)<<CURSORXYLOC_YSHIFT);
ulXYLOC |= CURSORXYLOC_CEN;
}
m_bCursorEnabled = TRUE;
}
else
{
ulXYLOC = 0;
m_bCursorEnabled = FALSE;
}
//
// Write the New XY Cursor value.
//
*RASTER_CURSORXYLOC = ulXYLOC;
return S_OK;
}
//****************************************************************************
// GPEFlat::WaitForNotBusy
//****************************************************************************
// In the EP9312 Video is never busy.
//
void GPEFlat::WaitForNotBusy(void)
{
DEBUGMSG (GPE_ZONE_INIT, (TEXT("GPEFlat::WaitForNotBusy\r\n")));
return;
}
//****************************************************************************
// GPEFlat::IsBusy
//****************************************************************************
// In the EP9312 Video is never busy.
//
int GPEFlat::IsBusy(void)
{
DEBUGMSG (GPE_ZONE_INIT, (TEXT("GPEFlat::IsBusy\r\n")));
return 0;
}
//****************************************************************************
// GPEFlat::GetPhysicalVideoMemory
//****************************************************************************
// Get the Physical memory base and video memory size.
//
void GPEFlat::GetPhysicalVideoMemory
(
unsigned long *physicalMemoryBase,
unsigned long *videoMemorySize
)
{
DEBUGMSG (GPE_ZONE_INIT, (TEXT("GPEFlat::GetPhysicalVideoMemory\r\n")));
*physicalMemoryBase = m_pvFlatFrameBuffer;
*videoMemorySize = m_cbScanLineLength * m_cyPhysicalScreen;
}
//****************************************************************************
// GPEFlat::Line
//****************************************************************************
//
//
SCODE GPEFlat::Line
(
GPELineParms *lineParameters,
EGPEPhase phase
)
{
DEBUGMSG (GPE_ZONE_INIT, (TEXT("GPEFlat::Line\r\n")));
if (phase == gpeSingle || phase == gpePrepare)
{
DispPerfStart(ROP_LINE);
if ((lineParameters->pDst != m_pPrimarySurface))
{
lineParameters->pLine = &GPEFlat::EmulatedLine;
}
else
{
lineParameters->pLine = (SCODE (GPE::*)(struct GPELineParms *))& GPEFlat::EmulatedLine ;
}
}
else if (phase == gpeComplete)
{
DispPerfEnd(0);
}
return S_OK;
}
//****************************************************************************
// GPEFlat::BltPrepare
//****************************************************************************
//
SCODE GPEFlat::BltPrepare(GPEBltParms *blitParameters)
{
DEBUGMSG (GPE_ZONE_INIT, (TEXT("GPEFlat::BltPrepare\r\n")));
DispPerfStart(blitParameters->rop4);
#ifdef BSP_EP93XX_DISPLAY_ROTATION
//
if ( blitParameters->pDst == m_pPrimarySurface || blitParameters->pSrc == m_pPrimarySurface ){
blitParameters->pBlt = (SCODE (GPE::*)(GPEBltParms *))&GPE::EmulatedBltRotate; // catch all
}
else
#endif
{
blitParameters->pBlt =&GPEFlat::EmulatedBlt; // catch all
}
return S_OK;
}
//****************************************************************************
// GPEFlat::BltComplete
//****************************************************************************
//
SCODE GPEFlat::BltComplete(GPEBltParms *blitParameters)
{
DEBUGMSG (GPE_ZONE_INIT, (TEXT("GPEFlat::BltComplete\r\n")));
DispPerfEnd(0);
return S_OK;
}
//****************************************************************************
// GPEFlat::InVBlank
//****************************************************************************
// We don't have to worry about blanking.
//
INT GPEFlat::InVBlank(void)
{
static BOOL value = FALSE;
DEBUGMSG (GPE_ZONE_INIT, (TEXT("GPEFlat::InVBlank\r\n")));
value = !value;
return value;
}
//****************************************************************************
// PrintPalette
//****************************************************************************
// Debug routine to print out the current palette
//
//
void PrintPalette()
{
#ifdef DEBUG
ULONG ulEntry;
DEBUGMSG (GPE_ZONE_PALETTE, (L"GPEFLat: Current Palette, "));
//
// If the print Palette zone is enabled print out the palette whenever
// we open the palette.
//
if(GPE_ZONE_PALETTE)
{
for(ulEntry = 0; ulEntry < 256 ; ulEntry+=4)
{
DEBUGMSG
(
GPE_ZONE_PALETTE,
(
L"Entry 0x%03x: 0x%08x 0x%08x 0x%08x 0x%08x\n",
ulEntry,
RASTER_COLOR_LUT[ulEntry],
RASTER_COLOR_LUT[ulEntry + 1],
RASTER_COLOR_LUT[ulEntry + 2],
RASTER_COLOR_LUT[ulEntry + 3]
)
);
}
}
#endif //DEBUG
}
//****************************************************************************
// GPEFlat::SetPalette
//****************************************************************************
// Set up the Color Look up table. There are two LUT's in hardware.
// the lookup table that is visible is not the one that is accessable.
//
//
SCODE GPEFlat::SetPalette
(
const PALETTEENTRY *source,
USHORT firstEntry,
USHORT numEntries
)
{
DEBUGMSG (GPE_ZONE_INIT, (TEXT("GPEFlat::SetPalette\r\n")));
ULONG ulEntry;
ULONG ulCount;
if (firstEntry < 0 || firstEntry + numEntries > 256 || source == NULL)
{
RETAILMSG(1,(TEXT("SetPalette invalid arguments\r\n")));
return E_INVALIDARG;
}
//
// Copy into our palette.
//
memcpy((void *)&m_Palette[firstEntry], source, sizeof(PALETTEENTRY) * numEntries);
//
// I would do a memory copy but the red and blue
// palette entries are reversed.
//
for(ulEntry = firstEntry ; ulEntry < numEntries; ulEntry++)
{
unsigned char red, green, blue;
//
// Get the values for Red, Green and Blue.
//
red = source[ulEntry].peRed ;
green = source[ulEntry].peGreen;
blue = source[ulEntry].peBlue;
//
// Program up the Color lookup table.
//
RASTER_COLOR_LUT[ulEntry] = ((ULONG)red<< 16) + ((ULONG)green << 8) + (ULONG)blue;
}
//
// Switch to the other LUT and program the same values.
//
*RASTER_LUTCONT ^= LUTCONT_SWTCH;
//
// Wait until a palette switch occurs at the end of the frame.
//
for(ulCount = 0 ;; ulCount++)
{
//
// Put a small delay to wait for the change.
//
Sleep(1);
//
// Has the switch occured.
//
if(((*RASTER_LUTCONT & LUTCONT_SSTAT) && (*RASTER_LUTCONT &LUTCONT_SWTCH)) ||
(!(*RASTER_LUTCONT & LUTCONT_SSTAT) && !(*RASTER_LUTCONT & LUTCONT_SWTCH)))
{
break;
}
if(ulCount > 100)
{
DEBUGMSG (GPE_ZONE_INIT, (TEXT("ERROR: Palette switch never occured.\n")));
}
}
//
// I would do a memory copy but the red and blue
// palette entries are reversed.
//
for(ulEntry = firstEntry ; ulEntry < numEntries; ulEntry++)
{
unsigned char red, green, blue;
//
// Get the values for Red, Green and Blue.
//
red = source[ulEntry].peRed ;
green = source[ulEntry].peGreen;
blue = source[ulEntry].peBlue;
//
// Program up the Color lookup table.
//
RASTER_COLOR_LUT[ulEntry] = ((ULONG)red<< 16) + ((ULONG)green << 8) + (ULONG)blue;
}
//
// Print out the palette to the debugger if the debug zone is enabled.
//
PrintPalette();
return S_OK;
}
//****************************************************************************
// GPEFlat::GetGraphicsCaps
//****************************************************************************
//
//
ULONG GPEFlat::GetGraphicsCaps()
{
ULONG ret = 0;
if (m_pMode)
{
//
// if in 16bpp mode, return GCAPS_GRAY16 to denote that we support
// anti-aliased fonts
if (m_pMode->Bpp == 16)
{
ret = GCAPS_GRAY16;
}
}
ret = ret | GCAPS_CLEARTYPE;
return ret;
}
//****************************************************************************
// RegisterDDHALAPI
//****************************************************************************
// no DDHAL support
//
void RegisterDDHALAPI(void)
{
return;
}
//****************************************************************************
// DrvGetMasks
//****************************************************************************
//
//
ULONG *APIENTRY DrvGetMasks(DHPDEV dhpdev)
{
if( gdwColorDepth == 16)
return gBitMasks16;
else if( gdwColorDepth == 24)
return gBitMasks24;
else //( gdwColorDepth == 8 ) // This is default branch.
return gBitMasks8;
}
//****************************************************************************
// GPEFlat::PowerHandler
//****************************************************************************
// Routine that powers up and down the video clocks.
//
//
VOID GPEFlat::PowerHandler( BOOL bOff)
{
ULONG ulTemp;
//
// Unlock the video attributes register.
//
*RASTER_REALITI_SWLOCK = 0xaa;
//
// See if we are power up the system or shutting down the system.
//
if(bOff)
{
//
// Clear the Sleep signal. This turns off the LCD.
//
if( m_Registry.fSleepSignalActive )
{
ulTemp = *GPIO_PADR;
*GPIO_PADR = ulTemp & ~0x2;
}
*RASTER_VIDEOATTRIBS = ~VIDEOATTRIBS_EN & m_ulVideoAttrib ;
}
else
{
//
// Set the Sleep Signal. This turns on the LCD.
//
if( m_Registry.fSleepSignalActive )
{
ulTemp = *GPIO_PADR;
*GPIO_PADR = ulTemp | 0x2;
}
*RASTER_VIDEOATTRIBS = m_ulVideoAttrib ;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -