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 QRENDERCAPTURE_P_H
5#define QRENDERCAPTURE_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 for the convenience
12// of other Qt classes. 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 <Qt3DRender/qrendercapture.h>
19#include <Qt3DRender/private/qframegraphnode_p.h>
20
21#include <QtCore/qmutex.h>
22
23QT_BEGIN_NAMESPACE
24
25namespace Qt3DRender {
26
27struct QRenderCaptureRequest
28{
29 int captureId;
30 QRect rect;
31};
32
33class QRenderCapturePrivate : public QFrameGraphNodePrivate
34{
35public:
36 QRenderCapturePrivate();
37 ~QRenderCapturePrivate();
38 QList<QRenderCaptureReply *> m_waitingReplies;
39 QMutex m_mutex;
40 mutable QList<QRenderCaptureRequest> m_pendingRequests;
41
42 QRenderCaptureReply *createReply(int captureId);
43 QRenderCaptureReply *takeReply(int captureId);
44 void setImage(QRenderCaptureReply *reply, const QImage &image);
45 void replyDestroyed(QRenderCaptureReply *reply);
46
47 Q_DECLARE_PUBLIC(QRenderCapture)
48};
49
50class QRenderCaptureReplyPrivate : public QObjectPrivate
51{
52public:
53 QRenderCaptureReplyPrivate();
54
55 QImage m_image;
56 int m_captureId;
57 bool m_complete;
58
59
60 Q_DECLARE_PUBLIC(QRenderCaptureReply)
61};
62
63// used by backend to send render capture to frontend
64struct RenderCaptureData
65{
66 QImage image;
67 int captureId;
68};
69
70typedef QSharedPointer<RenderCaptureData> RenderCaptureDataPtr;
71
72} // Qt3DRender
73
74QT_END_NAMESPACE
75
76Q_DECLARE_METATYPE(Qt3DRender::RenderCaptureDataPtr) // LCOV_EXCL_LINE
77Q_DECLARE_METATYPE(Qt3DRender::QRenderCaptureRequest); // LCOV_EXCL_LINE
78
79#endif // QRENDERCAPTURE_P_H
80

source code of qt3d/src/render/framegraph/qrendercapture_p.h