6#include <QtOpenGL/QOpenGLTexture>
7#include <QtGui/QOpenGLContext>
8#include <QtCore/QSharedMemory>
10#include <QtCore/QDebug>
16 , m_integration(integration)
17 , m_width(qimage.
width())
18 , m_height(qimage.
height())
19 , m_bpl(qimage.bytesPerLine())
24 m_shm_format = QtWaylandServer::qt_shm_emulation_server_buffer::format_RGBA32;
27 m_shm_format = QtWaylandServer::qt_shm_emulation_server_buffer::format_A8;
30 qWarning(
"ShmServerBuffer: unsupported format");
31 m_shm_format = QtWaylandServer::qt_shm_emulation_server_buffer::format_RGBA32;
39 bool ok = m_shm->create(shm_size) && m_shm->lock();
41 memcpy(m_shm->data(), qimage.
constBits(), shm_size);
44 qWarning() <<
"Could not create shared memory" <<
key << shm_size;
55 auto *bufferResource = resourceMap().value(client);
56 if (!bufferResource) {
57 auto integrationResource = m_integration->resourceMap().value(client);
58 if (!integrationResource) {
59 qWarning(
"ShmServerBuffer::resourceForClient: Trying to get resource for ServerBuffer. But client is not bound to the shm_emulation interface");
62 struct ::wl_resource *shm_integration_resource = integrationResource->handle;
63 Resource *resource =
add(client, 1);
65 m_integration->send_server_buffer_created(shm_integration_resource, resource->handle, shmKey, m_width, m_height, m_bpl, m_shm_format);
66 return resource->handle;
68 return bufferResource->handle;
73 return resourceMap().size() > 0;
79 qWarning(
"ShmServerBuffer::toOpenGlTexture: no texture defined");
96 QtWaylandServer::qt_shm_emulation_server_buffer::init(
compositor->display(), 1);
static QPlatformNativeInterface * platformNativeInterface()
qsizetype sizeInBytes() const
const uchar * constBits() const
Returns a pointer to the first pixel data.
qint64 cacheKey() const
Returns a number that identifies the contents of this QImage object.
\macro QT_RESTRICTED_CAST_FROM_ASCII
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
\qmltype WaylandCompositor \instantiates QWaylandCompositor \inqmlmodule QtWayland....
bool initializeHardware(QWaylandCompositor *) override
bool supportsFormat(QtWayland::ServerBuffer::Format format) const override
QtWayland::ServerBuffer * createServerBufferFromImage(const QImage &qimage, QtWayland::ServerBuffer::Format format) override
ShmServerBufferIntegration()
~ShmServerBufferIntegration() override
struct::wl_resource * resourceForClient(struct ::wl_client *) override
~ShmServerBuffer() override
bool bufferInUse() override
QOpenGLTexture * toOpenGlTexture() override
ShmServerBuffer(ShmServerBufferIntegration *integration, const QImage &qimage, QtWayland::ServerBuffer::Format format)
Combined button and popup list for selecting options.
#define QT_IGNORE_DEPRECATIONS(statement)
static QOpenGLCompositor * compositor
GLint GLsizei GLsizei height
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLint GLsizei GLsizei GLenum format
static void add(QPainterPath &path, const QWingedEdge &list, int edge, QPathEdge::Traversal traversal)