summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/winrt/qwinrtintegration.cpp
diff options
context:
space:
mode:
authorMaurice Kalinowski <maurice.kalinowski@theqtcompany.com>2016-01-26 10:49:31 +0100
committerMaurice Kalinowski <maurice.kalinowski@theqtcompany.com>2016-01-26 14:04:43 +0000
commitba7f76dea029bc56288ecb46925f5104c6915a71 (patch)
treed478781b66bbc223a26685951db16c970abe48fa /src/plugins/platforms/winrt/qwinrtintegration.cpp
parenta1ba281a26d065d2e901b3a947a8517ec5790504 (diff)
winrt: Add support for offscreen surfaces
Previously offscreen surfaces were only needed to properly shutdown Qt Quick applications and the scene graph to have something to potentially render into but not show on the screen. However, Canvas3D requires a fully functional surface, preferably offscreen. Hence we use the QEGLPbuffer provided by eglconvenience in platformsupport. Task-number: QTBUG-50576 Change-Id: I1a32820bb2f2c6823be4e96dd92cf7965566f2c3 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@theqtcompany.com> Reviewed-by: Andrew Knight <andrew.knight@intopalo.com>
Diffstat (limited to 'src/plugins/platforms/winrt/qwinrtintegration.cpp')
-rw-r--r--src/plugins/platforms/winrt/qwinrtintegration.cpp28
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;
}