From fc4a73aa544bf03d881ddb7e2eb8ebd47d7da7b8 Mon Sep 17 00:00:00 2001 From: Assam Boudjelthia Date: Tue, 25 Aug 2020 11:32:58 +0300 Subject: Add QOffScreenSurface platform API abstraction MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This follows the work done in 6ff79478a44fce12ca18832a56db4a370a9ff417. The API is available by including qoffscreensurface.h, scoped in the QPlatformInterface namespace. The namespace exposes platform specific type-safe interfaces that provide: a) Factory functions for adopting native contexts, e.g. QAndroidPlatformOffscreenSurface::fromNative(ANativeWindow); b) Access to underlying native handles, e.g. surface->platformInterface() ->nativeSurface() Fixes: QTBUG-85874 Change-Id: I29c459866e0355a52320d5d473e8b147e050acb3 Reviewed-by: Tor Arne Vestbø --- .../platforms/android/qandroidplatformoffscreensurface.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/plugins/platforms/android/qandroidplatformoffscreensurface.h') diff --git a/src/plugins/platforms/android/qandroidplatformoffscreensurface.h b/src/plugins/platforms/android/qandroidplatformoffscreensurface.h index 033bc6a03f..3cfeab3bf2 100644 --- a/src/plugins/platforms/android/qandroidplatformoffscreensurface.h +++ b/src/plugins/platforms/android/qandroidplatformoffscreensurface.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. @@ -41,21 +41,26 @@ #define QANDROIDPLATFORMOFFSCREENSURFACETEXTURE_H #include -#include +#include + +#include QT_BEGIN_NAMESPACE class QOffscreenSurface; -class QAndroidPlatformOffscreenSurface : public QPlatformOffscreenSurface +class QAndroidPlatformOffscreenSurface : public QPlatformOffscreenSurface, + public QPlatformInterface::QAndroidPlatformOffscreenSurface { public: - QAndroidPlatformOffscreenSurface(EGLDisplay display, const QSurfaceFormat &format, - QOffscreenSurface *offscreenSurface); + QAndroidPlatformOffscreenSurface(ANativeWindow *nativeSurface, EGLDisplay display, QOffscreenSurface *offscreenSurface); ~QAndroidPlatformOffscreenSurface(); QSurfaceFormat format() const override { return m_format; } bool isValid() const override { return m_surface != EGL_NO_SURFACE; } EGLSurface surface() const { return m_surface; } + + ANativeWindow *nativeSurface() const override { return (ANativeWindow *)surface(); }; + private: QSurfaceFormat m_format; EGLDisplay m_display; -- cgit v1.2.3