OpenGL: Cleanups

stable-5.2
Günther Brammer 2009-10-26 00:05:16 +01:00
parent e592ca643c
commit 75ae48f984
3 changed files with 10 additions and 37 deletions

View File

@ -589,7 +589,6 @@ bool CStdGL::CreatePrimarySurfaces(bool Playermode, unsigned int iXRes, unsigned
// create lpPrimary and lpBack (used in first context selection)
lpPrimary=lpBack=new CSurface();
lpPrimary->fPrimary=true;
lpPrimary->AttachSfc(NULL, iXRes, iYRes);
lpPrimary->byBytesPP=byByteCnt;
@ -791,8 +790,6 @@ bool CStdGL::RestoreDeviceObjects()
InvalidateDeviceObjects();
// restore primary/back
RenderTarget=lpPrimary;
//lpPrimary->AttachSfc(NULL);
lpPrimary->byBytesPP=byByteCnt;
// set states
Active = pCurrCtx ? (pCurrCtx->Select()) : MainCtx.Select();
@ -954,8 +951,6 @@ void CStdGL::TaskOut()
// deactivate
// backup textures
if (pTexMgr && fFullscreen) pTexMgr->IntLock();
// shutdown gl
InvalidateDeviceObjects();
if (pCurrCtx) pCurrCtx->Deselect();
}
@ -965,14 +960,12 @@ void CStdGL::TaskIn()
//if (!DeviceReady()) MainCtx.Init(pWindow, pApp);
// restore textures
if (pTexMgr && fFullscreen) pTexMgr->IntUnlock();
// restore device stuff
RestoreDeviceObjects();
}
bool CStdGL::OnResolutionChanged(unsigned int iXRes, unsigned int iYRes)
{
InvalidateDeviceObjects();
RestoreDeviceObjects();
lpPrimary->AttachSfc(NULL, iXRes, iYRes);
lpPrimary->byBytesPP=byByteCnt;
// Re-create primary clipper to adapt to new size.
CreatePrimaryClipper(iXRes, iYRes);
return true;

View File

@ -447,25 +447,23 @@ bool CSurface::SetAsClrByOwnerOf(CSurface *pOfSurface)
}*/
#endif
#ifdef USE_DIRECTX
bool CSurface::AttachSfc(IDirect3DSurface9 *sfcSurface, unsigned int iXRes, unsigned int iYRes)
{
Clear(); Default();
// store surface
fPrimary=true;
#ifdef USE_DIRECTX
if (pD3D)
{
// store surface
pSfc=sfcSurface;
Attached=true;
}
fPrimary=true;
// get size
if (pD3D)
{
// get size
D3DSURFACE_DESC desc;
if (pSfc->GetDesc(&desc) != D3D_OK) return false;
Wdt=desc.Width; Hgt=desc.Height;
}
else if (lpDDraw && lpDDraw->pApp)
else
#endif
{
// primary surface: use application size
Wdt = iXRes;
@ -475,22 +473,6 @@ bool CSurface::AttachSfc(IDirect3DSurface9 *sfcSurface, unsigned int iXRes, unsi
NoClip();
return true;
}
#else
bool CSurface::AttachSfc(void *sfcSurface, unsigned int iXRes, unsigned int iYRes)
{
Clear(); Default();
fPrimary=true;
if (lpDDraw && lpDDraw->pApp)
{
// use application size
Wdt = iXRes;
Hgt = iYRes;
}
// reset clipping
NoClip();
return true;
}
#endif
#ifdef USE_DIRECTX
IDirect3DSurface9 *CSurface::GetSurface()

View File

@ -28,6 +28,8 @@
#ifdef USE_DIRECTX
#include <d3d9.h>
#else
typedef void* IDirect3DSurface9;
#endif
#ifdef USE_GL
@ -235,11 +237,7 @@ class CSurface
bool CreatePrimaryGLTextures(); // create primary textures from back buffer
#endif
bool Attach(CSurface *sfcSurface);
#ifdef USE_DIRECTX
bool AttachSfc(IDirect3DSurface9 *sfcSurface, unsigned int iXRes, unsigned int iYRes); // wdt and hgt not assigned in DirectX
#else
bool AttachSfc(void *sfcSurface, unsigned int iXRes, unsigned int iYRes);
#endif
void Clear();
void Default();
void Clip(int iX, int iY, int iX2, int iY2);