📄 s3c2410x_lcd.cpp
字号:
void S3C2410DISP::GetPhysicalVideoMemory(unsigned long *physicalMemoryBase, unsigned long *videoMemorySize)
{
RETAILMSG(0, (TEXT("S3C2410DISP::GetPhysicalVideoMemory\r\n")));
*physicalMemoryBase = gdwLCDVirtualFrameBase;
*videoMemorySize = m_cbScanLineLength * m_nScreenHeight;
}
void S3C2410DISP::GetVirtualVideoMemory(unsigned long *virtualMemoryBase, unsigned long *videoMemorySize)
{
DEBUGMSG (GPE_ZONE_INIT, (TEXT("RGPEFlat::GetVirtualVideoMemory\r\n")));
*virtualMemoryBase = gdwLCDVirtualFrameBase;
*videoMemorySize = m_cbScanLineLength * m_nScreenHeight;
}
SCODE S3C2410DISP::AllocSurface(GPESurf **surface, INT width, INT height, EGPEFormat format, INT surfaceFlags)
{
RETAILMSG(0, (TEXT("S3C2410DISP::AllocSurface\r\n")));
if (surfaceFlags & GPE_REQUIRE_VIDEO_MEMORY)
{
return E_OUTOFMEMORY;
}
// Allocate from system memory
*surface = new GPESurf(width, height, format);
if (*surface != NULL)
{
// Check that the bits were allocated succesfully
if (((*surface)->Buffer()) == NULL)
{
delete *surface; // Clean up
}
else
{
return S_OK;
}
}
return E_OUTOFMEMORY;
}
SCODE S3C2410DISP::AllocSurface(DDGPESurf **surface, INT width, INT height, EGPEFormat format, EDDGPEPixelFormat pixelFormat, INT surfaceFlags)
{
RETAILMSG(0, (TEXT("S3C2410DISP::AllocSurface\r\n")));
if (surfaceFlags & GPE_REQUIRE_VIDEO_MEMORY)
{
return E_OUTOFMEMORY;
}
// Allocate from system memory
DWORD bpp = EGPEFormatToBpp[format];
DWORD stride = ((bpp * width + 31) >> 5) << 2;
DWORD nSurfaceBytes = stride * height;
*surface = new DDGPESurf(width, height, stride, format, pixelFormat);
if (*surface != NULL)
{
// Check that the bits were allocated succesfully
if (((*surface)->Buffer()) == NULL)
{
delete *surface; // Clean up
}
else
{
return S_OK;
}
}
return E_OUTOFMEMORY;
}
void S3C2410DISP::SetVisibleSurface(GPESurf* pTempSurf, BOOL bWaitForVBlank)
{
GPESurf * pSurf = (GPESurf *)pTempSurf;
}
SCODE S3C2410DISP::WrappedEmulatedLine (GPELineParms *lineParameters)
{
SCODE retval;
RECT bounds;
int N_plus_1; // Minor length of bounding rect + 1
// calculate the bounding-rect to determine overlap with cursor
if (lineParameters->dN) // The line has a diagonal component (we'll refresh the bounding rect)
{
N_plus_1 = 2 + ((lineParameters->cPels * lineParameters->dN) / lineParameters->dM);
}
else
{
N_plus_1 = 1;
}
switch(lineParameters->iDir)
{
case 0:
bounds.left = lineParameters->xStart;
bounds.top = lineParameters->yStart;
bounds.right = lineParameters->xStart + lineParameters->cPels + 1;
bounds.bottom = bounds.top + N_plus_1;
break;
case 1:
bounds.left = lineParameters->xStart;
bounds.top = lineParameters->yStart;
bounds.bottom = lineParameters->yStart + lineParameters->cPels + 1;
bounds.right = bounds.left + N_plus_1;
break;
case 2:
bounds.right = lineParameters->xStart + 1;
bounds.top = lineParameters->yStart;
bounds.bottom = lineParameters->yStart + lineParameters->cPels + 1;
bounds.left = bounds.right - N_plus_1;
break;
case 3:
bounds.right = lineParameters->xStart + 1;
bounds.top = lineParameters->yStart;
bounds.left = lineParameters->xStart - lineParameters->cPels;
bounds.bottom = bounds.top + N_plus_1;
break;
case 4:
bounds.right = lineParameters->xStart + 1;
bounds.bottom = lineParameters->yStart + 1;
bounds.left = lineParameters->xStart - lineParameters->cPels;
bounds.top = bounds.bottom - N_plus_1;
break;
case 5:
bounds.right = lineParameters->xStart + 1;
bounds.bottom = lineParameters->yStart + 1;
bounds.top = lineParameters->yStart - lineParameters->cPels;
bounds.left = bounds.right - N_plus_1;
break;
case 6:
bounds.left = lineParameters->xStart;
bounds.bottom = lineParameters->yStart + 1;
bounds.top = lineParameters->yStart - lineParameters->cPels;
bounds.right = bounds.left + N_plus_1;
break;
case 7:
bounds.left = lineParameters->xStart;
bounds.bottom = lineParameters->yStart + 1;
bounds.right = lineParameters->xStart + lineParameters->cPels + 1;
bounds.top = bounds.bottom - N_plus_1;
break;
default:
RETAILMSG(0, (TEXT("Invalid direction: %d\r\n"), lineParameters->iDir));
return E_INVALIDARG;
}
// check for line overlap with cursor and turn off cursor if overlaps
RECTL cursorRect = m_CursorRect;
RotateRectl (&cursorRect);
if (m_CursorVisible && !m_CursorDisabled &&
cursorRect.top < bounds.bottom && cursorRect.bottom > bounds.top &&
cursorRect.left < bounds.right && cursorRect.right > bounds.left)
{
CursorOff();
m_CursorForcedOff = TRUE;
}
// do emulated line
retval = EmulatedLine (lineParameters);
// see if cursor was forced off because of overlap with line bouneds and turn back on
if (m_CursorForcedOff)
{
m_CursorForcedOff = FALSE;
CursorOn();
}
return retval;
}
SCODE S3C2410DISP::Line(GPELineParms *lineParameters, EGPEPhase phase)
{
RETAILMSG(0, (TEXT("S3C2410DISP::Line\r\n")));
if (phase == gpeSingle || phase == gpePrepare)
{
if ((lineParameters->pDst != m_pPrimarySurface))
{
lineParameters->pLine = &GPE::EmulatedLine;
}
else
{
lineParameters->pLine = (SCODE (GPE::*)(struct GPELineParms *)) &S3C2410DISP::WrappedEmulatedLine;
}
}
return S_OK;
}
SCODE S3C2410DISP::BltPrepare(GPEBltParms *blitParameters)
{
RECTL rectl;
RETAILMSG(0, (TEXT("S3C2410DISP::BltPrepare\r\n")));
// default to base EmulatedBlt routine
blitParameters->pBlt = &GPE::EmulatedBlt;
// see if we need to deal with cursor
if (m_CursorVisible && !m_CursorDisabled)
{
// check for destination overlap with cursor and turn off cursor if overlaps
if (blitParameters->pDst == m_pPrimarySurface) // only care if dest is main display surface
{
if (blitParameters->prclDst != NULL) // make sure there is a valid prclDst
{
rectl = *blitParameters->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;
}
}
// check for source overlap with cursor and turn off cursor if overlaps
if (blitParameters->pSrc == m_pPrimarySurface) // only care if source is main display surface
{
if (blitParameters->prclSrc != NULL) // make sure there is a valid prclSrc
{
rectl = *blitParameters->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;
}
}
}
return S_OK;
}
SCODE S3C2410DISP::BltComplete(GPEBltParms *blitParameters)
{
RETAILMSG(0, (TEXT("S3C2410DISP::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;
}
INT S3C2410DISP::InVBlank(void)
{
RETAILMSG(0, (TEXT("S3C2410DISP::InVBlank\r\n")));
return 0;
}
SCODE S3C2410DISP::SetPalette(const PALETTEENTRY *source, USHORT firstEntry, USHORT numEntries)
{
RETAILMSG(0, (TEXT("S3C2410DISP::SetPalette\r\n")));
if (firstEntry < 0 || firstEntry + numEntries > 256 || source == NULL)
{
return E_INVALIDARG;
}
return S_OK;
}
ULONG S3C2410DISP::GetGraphicsCaps()
{
#ifdef CLEARTYPE
return GCAPS_GRAY16 | GCAPS_CLEARTYPE;
#else
return GCAPS_GRAY16;
#endif
}
ULONG S3C2410DISP::DrvEscape(
SURFOBJ *pso,
ULONG iEsc,
ULONG cjIn,
PVOID pvIn,
ULONG cjOut,
PVOID pvOut)
{
#if defined(CLEARTYPE) || defined(ROTATE)
if (iEsc == QUERYESCSUPPORT )
{
if (cjIn == sizeof(DWORD))
{
DWORD SupportChk = *(DWORD *)pvIn;
if (SupportChk == GETGXINFO)
return 1;
else
return 0;
}
else
{
SetLastError (ERROR_INVALID_PARAMETER);
return -1;
}
}
else if (iEsc == GETGXINFO)
{
if((cjOut >= sizeof(GXDeviceInfo)) && (pvOut != NULL) &&
(m_pMode->Bpp == 8 || m_pMode->Bpp == 16 || m_pMode->Bpp == 24 || m_pMode->Bpp == 32))
{
if(((GXDeviceInfo*)pvOut)->idVersion == kidVersion100)
{
GXDeviceInfo* pgxoi = (GXDeviceInfo*)pvOut;
pgxoi->idVersion = kidVersion100;
if( m_DPI == HIGH_DPI_VALUE || m_DPI == HIGH_DPI_VALUE_TPC )
{
pgxoi->pvFrameBuffer = (void *)m_pvDRAMBuffer;
if( m_DPI == HIGH_DPI_VALUE )
{
pgxoi->cbStride = DISP_CY_STRIDE;
pgxoi->cxWidth = DISP_CX_SCREEN;
pgxoi->cyHeight = DISP_CY_SCREEN;
}
else
{
pgxoi->cbStride = DISP_CY_STRIDE_TPC;
pgxoi->cxWidth = DISP_CX_SCREEN_TPC;
pgxoi->cyHeight = DISP_CY_SCREEN_TPC;
}
pgxoi->cBPP = 16;
pgxoi->ffFormat = kfDirect | kfDirect565;
RETAILMSG(TRUE, (TEXT("m_pvDRAMBuffer is %x \r\n"), m_pvDRAMBuffer ));
}
else
{
pgxoi->pvFrameBuffer = (void *)m_pPrimarySurface->Buffer();
pgxoi->cbStride = m_pPrimarySurface->Stride();
pgxoi->cxWidth = m_pPrimarySurface->Width();
pgxoi->cyHeight = m_pPrimarySurface->Height();
switch(m_pMode->Bpp)
{
case 8:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -