summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/android/qandroidplatformintegration.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/android/qandroidplatformintegration.cpp')
-rw-r--r--src/plugins/platforms/android/qandroidplatformintegration.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/plugins/platforms/android/qandroidplatformintegration.cpp b/src/plugins/platforms/android/qandroidplatformintegration.cpp
index de9e27e595..173431208f 100644
--- a/src/plugins/platforms/android/qandroidplatformintegration.cpp
+++ b/src/plugins/platforms/android/qandroidplatformintegration.cpp
@@ -65,6 +65,7 @@
#include "qandroidplatformservices.h"
#include "qandroidplatformtheme.h"
#include "qandroidsystemlocale.h"
+#include "qandroidplatformoffscreensurface.h"
#include <QtPlatformHeaders/QEGLNativeContext>
@@ -262,12 +263,20 @@ QPlatformOffscreenSurface *QAndroidPlatformIntegration::createPlatformOffscreenS
{
if (!QtAndroid::activity())
return nullptr;
+
QSurfaceFormat format(surface->requestedFormat());
format.setAlphaBufferSize(8);
format.setRedBufferSize(8);
format.setGreenBufferSize(8);
format.setBlueBufferSize(8);
+ if (surface->nativeHandle()) {
+ // Adopt existing offscreen Surface
+ // The expectation is that nativeHandle is an ANativeWindow* representing
+ // an android.view.Surface
+ return new QAndroidPlatformOffscreenSurface(m_eglDisplay, format, surface);
+ }
+
return new QEGLPbuffer(m_eglDisplay, format, surface);
}