1 | // Copyright (C) 2016 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 QQUICKRENDERCONTROL_H |
5 | #define QQUICKRENDERCONTROL_H |
6 | |
7 | #include <QtCore/qobject.h> |
8 | #include <QtQuick/qtquickglobal.h> |
9 | #include <QtGui/qimage.h> |
10 | |
11 | QT_BEGIN_NAMESPACE |
12 | |
13 | class QQuickWindow; |
14 | class QOpenGLContext; |
15 | class QQuickRenderControlPrivate; |
16 | class QThread; |
17 | class QRhi; |
18 | class QRhiCommandBuffer; |
19 | |
20 | class Q_QUICK_EXPORT QQuickRenderControl : public QObject |
21 | { |
22 | Q_OBJECT |
23 | |
24 | public: |
25 | explicit QQuickRenderControl(QObject *parent = nullptr); |
26 | ~QQuickRenderControl() override; |
27 | |
28 | void prepareThread(QThread *targetThread); |
29 | |
30 | void setSamples(int sampleCount); |
31 | int samples() const; |
32 | |
33 | bool initialize(); |
34 | |
35 | void invalidate(); |
36 | |
37 | void beginFrame(); |
38 | void endFrame(); |
39 | |
40 | void polishItems(); |
41 | bool sync(); |
42 | void render(); |
43 | |
44 | static QWindow *renderWindowFor(QQuickWindow *win, QPoint *offset = nullptr); |
45 | virtual QWindow *renderWindow(QPoint *offset) { Q_UNUSED(offset); return nullptr; } |
46 | |
47 | QQuickWindow *window() const; |
48 | |
49 | QRhi *rhi() const; |
50 | QRhiCommandBuffer *commandBuffer() const; |
51 | |
52 | protected: |
53 | explicit QQuickRenderControl(QQuickRenderControlPrivate &dd, QObject *parent = nullptr); |
54 | |
55 | Q_SIGNALS: |
56 | void renderRequested(); |
57 | void sceneChanged(); |
58 | |
59 | private: |
60 | Q_DECLARE_PRIVATE(QQuickRenderControl) |
61 | }; |
62 | |
63 | QT_END_NAMESPACE |
64 | |
65 | #endif // QQUICKRENDERCONTROL_H |
66 | |