summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/android/qandroidplatformoffscreensurface.h
blob: a48a43ca98ab67eb77cae4c61fb23e535b020336 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright (C) 2020 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

#ifndef QANDROIDPLATFORMOFFSCREENSURFACETEXTURE_H
#define QANDROIDPLATFORMOFFSCREENSURFACETEXTURE_H

#include <qpa/qplatformoffscreensurface.h>
#include <QtGui/qoffscreensurface_platform.h>

#include <EGL/egl.h>

QT_BEGIN_NAMESPACE
class QOffscreenSurface;
class QAndroidPlatformOffscreenSurface : public QPlatformOffscreenSurface,
                                         public QNativeInterface::QAndroidOffscreenSurface
{
public:
    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;
    EGLSurface m_surface;
};

QT_END_NAMESPACE

#endif // QANDROIDPLATFORMOFFSCREENSURFACETEXTURE_H