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
4#ifndef QWAYLANDBUFFERREF_H
5#define QWAYLANDBUFFERREF_H
6
7#include <QtWaylandCompositor/qtwaylandcompositorglobal.h>
8#include <QtGui/QImage>
9
10#if QT_CONFIG(opengl)
11#include <QtGui/qopengl.h>
12#endif
13
14#include <QtWaylandCompositor/QWaylandSurface>
15
16struct wl_resource;
17
18QT_BEGIN_NAMESPACE
19
20class QOpenGLTexture;
22
23namespace QtWayland
24{
25 class ClientBuffer;
26}
27
28class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandBufferRef
29{
30public:
31 QWaylandBufferRef();
32 QWaylandBufferRef(const QWaylandBufferRef &ref);
33 ~QWaylandBufferRef();
34
35 QWaylandBufferRef &operator=(const QWaylandBufferRef &ref);
36 bool isNull() const;
37 bool hasBuffer() const;
38 bool hasContent() const;
39 bool hasProtectedContent() const;
40 bool isDestroyed() const;
41#if QT_WAYLANDCOMPOSITOR_REMOVED_SINCE(6, 3)
42 bool operator==(const QWaylandBufferRef &ref);
43 bool operator!=(const QWaylandBufferRef &ref);
44#endif
45
46 struct wl_resource *wl_buffer() const;
47
48 QSize size() const;
49 QWaylandSurface::Origin origin() const;
50
51 enum BufferType {
52 BufferType_Null,
53 BufferType_SharedMemory,
54 BufferType_Egl
55 };
56
57 enum BufferFormatEgl {
58 BufferFormatEgl_Null,
59 BufferFormatEgl_RGB,
60 BufferFormatEgl_RGBA,
61 BufferFormatEgl_EXTERNAL_OES,
62 BufferFormatEgl_Y_U_V,
63 BufferFormatEgl_Y_UV,
64 BufferFormatEgl_Y_XUXV
65 };
66
67 BufferType bufferType() const;
68 BufferFormatEgl bufferFormatEgl() const;
69
70 bool isSharedMemory() const;
71 QImage image() const;
72
73#if QT_CONFIG(opengl)
74 QOpenGLTexture *toOpenGLTexture(int plane = 0) const;
75#endif
76
77 quintptr lockNativeBuffer();
78 void unlockNativeBuffer(quintptr handle);
79
80private:
81 explicit QWaylandBufferRef(QtWayland::ClientBuffer *buffer);
82 QtWayland::ClientBuffer *buffer() const;
83 class QWaylandBufferRefPrivate *const d;
84 friend class QWaylandBufferRefPrivate;
85 friend class QWaylandSurfacePrivate;
86 friend class QWaylandSurfaceTextureProvider;
87
88 friend Q_WAYLANDCOMPOSITOR_EXPORT
89 bool operator==(const QWaylandBufferRef &lhs, const QWaylandBufferRef &rhs) noexcept;
90 friend inline
91 bool operator!=(const QWaylandBufferRef &lhs, const QWaylandBufferRef &rhs) noexcept
92 { return !(lhs == rhs); }
93};
94
95QT_END_NAMESPACE
96
97#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