Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qwaylandbufferref.h
Go to the documentation of this file.
1// Copyright (C) 2017 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5#ifndef QWAYLANDBUFFERREF_H
6#define QWAYLANDBUFFERREF_H
7
8#include <QtWaylandCompositor/qtwaylandcompositorglobal.h>
9#include <QtGui/QImage>
10
11#if QT_CONFIG(opengl)
12#include <QtGui/qopengl.h>
13#endif
14
15#include <QtWaylandCompositor/QWaylandSurface>
16
17struct wl_resource;
18
19QT_BEGIN_NAMESPACE
20
21class QOpenGLTexture;
23
24namespace QtWayland
25{
26 class ClientBuffer;
27}
28
29class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandBufferRef
30{
31public:
32 QWaylandBufferRef();
33 QWaylandBufferRef(const QWaylandBufferRef &ref);
34 ~QWaylandBufferRef();
35
36 QWaylandBufferRef &operator=(const QWaylandBufferRef &ref);
37 bool isNull() const;
38 bool hasBuffer() const;
39 bool hasContent() const;
40 bool hasProtectedContent() const;
41 bool isDestroyed() const;
42#if QT_WAYLANDCOMPOSITOR_REMOVED_SINCE(6, 3)
43 bool operator==(const QWaylandBufferRef &ref);
44 bool operator!=(const QWaylandBufferRef &ref);
45#endif
46
47 struct wl_resource *wl_buffer() const;
48
49 QSize size() const;
50 QWaylandSurface::Origin origin() const;
51
52 enum BufferType {
53 BufferType_Null,
54 BufferType_SharedMemory,
55 BufferType_Egl
56 };
57
58 enum BufferFormatEgl {
59 BufferFormatEgl_Null,
60 BufferFormatEgl_RGB,
61 BufferFormatEgl_RGBA,
62 BufferFormatEgl_EXTERNAL_OES,
63 BufferFormatEgl_Y_U_V,
64 BufferFormatEgl_Y_UV,
65 BufferFormatEgl_Y_XUXV
66 };
67
68 BufferType bufferType() const;
69 BufferFormatEgl bufferFormatEgl() const;
70
71 bool isSharedMemory() const;
72 QImage image() const;
73
74#if QT_CONFIG(opengl)
75 QOpenGLTexture *toOpenGLTexture(int plane = 0) const;
76#endif
77
78 quintptr lockNativeBuffer();
79 void unlockNativeBuffer(quintptr handle);
80
81private:
82 explicit QWaylandBufferRef(QtWayland::ClientBuffer *buffer);
83 QtWayland::ClientBuffer *buffer() const;
84 class QWaylandBufferRefPrivate *const d;
85 friend class QWaylandBufferRefPrivate;
86 friend class QWaylandSurfacePrivate;
87 friend class QWaylandSurfaceTextureProvider;
88
89 friend Q_WAYLANDCOMPOSITOR_EXPORT
90 bool operator==(const QWaylandBufferRef &lhs, const QWaylandBufferRef &rhs) noexcept;
91 friend inline
92 bool operator!=(const QWaylandBufferRef &lhs, const QWaylandBufferRef &rhs) noexcept
93 { return !(lhs == rhs); }
94};
95
96QT_END_NAMESPACE
97
98#endif
QtWayland::ClientBuffer * buffer
\inmodule QtWaylandCompositor
Combined button and popup list for selecting options.
#define CHECK(cvref)
bool operator==(const QWaylandBufferRef &lhs, const QWaylandBufferRef &rhs) noexcept