summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/qwindowsglcontext.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/windows/qwindowsglcontext.cpp')
-rw-r--r--src/plugins/platforms/windows/qwindowsglcontext.cpp46
1 files changed, 23 insertions, 23 deletions
diff --git a/src/plugins/platforms/windows/qwindowsglcontext.cpp b/src/plugins/platforms/windows/qwindowsglcontext.cpp
index 21cb794196..e95eaef420 100644
--- a/src/plugins/platforms/windows/qwindowsglcontext.cpp
+++ b/src/plugins/platforms/windows/qwindowsglcontext.cpp
@@ -322,7 +322,7 @@ static inline bool
static void describeFormats(HDC hdc)
{
- const int pfiMax = DescribePixelFormat(hdc, 0, 0, NULL);
+ const int pfiMax = DescribePixelFormat(hdc, 0, 0, nullptr);
for (int i = 0; i < pfiMax; i++) {
PIXELFORMATDESCRIPTOR pfd;
initPixelFormatDescriptor(&pfd);
@@ -335,7 +335,7 @@ static void describeFormats(HDC hdc)
namespace GDI {
static QSurfaceFormat
qSurfaceFormatFromPixelFormat(const PIXELFORMATDESCRIPTOR &pfd,
- QWindowsOpenGLAdditionalFormat *additionalIn = 0)
+ QWindowsOpenGLAdditionalFormat *additionalIn = nullptr)
{
QSurfaceFormat format;
format.setRenderableType(QSurfaceFormat::OpenGL);
@@ -437,7 +437,7 @@ static int choosePixelFormat(HDC hdc, const QSurfaceFormat &format,
return pixelFormat;
}
// 2) No matching format found, manual search loop.
- const int pfiMax = DescribePixelFormat(hdc, 0, 0, NULL);
+ const int pfiMax = DescribePixelFormat(hdc, 0, 0, nullptr);
int bestScore = -1;
int bestPfi = -1;
const bool stereoRequested = format.stereo();
@@ -479,7 +479,7 @@ static inline HGLRC createContext(HDC hdc, HGLRC shared)
HGLRC result = QOpenGLStaticContext::opengl32.wglCreateContext(hdc);
if (!result) {
qErrnoWarning("%s: wglCreateContext failed.", __FUNCTION__);
- return 0;
+ return nullptr;
}
if (shared && !QOpenGLStaticContext::opengl32.wglShareLists(shared, result))
qErrnoWarning("%s: wglShareLists() failed.", __FUNCTION__);
@@ -590,7 +590,7 @@ static int choosePixelFormat(HDC hdc,
uint numFormats = 0;
while (true) {
const bool valid =
- staticContext.wglChoosePixelFormatARB(hdc, iAttributes, 0, 1,
+ staticContext.wglChoosePixelFormatARB(hdc, iAttributes, nullptr, 1,
&pixelFormat, &numFormats)
&& numFormats >= 1;
if (valid || (!sampleBuffersRequested && !srgbRequested))
@@ -646,7 +646,7 @@ static int choosePixelFormat(HDC hdc,
static QSurfaceFormat
qSurfaceFormatFromHDC(const QOpenGLStaticContext &staticContext,
HDC hdc, int pixelFormat,
- QWindowsOpenGLAdditionalFormat *additionalIn = 0)
+ QWindowsOpenGLAdditionalFormat *additionalIn = nullptr)
{
enum { attribSize = 42 };
@@ -720,12 +720,12 @@ static HGLRC createContext(const QOpenGLStaticContext &staticContext,
HDC hdc,
const QSurfaceFormat &format,
const QWindowsOpenGLAdditionalFormat &,
- HGLRC shared = 0)
+ HGLRC shared = nullptr)
{
enum { attribSize = 11 };
if (!staticContext.hasExtensions())
- return 0;
+ return nullptr;
int attributes[attribSize];
int attribIndex = 0;
std::fill(attributes, attributes + attribSize, int(0));
@@ -797,14 +797,14 @@ static inline HWND createDummyGLWindow()
{
return QWindowsContext::instance()->
createDummyWindow(QStringLiteral("QtOpenGLDummyWindow"),
- L"OpenGLDummyWindow", 0, WS_OVERLAPPED | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
+ L"OpenGLDummyWindow", nullptr, WS_OVERLAPPED | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
}
// Create a dummy GL context (see QOpenGLTemporaryContext).
static inline HGLRC createDummyGLContext(HDC dc)
{
if (!dc)
- return 0;
+ return nullptr;
PIXELFORMATDESCRIPTOR pixelFormDescriptor;
initPixelFormatDescriptor(&pixelFormDescriptor);
pixelFormDescriptor.dwFlags = PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW | PFD_GENERIC_FORMAT;
@@ -813,16 +813,16 @@ static inline HGLRC createDummyGLContext(HDC dc)
const int pixelFormat = ChoosePixelFormat(dc, &pixelFormDescriptor);
if (!pixelFormat) {
qErrnoWarning("%s: ChoosePixelFormat failed.", __FUNCTION__);
- return 0;
+ return nullptr;
}
if (!QOpenGLStaticContext::opengl32.setPixelFormat(dc, pixelFormat, &pixelFormDescriptor)) {
qErrnoWarning("%s: SetPixelFormat failed.", __FUNCTION__);
- return 0;
+ return nullptr;
}
HGLRC rc = QOpenGLStaticContext::opengl32.wglCreateContext(dc);
if (!rc) {
qErrnoWarning("%s: wglCreateContext failed.", __FUNCTION__);
- return 0;
+ return nullptr;
}
return rc;
}
@@ -1002,7 +1002,7 @@ QOpenGLStaticContext *QOpenGLStaticContext::create(bool softwareRendering)
{
if (!opengl32.init(softwareRendering)) {
qWarning("Failed to load and resolve WGL/OpenGL functions");
- return 0;
+ return nullptr;
}
// We need a current context for wglGetProcAdress()/getGLString() to work.
@@ -1033,12 +1033,12 @@ QWindowsGLContext::QWindowsGLContext(QOpenGLStaticContext *staticContext,
QOpenGLContext *context) :
m_staticContext(staticContext),
m_context(context),
- m_renderingContext(0),
+ m_renderingContext(nullptr),
m_pixelFormat(0),
m_extensionsUsed(false),
m_swapInterval(-1),
m_ownsContext(true),
- m_getGraphicsResetStatus(0),
+ m_getGraphicsResetStatus(nullptr),
m_lost(false)
{
if (!m_staticContext) // Something went very wrong. Stop here, isValid() will return false.
@@ -1081,7 +1081,7 @@ QWindowsGLContext::QWindowsGLContext(QOpenGLStaticContext *staticContext,
if (ok)
m_ownsContext = false;
else
- m_renderingContext = 0;
+ m_renderingContext = nullptr;
return;
}
@@ -1105,8 +1105,8 @@ QWindowsGLContext::QWindowsGLContext(QOpenGLStaticContext *staticContext,
// Create a dummy one as we are not associated with a window yet.
// Try to find a suitable pixel format using preferably ARB extensions
// (default to GDI) and store that.
- HWND dummyWindow = 0;
- HDC hdc = 0;
+ HWND dummyWindow = nullptr;
+ HDC hdc = nullptr;
bool tryExtensions = false;
int obtainedSwapInterval = -1;
do {
@@ -1163,7 +1163,7 @@ QWindowsGLContext::QWindowsGLContext(QOpenGLStaticContext *staticContext,
break;
}
// Create context with sharing, again preferably using ARB.
- HGLRC sharingRenderingContext = 0;
+ HGLRC sharingRenderingContext = nullptr;
if (const QPlatformOpenGLContext *sc = context->shareHandle())
sharingRenderingContext = static_cast<const QWindowsGLContext *>(sc)->renderingContext();
@@ -1190,7 +1190,7 @@ QWindowsGLContext::QWindowsGLContext(QOpenGLStaticContext *staticContext,
// Make the HGLRC retrievable via QOpenGLContext::nativeHandle().
// Do not provide the window since it is the dummy one and it is about to disappear.
if (m_renderingContext)
- context->setNativeHandle(QVariant::fromValue<QWGLNativeContext>(QWGLNativeContext(m_renderingContext, 0)));
+ context->setNativeHandle(QVariant::fromValue<QWGLNativeContext>(QWGLNativeContext(m_renderingContext, nullptr)));
if (hdc)
ReleaseDC(dummyWindow, hdc);
@@ -1281,7 +1281,7 @@ static inline const QOpenGLContextData *
if (e.hwnd == hwnd)
return &e;
}
- return 0;
+ return nullptr;
}
void QWindowsGLContext::swapBuffers(QPlatformSurface *surface)
@@ -1365,7 +1365,7 @@ void QWindowsGLContext::doneCurrent()
if (QWindowsContext::verbose > 1)
qCDebug(lcQpaGl) << __FUNCTION__ << this << m_windowContexts.size() << "contexts";
#endif // DEBUG_GL
- QOpenGLStaticContext::opengl32.wglMakeCurrent(0, 0);
+ QOpenGLStaticContext::opengl32.wglMakeCurrent(nullptr, nullptr);
releaseDCs();
}