win32: Move PIXELFORMATDESCRIPTOR from C4AbstractApp to CStdGLCtx

That is the only user.
objectmenu
Günther Brammer 2016-01-22 23:21:41 +01:00
parent 34a720ca54
commit 7167459f67
3 changed files with 3 additions and 6 deletions

View File

@ -71,6 +71,7 @@ void CStdGLCtx::Reinitialize()
#include <GL/wglew.h>
decltype(CStdGLCtx::hrc) CStdGLCtx::hrc = 0;
static PIXELFORMATDESCRIPTOR pfd; // desired pixel format
// Enumerate available pixel formats. Choose the best pixel format in
// terms of color and depth buffer bits and then return all formats with
@ -301,7 +302,7 @@ bool CStdGLCtx::Init(C4Window * pWindow, C4AbstractApp *pApp)
}
if (hrc)
{
SetPixelFormat(hDC, pGL->iPixelFormat, &pApp->GetPFD());
SetPixelFormat(hDC, pGL->iPixelFormat, &pfd);
}
else
{
@ -311,13 +312,13 @@ bool CStdGLCtx::Init(C4Window * pWindow, C4AbstractApp *pApp)
if((pixel_format = GetPixelFormatForMS(hDC, 0)) != 0)
Config.Graphics.MultiSampling = 0;
PIXELFORMATDESCRIPTOR pfd;
if (!pixel_format)
{
pGL->Error(" gl: Error choosing pixel format");
}
else
{
ZeroMemory(&pfd, sizeof(pfd)); pfd.nSize = sizeof(pfd);
if(!DescribePixelFormat(hDC, pixel_format, sizeof(pfd), &pfd))
{
pGL->Error(" gl: Error describing chosen pixel format");
@ -355,7 +356,6 @@ bool CStdGLCtx::Init(C4Window * pWindow, C4AbstractApp *pApp)
}
pGL->iPixelFormat = pixel_format;
pApp->GetPFD() = pfd;
}
}
}

View File

@ -170,11 +170,9 @@ public:
private:
CStdMessageProc MessageProc;
public:
PIXELFORMATDESCRIPTOR &GetPFD() { return pfd; }
HMONITOR hMon; // monitor handle of used monitor
RECT MonitorRect; // output window rect
protected:
PIXELFORMATDESCRIPTOR pfd; // desired pixel format
DEVMODEW dspMode, OldDspMode;// display mode for fullscreen
#endif

View File

@ -802,7 +802,6 @@ C4AbstractApp::C4AbstractApp() :
Active(false), pWindow(NULL), fQuitMsgReceived(false),
hInstance(NULL), fDspModeSet(false)
{
ZeroMemory(&pfd, sizeof(pfd)); pfd.nSize = sizeof(pfd);
ZeroMemory(&dspMode, sizeof(dspMode)); dspMode.dmSize = sizeof(dspMode);
ZeroMemory(&OldDspMode, sizeof(OldDspMode)); OldDspMode.dmSize = sizeof(OldDspMode);
idMainThread = 0;