diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2016-02-15 08:09:50 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2016-02-15 08:09:50 +0100 |
commit | 80bf4bfe3df425962192118d4357acc144f6aef8 (patch) | |
tree | 79e4b6a00d6bf68be62fe157878f38dcd782a475 /src/plugins/platforms/winrt/qwinrtintegration.cpp | |
parent | ac8a3b948da1980bc59bae3fc76d20b5b45662a0 (diff) | |
parent | 8c2b4266002736da499d169a0da187e5cdc5381a (diff) |
Merge remote-tracking branch 'origin/5.6.0' into 5.6
Change-Id: I0b190005377a23a91da3563428e223b8a3b18333
Diffstat (limited to 'src/plugins/platforms/winrt/qwinrtintegration.cpp')
-rw-r--r-- | src/plugins/platforms/winrt/qwinrtintegration.cpp | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/src/plugins/platforms/winrt/qwinrtintegration.cpp b/src/plugins/platforms/winrt/qwinrtintegration.cpp index 2281bf56cc..9dac667ce5 100644 --- a/src/plugins/platforms/winrt/qwinrtintegration.cpp +++ b/src/plugins/platforms/winrt/qwinrtintegration.cpp @@ -45,12 +45,17 @@ #include "qwinrtfontdatabase.h" #include "qwinrttheme.h" -#include <QtGui/QSurface> +#include <QtGui/QOffscreenSurface> #include <QtGui/QOpenGLContext> -#include <qfunctions_winrt.h> +#include <QtGui/QSurface> +#include <QtPlatformSupport/private/qeglpbuffer_p.h> +#include <qpa/qwindowsysteminterface.h> +#include <qpa/qplatformwindow.h> #include <qpa/qplatformoffscreensurface.h> +#include <qfunctions_winrt.h> + #include <functional> #include <wrl.h> #include <windows.ui.xaml.h> @@ -385,11 +390,20 @@ HRESULT QWinRTIntegration::onResume(IInspectable *, IInspectable *) QPlatformOffscreenSurface *QWinRTIntegration::createPlatformOffscreenSurface(QOffscreenSurface *surface) const { - // This is only used for shutdown of applications. - // In case we do not return an empty surface the scenegraph will try - // to create a new native window during application exit causing crashes - // or assertions. - return new QPlatformOffscreenSurface(surface); + QEGLPbuffer *pbuffer = nullptr; + HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([&pbuffer, surface]() { + pbuffer = new QEGLPbuffer(QWinRTEGLContext::display(), surface->requestedFormat(), surface); + return S_OK; + }); + if (hr == UI_E_WINDOW_CLOSED) { + // This is only used for shutdown of applications. + // In case we do not return an empty surface the scenegraph will try + // to create a new native window during application exit causing crashes + // or assertions. + return new QPlatformOffscreenSurface(surface); + } + + return pbuffer; } |