1 | // Copyright (C) 2019 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 QWAYLANDSERVERBUFFERINTEGRATION_H |
5 | #define QWAYLANDSERVERBUFFERINTEGRATION_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 <QtCore/QSize> |
19 | #include <QtGui/qopengl.h> |
20 | |
21 | #include <QtWaylandClient/private/qwayland-server-buffer-extension.h> |
22 | #include <QtWaylandClient/qtwaylandclientglobal.h> |
23 | #include <QtCore/private/qglobal_p.h> |
24 | |
25 | QT_BEGIN_NAMESPACE |
26 | |
27 | class QOpenGLTexture; |
28 | |
29 | namespace QtWaylandClient { |
30 | |
31 | class QWaylandDisplay; |
32 | |
33 | class Q_WAYLANDCLIENT_EXPORT QWaylandServerBuffer |
34 | { |
35 | public: |
36 | enum Format { |
37 | RGBA32, |
38 | A8, |
39 | Custom |
40 | }; |
41 | |
42 | QWaylandServerBuffer(); |
43 | virtual ~QWaylandServerBuffer(); |
44 | |
45 | virtual QOpenGLTexture *toOpenGlTexture() = 0; |
46 | |
47 | Format format() const; |
48 | QSize size() const; |
49 | |
50 | void setUserData(void *userData); |
51 | void *userData() const; |
52 | |
53 | protected: |
54 | Format m_format = RGBA32; |
55 | QSize m_size; |
56 | |
57 | private: |
58 | void *m_user_data = nullptr; |
59 | }; |
60 | |
61 | class Q_WAYLANDCLIENT_EXPORT QWaylandServerBufferIntegration |
62 | { |
63 | public: |
64 | QWaylandServerBufferIntegration(); |
65 | virtual ~QWaylandServerBufferIntegration(); |
66 | |
67 | virtual void initialize(QWaylandDisplay *display) = 0; |
68 | |
69 | virtual QWaylandServerBuffer *serverBuffer(struct qt_server_buffer *buffer) = 0; |
70 | }; |
71 | |
72 | } |
73 | |
74 | QT_END_NAMESPACE |
75 | |
76 | #endif |
77 | |