1 | // Copyright (C) 2020 The Qt Company Ltd. |
---|---|
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | #ifndef QOFFSCREENSURFACE_H |
5 | #define QOFFSCREENSURFACE_H |
6 | |
7 | #include <QtGui/qtguiglobal.h> |
8 | #include <QtCore/QObject> |
9 | #include <QtCore/qnativeinterface.h> |
10 | #include <QtGui/qsurface.h> |
11 | Q_MOC_INCLUDE(<QtGui/qscreen.h>) |
12 | |
13 | QT_BEGIN_NAMESPACE |
14 | |
15 | class QOffscreenSurfacePrivate; |
16 | |
17 | class QScreen; |
18 | class QPlatformOffscreenSurface; |
19 | |
20 | class Q_GUI_EXPORT QOffscreenSurface : public QObject, public QSurface |
21 | { |
22 | Q_OBJECT |
23 | Q_DECLARE_PRIVATE(QOffscreenSurface) |
24 | |
25 | public: |
26 | explicit QOffscreenSurface(QScreen *screen = nullptr, QObject *parent = nullptr); |
27 | ~QOffscreenSurface(); |
28 | |
29 | SurfaceType surfaceType() const override; |
30 | |
31 | void create(); |
32 | void destroy(); |
33 | |
34 | bool isValid() const; |
35 | |
36 | void setFormat(const QSurfaceFormat &format); |
37 | QSurfaceFormat format() const override; |
38 | QSurfaceFormat requestedFormat() const; |
39 | |
40 | QSize size() const override; |
41 | |
42 | QScreen *screen() const; |
43 | void setScreen(QScreen *screen); |
44 | |
45 | QPlatformOffscreenSurface *handle() const; |
46 | |
47 | QT_DECLARE_NATIVE_INTERFACE_ACCESSOR(QOffscreenSurface) |
48 | |
49 | Q_SIGNALS: |
50 | void screenChanged(QScreen *screen); |
51 | |
52 | private Q_SLOTS: |
53 | void screenDestroyed(QObject *screen); |
54 | |
55 | private: |
56 | |
57 | QPlatformSurface *surfaceHandle() const override; |
58 | |
59 | Q_DISABLE_COPY(QOffscreenSurface) |
60 | }; |
61 | |
62 | QT_END_NAMESPACE |
63 | |
64 | #include <QtGui/qoffscreensurface_platform.h> |
65 | |
66 | #endif // QOFFSCREENSURFACE_H |
67 |