File indexing completed on 2024-05-19 16:35:27

0001 /*
0002     SPDX-FileCopyrightText: 2021 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #pragma once
0008 
0009 #include "clientbuffer.h"
0010 #include "clientbufferintegration.h"
0011 
0012 namespace KWaylandServer
0013 {
0014 class ShmClientBufferPrivate;
0015 
0016 /**
0017  * The ShmClientBuffer class represents a wl_shm_buffer client buffer.
0018  *
0019  * The buffer's data can be accessed using the data() function. Note that it is not allowed
0020  * to access data of several shared memory buffers simultaneously.
0021  */
0022 class KWIN_EXPORT ShmClientBuffer : public ClientBuffer
0023 {
0024     Q_OBJECT
0025     Q_DECLARE_PRIVATE(ShmClientBuffer)
0026 
0027 public:
0028     explicit ShmClientBuffer(wl_resource *resource);
0029 
0030     QImage data() const;
0031 
0032     QSize size() const override;
0033     bool hasAlphaChannel() const override;
0034     Origin origin() const override;
0035 };
0036 
0037 /**
0038  * The ShmClientBufferIntegration class provides support for wl_shm_buffer buffers.
0039  */
0040 class ShmClientBufferIntegration : public ClientBufferIntegration
0041 {
0042     Q_OBJECT
0043 
0044 public:
0045     explicit ShmClientBufferIntegration(Display *display);
0046 
0047     ClientBuffer *createBuffer(::wl_resource *resource) override;
0048 };
0049 
0050 } // namespace KWaylandServer