KWin
Loading...
Searching...
No Matches
qpainterswapchain.h
Go to the documentation of this file.
1/*
2 KWin - the KDE window manager
3 This file is part of the KDE project.
4
5 SPDX-FileCopyrightText: 2021 Xaver Hugl <xaver.hugl@gmail.com>
6 SPDX-FileCopyrightText: 2023 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
7
8 SPDX-License-Identifier: GPL-2.0-or-later
9*/
10
11#pragma once
12
13#include "kwin_export.h"
14
15#include <QImage>
16#include <QList>
17#include <QSize>
18
19#include <memory>
20
21namespace KWin
22{
23
24class GraphicsBuffer;
25class GraphicsBufferAllocator;
26class GraphicsBufferView;
27
28class KWIN_EXPORT QPainterSwapchainSlot
29{
30public:
33
34 GraphicsBuffer *buffer() const;
35 GraphicsBufferView *view() const;
36 int age() const;
37
38private:
39 GraphicsBuffer *m_buffer;
40 std::unique_ptr<GraphicsBufferView> m_view;
41 int m_age = 0;
42 friend class QPainterSwapchain;
43};
44
45class KWIN_EXPORT QPainterSwapchain
46{
47public:
48 QPainterSwapchain(GraphicsBufferAllocator *allocator, const QSize &size, uint32_t format);
50
51 QSize size() const;
52 uint32_t format() const;
53
54 std::shared_ptr<QPainterSwapchainSlot> acquire();
55 void release(std::shared_ptr<QPainterSwapchainSlot> slot);
56
57private:
58 GraphicsBufferAllocator *m_allocator;
59 QList<std::shared_ptr<QPainterSwapchainSlot>> m_slots;
60 QSize m_size;
61 uint32_t m_format;
62};
63
64}
GLenum format
Definition gltexture.cpp:49