diff options
author | Andy Nichols <nezticle@gmail.com> | 2016-12-06 22:36:30 +0100 |
---|---|---|
committer | Andy Nichols <andy.nichols@qt.io> | 2016-12-14 15:51:23 +0000 |
commit | 9d8db91ada0ab340ae781862f567c9b104e83c63 (patch) | |
tree | 9796e5b28a786a35567983c041869682b40b68c7 /src/plugins/platforms/android/qandroidplatformoffscreensurface.h | |
parent | b750a3786f42395f0cddd8ed8f92a2bcfda1b270 (diff) |
Android: Enable Adoption of ANativeWindow handle as a QOffscreenSurface
This is done by adding an API to QOffscreenSurface to enable setting a
native handle which can represent a native offscreen surface. When
using the TexureView it is necessary to render to SurfaceTexture objects
which are exposed as offscreen window surfaces. After wraping a
SurfaceTexture in a android.view.Surface object and passing it to C++
via the JNI, it is possible to get the needed ANativeWindow* handle
required to pass to eglCreateWindowSurface. So by setting this native
handle Qt can then render to this "native" offscreen surface.
Change-Id: If7fc5ac7ac588fe6c3a6fb883ea7e439d095470f
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
Diffstat (limited to 'src/plugins/platforms/android/qandroidplatformoffscreensurface.h')
-rw-r--r-- | src/plugins/platforms/android/qandroidplatformoffscreensurface.h | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/src/plugins/platforms/android/qandroidplatformoffscreensurface.h b/src/plugins/platforms/android/qandroidplatformoffscreensurface.h new file mode 100644 index 0000000000..461f949254 --- /dev/null +++ b/src/plugins/platforms/android/qandroidplatformoffscreensurface.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QANDROIDPLATFORMOFFSCREENSURFACETEXTURE_H +#define QANDROIDPLATFORMOFFSCREENSURFACETEXTURE_H + +#include <qpa/qplatformoffscreensurface.h> +#include <QtEglSupport/private/qeglplatformcontext_p.h> + +QT_BEGIN_NAMESPACE +class QOffscreenSurface; +class QAndroidPlatformOffscreenSurface : public QPlatformOffscreenSurface +{ +public: + QAndroidPlatformOffscreenSurface(EGLDisplay display, const QSurfaceFormat &format, + 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; } +private: + QSurfaceFormat m_format; + EGLDisplay m_display; + EGLSurface m_surface; +}; + +QT_END_NAMESPACE + +#endif // QANDROIDPLATFORMOFFSCREENSURFACETEXTURE_H |