8#include <qpa/qplatformopenglcontext.h>
9#include <QOpenGLTexture>
12#include <QtCore/QDebug>
14#include <QtWaylandCompositor/private/wayland-wayland-server-protocol.h>
17#include <QtWaylandCompositor/private/qwaylandcompositor_p.h>
31 if (
m_buffer && m_committed && !m_destroyed)
59 if (!m_refCount.
deref()) {
87 if (wl_shm_buffer *shmBuffer = wl_shm_buffer_get(
m_buffer)) {
88 int width = wl_shm_buffer_get_width(shmBuffer);
89 int height = wl_shm_buffer_get_height(shmBuffer);
102 auto *
pool =
static_cast<struct wl_shm_pool *
>(
data);
103 wl_shm_pool_unref(
pool);
108 if (wl_shm_buffer *shmBuffer = wl_shm_buffer_get(
m_buffer)) {
109 int width = wl_shm_buffer_get_width(shmBuffer);
110 int height = wl_shm_buffer_get_height(shmBuffer);
111 int bytesPerLine = wl_shm_buffer_get_stride(shmBuffer);
114 wl_shm_format shmFormat = wl_shm_format(wl_shm_buffer_get_format(shmBuffer));
117 auto *
pool = wl_shm_buffer_ref_pool(shmBuffer);
118 uchar *
data =
static_cast<uchar *
>(wl_shm_buffer_get_data(shmBuffer));
132 m_shmTexture->create();
136 m_shmTexture->bind();
137 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
140 m_shmTexture->setSize(
image.width(),
image.height());
141 if (
image.hasAlphaChannel()) {
T loadAcquire() const noexcept
Format
The following image formats are available in Qt.
The QRegion class specifies a clip region for a painter.
Origin
This enum type is used to specify the origin of a QWaylandSurface's buffer.
ClientBuffer(struct ::wl_resource *bufferResource)
virtual void setDestroyed()
virtual void setCommitted(QRegion &damage)
struct::wl_resource * m_buffer
virtual QWaylandBufferRef::BufferFormatEgl bufferFormatEgl() const
bool isSharedMemory() const
QWaylandSurface::Origin origin() const override
SharedMemoryBuffer(struct ::wl_resource *bufferResource)
QImage image() const override
QSize size() const override
Combined button and popup list for selecting options.
static void shmBufferCleanup(void *data)
GLint GLsizei GLsizei height
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLint GLsizei GLsizei GLenum format