📄 pxa255_lcd.cpp
字号:
if (bounds.left > bounds.right)
{
SWAP(int,bounds.left,bounds.right)
}
if ( bounds.top > bounds.bottom)
{
SWAP(int,bounds.top,bounds.bottom)
}
if (bounds.top == bounds.bottom-1)
{
if ( !( (pParms->bltFlags & (BLT_TRANSPARENT | BLT_STRETCH | BLT_ALPHABLEND)) || (pParms->pLookup) || (pParms->pConvert) ) )
{
if ( pParms->rop4 == 0xf0f0 )
{
if ( EGPEFormatToBpp[pParms->pDst->Format()] == 16 )
{
if (pParms->solidColor != -1)
{ // must be a solid colored brush
if (!bDoRotation && !gDrawCursorFlag)
{
DispDrvrDirtyRectDump2((LPRECT)&bounds,pParms->solidColor);
return (S_OK);
}
}
}
}
}
}
if ( !( (pParms->bltFlags & (BLT_TRANSPARENT | BLT_STRETCH | BLT_ALPHABLEND)) || (pParms->pLookup) || (pParms->pConvert) ) )
{
if ( pParms->rop4 == 0xf0f0 )
{
if ( EGPEFormatToBpp[pParms->pDst->Format()] == 16 )
{
if (pParms->solidColor != -1)
{ // must be a solid colored brush
DispDrvrDirtyRectDump_rectfill((LPRECT)&bounds,pParms->solidColor);
return (S_OK);
}
}
}
}
if (FAILED(code))
return (code);
DispDrvrDirtyRectDump((LPRECT)&bounds);
return (code);
}
SCODE SA2Video::BltPrepare(GPEBltParms *pBltParms)
{
DEBUGMSG(GPE_ZONE_LINE,(TEXT("SA2Video::BltPrepare\r\n")));
#ifdef DO_DISPPERF
DispPerfStart(pBltParms->rop4);
#endif
if ((pBltParms->pDst != m_pPrimarySurface) || gUseDispDrvrPhysicalFrameBuffer)
pBltParms->pBlt = &GPE::EmulatedBlt;
else
pBltParms->pBlt = (SCODE (GPE::*)(struct GPEBltParms *))&SA2Video::WrappedEmulatedBlt;
return (S_OK);
}
// This function would be used to undo the setting of clip registers etc
SCODE SA2Video::BltComplete(GPEBltParms *pBltParms)
{
#ifdef DO_DISPPERF
DispPerfEnd(0);
#endif
return (S_OK);
}
int SA2Video::InVBlank(void)
{
#ifdef DD_ENABLE
static BOOL value = FALSE;
DEBUGMSG (GPE_ZONE_INIT, (TEXT("SA2Video::InVBlank\r\n")));
value = !value;
return (value);
#else
return (0);
#endif
}
SCODE SA2Video::SetPalette(const PALETTEENTRY *source,unsigned short firstEntry,unsigned short numEntries)
{
if (bpp==8)
{
if (firstEntry < 0 || firstEntry + numEntries > 256)
{
return (E_INVALIDARG);
}
DispDrvrSetPalette(source,firstEntry,numEntries);
}
return (S_OK);
}
ULONG *APIENTRY DrvGetMasks(DHPDEV dhpdev)
{
return (BitMasks);
}
ULONG SA2Video::DrvEscape(SURFOBJ *pso, ULONG iEsc, ULONG cjIn, PVOID pvIn, ULONG cjOut, PVOID pvOut)
{
int RetVal = 0; // default return value: "not supported"
DWORD EscapeFunction;
GXDeviceInfo *pgxoi;
switch (iEsc)
{
case QUERYESCSUPPORT:
EscapeFunction = *(DWORD *)pvIn;
if ((EscapeFunction == GETVFRAMEPHYSICAL) ||
(EscapeFunction == GETVFRAMELEN) ||
(EscapeFunction == DISPLAYPAGE) ||
(EscapeFunction == GETPALETTERAMPHYSICAL) ||
(EscapeFunction == VERTICALBLANKINTERRUPT) ||
(EscapeFunction == OS_SCREENACCESS) ||
(EscapeFunction == SCROLL) ||
(EscapeFunction == GETGXINFO))
RetVal = 1;
break;
// Provide the mapped virtual address of the frame buffer ram
// for direct frame buffer manipulation.
case GETVFRAMEPHYSICAL:
if (cjIn < NUM_FRAME_BUFFERS)
{
ASSERT(gFrameBuffer);
// This works as long as the frame buffers are in a contiguous region.
*(DWORD *)pvOut = (ULONG)gFrameBuffer + cjIn * (DispDrvr_cdwStride * DispDrvr_cyScreen * 4);
RetVal = 1;
}
else
{
*(DWORD *)pvOut = NULL;
}
break;
// Provide the length of the frame buffer in bytes
case GETVFRAMELEN:
*(DWORD *)pvOut = (ULONG)DispDrvr_cdwStride * DispDrvr_cyScreen * 4;
RetVal = 1;
break;
// Instruct the driver to display a given page of video ram
// The application can implement page flipping by calling
// DISPLAYPAGE with alternating frame buffer IDs.
case DISPLAYPAGE:
DisplayPageBuffer(cjIn);
RetVal = 1;
break;
// Provide the mapped virtual address of the palette ram
// for direct palette buffer manipulation.
case GETPALETTERAMPHYSICAL:
*(DWORD *)pvOut = (ULONG)v_pPaletteBuffer;
RetVal = 1;
break;
case VERTICALBLANKINTERRUPT:
//fnVerticalBlankInterrupt = cjIn;
RetVal = 1;
break;
// Enable or disable the OS from writing to the frame buffer
// The graphics application will want to disable OS screen access
// so that GUI elements like the clock will not be drawn to the screen
// while displaying other pages of video memory. Currently, the OS draws
// to the active frame buffer - it's not restricted to frame buffer 0.
case OS_SCREENACCESS:
if (cjIn)
{
bAllowOSFrameBufferUpdates = TRUE;
}
else
{
bAllowOSFrameBufferUpdates = FALSE;
}
case SCROLL:
ScrollBuffer(cjIn);
break;
case GETGXINFO:
// Fill out the GAPI data structure. Assumes 16bpp or 8bpp, with RGB565 format.
// Must change cBPP and ffFormat fields to accomodate other formats.
// All of the button data that follows must be filled out to match the specific OEM device.
// The data that is used to fill out the data structure here is copied from
// the Microsoft example.
if ((cjOut >= sizeof(GXDeviceInfo)) && (pvOut != NULL) )
{
if (((GXDeviceInfo *) pvOut)->idVersion == kidVersion100)
{
pgxoi = (GXDeviceInfo *) pvOut;
pgxoi->idVersion = kidVersion100;
ASSERT(gFrameBuffer);
pgxoi->pvFrameBuffer = (void *)gFrameBuffer;
// cbStride reflects the physical properties of the display regardless of orientation.
// All displays currently supported on Lubbock are natively landscape mode displays
// with either 640 or 320 pixels per line. When the display has 640 pixels, and
// we're in 16Bpp mode, cbStride must be 1280. When the display has 320 pixels, and
// we're in 16Bpp mode, cbStride must be 640. Other pixel depths scale the same way.
if (((DispDrvr_cxScreen == 240) && (DispDrvr_cyScreen == 320)) ||
((DispDrvr_cxScreen == 320) && (DispDrvr_cyScreen == 240)) )
{
if (bpp == 16)
{
pgxoi->cbStride = 640;
pgxoi->cBPP = 16;
}
if (bpp == 8)
{
pgxoi->cbStride = 320;
pgxoi->cBPP = 16;
}
}
if (((DispDrvr_cxScreen == 480) && (DispDrvr_cyScreen == 640)) ||
((DispDrvr_cxScreen == 640) && (DispDrvr_cyScreen == 480)) )
{
if (bpp == 16)
{
pgxoi->cbStride = 1280;
pgxoi->cBPP = 16;
}
if (bpp == 8)
{
pgxoi->cbStride = 640;
pgxoi->cBPP = 16;
}
}
pgxoi->cxWidth = DispDrvr_cxScreen;
pgxoi->cyHeight = DispDrvr_cyScreen;
if (DispDrvr_cxScreen > DispDrvr_cyScreen)
pgxoi->ffFormat= kfDirect565;
else
pgxoi->ffFormat= kfLandscape | kfDirect565; // Set the kfLandscape flag for Portrait mode only.
pgxoi->vkButtonUpPortrait = VK_UP;
pgxoi->vkButtonUpLandscape = 0xC3;
pgxoi->ptButtonUp.x = -50;
pgxoi->ptButtonUp.y = 0;
pgxoi->vkButtonDownPortrait = VK_DOWN;
pgxoi->vkButtonDownLandscape = 0xC4;
pgxoi->ptButtonDown.x = -50;
pgxoi->ptButtonDown.y = 30;
pgxoi->vkButtonLeftPortrait = 0xC2;
pgxoi->vkButtonLeftLandscape = VK_DOWN;
pgxoi->ptButtonLeft.x = 25;
pgxoi->ptButtonLeft.y = 400;
pgxoi->vkButtonRightPortrait = 0xC3;
pgxoi->vkButtonRightLandscape = VK_UP;
pgxoi->ptButtonRight.x = 90;
pgxoi->ptButtonRight.y = 410;
pgxoi->vkButtonAPortrait = 0xC4;
pgxoi->vkButtonALandscape = 0xC2;
pgxoi->ptButtonA.x = 150;
pgxoi->ptButtonA.y = 410;
pgxoi->vkButtonBPortrait = 0xC5;
pgxoi->vkButtonBLandscape = 0xC5;
pgxoi->ptButtonB.x = 220;
pgxoi->ptButtonB.y = 400;
pgxoi->vkButtonCPortrait = VK_ESCAPE;
pgxoi->vkButtonCLandscape = VK_ESCAPE;
pgxoi->ptButtonC.x = -50;
pgxoi->ptButtonC.y = 100;
pgxoi->vkButtonStartPortrait = VK_F23;
pgxoi->vkButtonStartLandscape = VK_F23;
pgxoi->ptButtonStart.x = -50;
pgxoi->ptButtonStart.y = 15;
pgxoi->pvReserved1 = (void *) 0;
pgxoi->pvReserved2 = (void *) 0;
RetVal = 1;
}
else
{
SetLastError (ERROR_INVALID_PARAMETER);
RetVal = -1;
}
}
else
{
SetLastError (ERROR_INVALID_PARAMETER);
RetVal = -1;
}
break;
default:
RetVal = 0;
break;
}
return (RetVal);
}
void SA2Video::ContrastCmd(ULONG cjIn, PVOID pvIn, ULONG cjOut, PVOID pvOut)
{
}
#ifndef DD_ENABLE
void RegisterDDHALAPI()
{
; // No DDHAL support in wrapper
}
#endif
#ifdef DD_ENABLE
void SA2Video::GetVirtualVideoMemory(unsigned long *virtualMemoryBase, unsigned long *videoMemorySize)
{
DEBUGMSG (GPE_ZONE_INIT, (TEXT("GPEFlat::GetVirtualVideoMemory\r\n")));
if (!gUseDispDrvrPhysicalFrameBuffer)
{
*virtualMemoryBase = (unsigned)m_pPrimarySurface->Buffer();
*videoMemorySize = (unsigned)(m_pPrimarySurface->Stride()*m_pPrimarySurface->Height());
}
else
{
*virtualMemoryBase = (unsigned)gFrameBuffer;
*videoMemorySize = 640*480*2*2;
}
}
#endif
#ifdef DD_ENABLE
SCODE
SA2Video::AllocSurface(DDGPESurf **ppSurf, int width, int height, EGPEFormat format, EDDGPEPixelFormat pixelFormat, int surfaceFlags)
{
if (surfaceFlags & GPE_REQUIRE_VIDEO_MEMORY)
{
*ppSurf = (DDGPESurf *)NULL;
RETAILMSG (1, (L"AllocSurface - Out of Memory 3\n"));
return (E_OUTOFMEMORY);
}
// Allocate from system memory
RETAILMSG(0, (TEXT("Creating a GPESurf in system memory. EGPEFormat = %d\r\n"), (int) format));
{
DWORD bpp = EGPEFormatToBpp[format];
DWORD stride = ((bpp * width + 31) >> 5) << 2;
DWORD nSurfaceBytes = stride * height;
*ppSurf = new DDGPESurf(width, height, stride, format, pixelFormat);
}
if (*ppSurf != NULL)
{
// check we allocated bits succesfully
if (((*ppSurf)->Buffer()) == NULL)
{
delete *ppSurf;
}
else
{
return (S_OK);
}
}
RETAILMSG (1, (L"AllocSurface - Out of Memory 4\n"));
return (E_OUTOFMEMORY);
}
#endif
#if 0
void SA2Video::SetVisibleSurface( GPESurf *pTempSurf, BOOL bWaitForVBlank)
{
GPEFlatSurf *pSurf = (GPEFlatSurf *) pTempSurf;
// if(bWaitForVBlank)
// {
// WAIT_FOR_VBLANK;
// }
// // set CRT memory offset without changing CRT pitch
// _memwD_reg(CRTC_OFF_PITCH, (_memrD_reg(CRTC_OFF_PITCH) & 0xffc00000) | ((pSurf->Stride() * pSurf->Top()) >> 3));
}
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -