| 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_P_H |
| 5 | #define QQUICKRENDERCONTROL_P_H |
| 6 | |
| 7 | // |
| 8 | // W A R N I N G |
| 9 | // ------------- |
| 10 | // |
| 11 | // This file is not part of the Qt API. It exists purely as an |
| 12 | // implementation detail. This header file may change from version to |
| 13 | // version without notice, or even be removed. |
| 14 | // |
| 15 | // We mean it. |
| 16 | // |
| 17 | |
| 18 | #include "qquickrendercontrol.h" |
| 19 | #include <QtQuick/private/qsgcontext_p.h> |
| 20 | |
| 21 | QT_BEGIN_NAMESPACE |
| 22 | |
| 23 | class QRhi; |
| 24 | class QRhiCommandBuffer; |
| 25 | class QOffscreenSurface; |
| 26 | class QQuickGraphicsConfiguration; |
| 27 | |
| 28 | class Q_QUICK_EXPORT QQuickRenderControlPrivate : public QObjectPrivate |
| 29 | { |
| 30 | public: |
| 31 | Q_DECLARE_PUBLIC(QQuickRenderControl) |
| 32 | |
| 33 | enum FrameStatus { |
| 34 | NotRecordingFrame, |
| 35 | RecordingFrame, |
| 36 | DeviceLostInBeginFrame, |
| 37 | ErrorInBeginFrame |
| 38 | }; |
| 39 | |
| 40 | QQuickRenderControlPrivate(QQuickRenderControl *renderControl); |
| 41 | |
| 42 | static QQuickRenderControlPrivate *get(QQuickRenderControl *renderControl) { |
| 43 | return renderControl->d_func(); |
| 44 | } |
| 45 | |
| 46 | static bool isRenderWindowFor(QQuickWindow *quickWin, const QWindow *renderWin); |
| 47 | virtual bool isRenderWindow(const QWindow *w); |
| 48 | |
| 49 | static void cleanup(); |
| 50 | |
| 51 | void windowDestroyed(); |
| 52 | |
| 53 | void update(); |
| 54 | void maybeUpdate(); |
| 55 | |
| 56 | bool initRhi(); |
| 57 | void resetRhi(const QQuickGraphicsConfiguration &config); |
| 58 | |
| 59 | QImage grab(); |
| 60 | |
| 61 | QQuickRenderControl *q; |
| 62 | bool initialized; |
| 63 | QQuickWindow *window; |
| 64 | static QSGContext *sg; |
| 65 | QSGRenderContext *rc; |
| 66 | QRhi *rhi; |
| 67 | bool ownRhi; |
| 68 | QRhiCommandBuffer *cb; |
| 69 | QOffscreenSurface *offscreenSurface; |
| 70 | int sampleCount; |
| 71 | FrameStatus frameStatus; |
| 72 | }; |
| 73 | |
| 74 | QT_END_NAMESPACE |
| 75 | |
| 76 | #endif // QQUICKRENDERCONTROL_P_H |
| 77 |
