diff options
Diffstat (limited to 'src/plugins/platforms/winrt/qwinrtwindow.cpp')
-rw-r--r-- | src/plugins/platforms/winrt/qwinrtwindow.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/plugins/platforms/winrt/qwinrtwindow.cpp b/src/plugins/platforms/winrt/qwinrtwindow.cpp index 5ff1c8bd19..c5b06a5d8a 100644 --- a/src/plugins/platforms/winrt/qwinrtwindow.cpp +++ b/src/plugins/platforms/winrt/qwinrtwindow.cpp @@ -88,6 +88,8 @@ public: QSurfaceFormat surfaceFormat; QString windowTitle; Qt::WindowState state; + EGLDisplay display; + EGLSurface surface; ComPtr<ISwapChainPanel> swapChainPanel; ComPtr<ICanvasStatics> canvas; @@ -100,6 +102,8 @@ QWinRTWindow::QWinRTWindow(QWindow *window) { Q_D(QWinRTWindow); + d->surface = EGL_NO_SURFACE; + d->display = EGL_NO_DISPLAY; d->screen = static_cast<QWinRTScreen *>(screen()); setWindowFlags(window->flags()); setWindowState(window->windowState()); @@ -170,6 +174,11 @@ QWinRTWindow::~QWinRTWindow() return S_OK; }); RETURN_VOID_IF_FAILED("Failed to completely destroy window resources, likely because the application is shutting down"); + + EGLBoolean value = eglDestroySurface(d->display, d->surface); + d->surface = EGL_NO_SURFACE; + if (value == EGL_FALSE) + qCritical("Failed to destroy EGL window surface: 0x%x", eglGetError()); } QSurfaceFormat QWinRTWindow::format() const @@ -293,4 +302,26 @@ void QWinRTWindow::setWindowState(Qt::WindowState state) d->state = state; } +EGLSurface QWinRTWindow::eglSurface() const +{ + Q_D(const QWinRTWindow); + return d->surface; +} + +void QWinRTWindow::createEglSurface(EGLDisplay display, EGLConfig config) +{ + Q_D(QWinRTWindow); + if (d->surface == EGL_NO_SURFACE) { + d->display = display; + QEventDispatcherWinRT::runOnXamlThread([this, d, display, config]() { + d->surface = eglCreateWindowSurface(display, config, + reinterpret_cast<EGLNativeWindowType>(winId()), + nullptr); + if (d->surface == EGL_NO_SURFACE) + qCritical("Failed to create EGL window surface: 0x%x", eglGetError()); + return S_OK; + }); + } +} + QT_END_NAMESPACE |