summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/qwindowsopengltester.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2018-06-30 22:59:21 +0200
committerLiang Qi <liang.qi@qt.io>2018-07-02 11:23:45 +0200
commite3ed2281c0c891cf3b15c95f9f7cdae42e9f233a (patch)
treeaae8da6ce616eae02b69fb1fcdcb4383c8fe6811 /src/plugins/platforms/windows/qwindowsopengltester.cpp
parent3be141d5bc199080b524d8f6f5ce514e8f74d23a (diff)
parente75e4b39b78ba05ea2cd45dc96acf99fc89c5915 (diff)
Merge remote-tracking branch 'origin/5.11' into dev
Conflicts: src/plugins/platforms/cocoa/qnsview.mm src/plugins/platforms/cocoa/qnsview_dragging.mm src/plugins/platforms/ios/qiosinputcontext.mm src/plugins/platforms/xcb/qxcbconnection.cpp src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/plugins/platforms/xcb/qxcbwindow.cpp src/tools/androiddeployqt/main.cpp Was moved from qttools into qtbase in 5.11. So re-apply 32398e4d here. tests/auto/corelib/global/qlogging/test/test.pro tests/auto/corelib/global/qlogging/tst_qlogging.cpp tests/auto/corelib/io/qfile/tst_qfile.cpp tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp tests/auto/corelib/thread/qthreadstorage/test/test.pro tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp tests/auto/widgets/kernel/qapplication/test/test.pro Done-with: Gatis Paeglis <gatis.paeglis@qt.io> Done-with: MÃ¥rten Nordheim <marten.nordheim@qt.io> Done-with: Oliver Wolff <oliver.wolff@qt.io> Change-Id: Id970486c5315a1718c540f00deb2633533e8fc7b
Diffstat (limited to 'src/plugins/platforms/windows/qwindowsopengltester.cpp')
-rw-r--r--src/plugins/platforms/windows/qwindowsopengltester.cpp28
1 files changed, 19 insertions, 9 deletions
diff --git a/src/plugins/platforms/windows/qwindowsopengltester.cpp b/src/plugins/platforms/windows/qwindowsopengltester.cpp
index a90a44c4e1..c4ee820211 100644
--- a/src/plugins/platforms/windows/qwindowsopengltester.cpp
+++ b/src/plugins/platforms/windows/qwindowsopengltester.cpp
@@ -283,16 +283,21 @@ QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::supportedRenderers()
bool QWindowsOpenGLTester::testDesktopGL()
{
#if !defined(QT_NO_OPENGL)
+ typedef HGLRC (WINAPI *CreateContextType)(HDC);
+ typedef BOOL (WINAPI *DeleteContextType)(HGLRC);
+ typedef BOOL (WINAPI *MakeCurrentType)(HDC, HGLRC);
+ typedef PROC (WINAPI *WglGetProcAddressType)(LPCSTR);
+
HMODULE lib = 0;
HWND wnd = 0;
HDC dc = 0;
HGLRC context = 0;
LPCTSTR className = L"qtopengltest";
- HGLRC (WINAPI * CreateContext)(HDC dc) = 0;
- BOOL (WINAPI * DeleteContext)(HGLRC context) = 0;
- BOOL (WINAPI * MakeCurrent)(HDC dc, HGLRC context) = 0;
- PROC (WINAPI * WGL_GetProcAddress)(LPCSTR name) = 0;
+ CreateContextType CreateContext = nullptr;
+ DeleteContextType DeleteContext = nullptr;
+ MakeCurrentType MakeCurrent = nullptr;
+ WglGetProcAddressType WGL_GetProcAddress = nullptr;
bool result = false;
@@ -300,16 +305,20 @@ bool QWindowsOpenGLTester::testDesktopGL()
// This will typically fail on systems that do not have a real OpenGL driver.
lib = LoadLibraryA("opengl32.dll");
if (lib) {
- CreateContext = reinterpret_cast<HGLRC (WINAPI *)(HDC)>(::GetProcAddress(lib, "wglCreateContext"));
+ CreateContext = reinterpret_cast<CreateContextType>(
+ reinterpret_cast<QFunctionPointer>(::GetProcAddress(lib, "wglCreateContext")));
if (!CreateContext)
goto cleanup;
- DeleteContext = reinterpret_cast<BOOL (WINAPI *)(HGLRC)>(::GetProcAddress(lib, "wglDeleteContext"));
+ DeleteContext = reinterpret_cast<DeleteContextType>(
+ reinterpret_cast<QFunctionPointer>(::GetProcAddress(lib, "wglDeleteContext")));
if (!DeleteContext)
goto cleanup;
- MakeCurrent = reinterpret_cast<BOOL (WINAPI *)(HDC, HGLRC)>(::GetProcAddress(lib, "wglMakeCurrent"));
+ MakeCurrent = reinterpret_cast<MakeCurrentType>(
+ reinterpret_cast<QFunctionPointer>(::GetProcAddress(lib, "wglMakeCurrent")));
if (!MakeCurrent)
goto cleanup;
- WGL_GetProcAddress = reinterpret_cast<PROC (WINAPI *)(LPCSTR)>(::GetProcAddress(lib, "wglGetProcAddress"));
+ WGL_GetProcAddress = reinterpret_cast<WglGetProcAddressType>(
+ reinterpret_cast<QFunctionPointer>(::GetProcAddress(lib, "wglGetProcAddress")));
if (!WGL_GetProcAddress)
goto cleanup;
@@ -356,7 +365,8 @@ bool QWindowsOpenGLTester::testDesktopGL()
// Check the version. If we got 1.x then it's all hopeless and we can stop right here.
typedef const GLubyte * (APIENTRY * GetString_t)(GLenum name);
- GetString_t GetString = reinterpret_cast<GetString_t>(::GetProcAddress(lib, "glGetString"));
+ GetString_t GetString = reinterpret_cast<GetString_t>(
+ reinterpret_cast<QFunctionPointer>(::GetProcAddress(lib, "glGetString")));
if (GetString) {
if (const char *versionStr = reinterpret_cast<const char *>(GetString(GL_VERSION))) {
const QByteArray version(versionStr);