8#include "wayland_wrapper/qwlclientbuffer_p.h"
14#define CHECK1(l, r, op)
15 static_assert(std::is_same_v<
17 decltype(std::declval<QWaylandBufferRef l >() op
18 std::declval<QWaylandBufferRef r >())
49
50
51
52
53
54
55
56
59
60
61QWaylandBufferRef::QWaylandBufferRef()
62 : d(
new QWaylandBufferRefPrivate)
68
69
70QWaylandBufferRef::QWaylandBufferRef(QtWayland::ClientBuffer *buffer)
71 : d(
new QWaylandBufferRefPrivate)
79
80
81QWaylandBufferRef::QWaylandBufferRef(
const QWaylandBufferRef &ref)
82 : d(
new QWaylandBufferRefPrivate)
84 d->buffer = ref.d->buffer;
90
91
92QWaylandBufferRef::~QWaylandBufferRef()
100
101
102
103QWaylandBufferRef &QWaylandBufferRef::operator=(
const QWaylandBufferRef &ref)
106 ref.d->buffer->ref();
111 d->buffer = ref.d->buffer;
117
118
119
120
121
122bool operator==(
const QWaylandBufferRef &lhs,
const QWaylandBufferRef &rhs)
noexcept
124 return lhs.d->buffer == rhs.d->buffer;
128
129
130
131
132
135
136
137
138
139
140bool QWaylandBufferRef::isNull()
const
146
147
148
149
150bool QWaylandBufferRef::hasBuffer()
const
155
156
157
158
159bool QWaylandBufferRef::hasContent()
const
161 return QtWayland::ClientBuffer::hasContent(d->buffer);
164
165
166
167
168
169
170
171
172bool QWaylandBufferRef::hasProtectedContent()
const
174 return QtWayland::ClientBuffer::hasProtectedContent(d->buffer);
178
179
180
181bool QWaylandBufferRef::isDestroyed()
const
183 return d->buffer && d->buffer->isDestroyed();
187
188
189struct ::wl_resource *QWaylandBufferRef::wl_buffer()
const
191 return d->buffer ? d->buffer->waylandBufferHandle() :
nullptr;
195
196
197QtWayland::ClientBuffer *QWaylandBufferRef::buffer()
const
203
204
205
206QSize QWaylandBufferRef::size()
const
208 if (d->nullOrDestroyed())
211 return d->buffer->size();
215
216
217
218
219QWaylandSurface::Origin QWaylandBufferRef::origin()
const
222 return d->buffer->origin();
224 return QWaylandSurface::OriginBottomLeft;
227QWaylandBufferRef::BufferType QWaylandBufferRef::bufferType()
const
229 if (d->nullOrDestroyed())
230 return BufferType_Null;
232 if (isSharedMemory())
233 return BufferType_SharedMemory;
235 return BufferType_Egl;
238QWaylandBufferRef::BufferFormatEgl QWaylandBufferRef::bufferFormatEgl()
const
240 if (d->nullOrDestroyed())
241 return BufferFormatEgl_Null;
243 return d->buffer->bufferFormatEgl();
247
248
249bool QWaylandBufferRef::isSharedMemory()
const
251 if (d->nullOrDestroyed())
254 return d->buffer->isSharedMemory();
258
259
260QImage QWaylandBufferRef::image()
const
262 if (d->nullOrDestroyed())
265 return d->buffer->image();
270
271
272
273
274
275
276
277
278QOpenGLTexture *QWaylandBufferRef::toOpenGLTexture(
int plane)
const
280 if (d->nullOrDestroyed())
283 return d->buffer->toOpenGlTexture(plane);
287
288
289
290
291
292quintptr QWaylandBufferRef::lockNativeBuffer()
294 return d->buffer->lockNativeBuffer();
298
299
300
301void QWaylandBufferRef::unlockNativeBuffer(quintptr handle)
303 d->buffer->unlockNativeBuffer(handle);
QtWayland::ClientBuffer * buffer
bool operator==(const QWaylandBufferRef &lhs, const QWaylandBufferRef &rhs) noexcept