diff options
author | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2012-05-23 15:07:06 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-31 09:13:01 +0200 |
commit | e7f1106edb1ac37d92d7851c44cd8d99f68eaaf4 (patch) | |
tree | b4d01b3ca52a0ff8a8ec0aa1803beeac78196508 /src/plugins/platforms/windows/qwindowswindow.cpp | |
parent | b63e101a90b677dcb192214aef35a107620c5f3c (diff) |
Windows: Add ANGLE support.
- Add QWindowsEGLContext usable for ANGLE and Windows CE.
- Add QWindowsEGLStaticContext containing the display
for resource cleanup.
- Add EGLSurface to QWindowsWindow.
- Add a -angle option specifying the path to the external
ANGLE installation to configure, add libraries to
the mkspecs.
Initial-patch-by: Jabot Corentin <corentinjabot@gmail.com>
Task-number: QTBUG-24207
Change-Id: I5f80b1efb6996da7c5d70aa3720f7801c9e4c6af
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Reviewed-by: Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowswindow.cpp')
-rw-r--r-- | src/plugins/platforms/windows/qwindowswindow.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 74da8c9265..fe38e60697 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -46,6 +46,10 @@ #include "qwindowsscreen.h" #include "qwindowscursor.h" +#ifdef QT_OPENGL_ES_2 +# include "qwindowseglcontext.h" +#endif + #include <QtGui/QGuiApplication> #include <QtGui/QScreen> #include <QtGui/QWindow> @@ -644,6 +648,9 @@ QWindowsWindow::QWindowsWindow(QWindow *aWindow, const WindowData &data) : m_cursor(QWindowsScreen::screenOf(aWindow)->windowsCursor()->standardWindowCursor()), m_dropTarget(0), m_savedStyle(0) +#ifdef QT_OPENGL_ES_2 + , m_eglSurface(0) +#endif { if (aWindow->surfaceType() == QWindow::OpenGLSurface) setFlag(OpenGLSurface); @@ -676,6 +683,15 @@ void QWindowsWindow::destroyWindow() if (m_data.hwnd) { // Stop event dispatching before Window is destroyed. unregisterDropSite(); QWindowsContext::instance()->removeWindow(m_data.hwnd); +#ifdef QT_OPENGL_ES_2 + if (m_eglSurface) { + if (QWindowsContext::verboseGL) + qDebug("%s: Freeing EGL surface %p, this = %p", + __FUNCTION__, m_eglSurface, this); + eglDestroySurface(m_staticEglContext->display(), m_eglSurface); + m_eglSurface = 0; + } +#endif if (m_data.hwnd != GetDesktopWindow()) DestroyWindow(m_data.hwnd); m_data.hwnd = 0; @@ -1454,6 +1470,23 @@ void QWindowsWindow::setEnabled(bool enabled) setStyle(newStyle); } +#ifdef QT_OPENGL_ES_2 +EGLSurface QWindowsWindow::ensureEglSurfaceHandle(const QWindowsWindow::QWindowsEGLStaticContextPtr &staticContext, EGLConfig config) +{ + if (!m_eglSurface) { + m_staticEglContext = staticContext; + m_eglSurface = eglCreateWindowSurface(staticContext->display(), config, (EGLNativeWindowType)m_data.hwnd, NULL); + if (m_eglSurface == EGL_NO_SURFACE) + qWarning("%s: Could not create the egl surface (eglCreateWindowSurface failed): error = 0x%x\n", + Q_FUNC_INFO, eglGetError()); + if (QWindowsContext::verboseGL) + qDebug("%s: Created EGL surface %p, this = %p", + __FUNCTION__, m_eglSurface, this); + } + return m_eglSurface; +} +#endif // QT_OPENGL_ES_2 + QByteArray QWindowsWindow::debugWindowFlags(Qt::WindowFlags wf) { const int iwf = int(wf); |