Changeset View
Changeset View
Standalone View
Standalone View
plugins/qpa/backingstore.h
1 | /******************************************************************** | 1 | /******************************************************************** | ||
---|---|---|---|---|---|
2 | KWin - the KDE window manager | 2 | KWin - the KDE window manager | ||
3 | This file is part of the KDE project. | 3 | This file is part of the KDE project. | ||
4 | 4 | | |||
5 | Copyright (C) 2015 Martin Gräßlin <mgraesslin@kde.org> | 5 | Copyright (C) 2015 Martin Gräßlin <mgraesslin@kde.org> | ||
6 | Copyright (C) 2019 Vlad Zagorodniy <vladzzag@gmail.com> | ||||
6 | 7 | | |||
7 | This program is free software; you can redistribute it and/or modify | 8 | This program is free software; you can redistribute it and/or modify | ||
8 | it under the terms of the GNU General Public License as published by | 9 | it under the terms of the GNU General Public License as published by | ||
9 | the Free Software Foundation; either version 2 of the License, or | 10 | the Free Software Foundation; either version 2 of the License, or | ||
10 | (at your option) any later version. | 11 | (at your option) any later version. | ||
11 | 12 | | |||
12 | This program is distributed in the hope that it will be useful, | 13 | This program is distributed in the hope that it will be useful, | ||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | GNU General Public License for more details. | 16 | GNU General Public License for more details. | ||
16 | 17 | | |||
17 | You should have received a copy of the GNU General Public License | 18 | You should have received a copy of the GNU General Public License | ||
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 19 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
19 | *********************************************************************/ | 20 | *********************************************************************/ | ||
20 | #ifndef KWIN_QPA_BACKINGSTORE_H | 21 | #ifndef KWIN_QPA_BACKINGSTORE_H | ||
21 | #define KWIN_QPA_BACKINGSTORE_H | 22 | #define KWIN_QPA_BACKINGSTORE_H | ||
22 | 23 | | |||
23 | #include <qpa/qplatformbackingstore.h> | 24 | #include <qpa/qplatformbackingstore.h> | ||
24 | 25 | | |||
25 | namespace KWayland | | |||
26 | { | | |||
27 | namespace Client | | |||
28 | { | | |||
29 | class Buffer; | | |||
30 | class ShmPool; | | |||
31 | } | | |||
32 | } | | |||
33 | | ||||
34 | namespace KWin | 26 | namespace KWin | ||
35 | { | 27 | { | ||
36 | namespace QPA | 28 | namespace QPA | ||
37 | { | 29 | { | ||
38 | 30 | | |||
39 | class BackingStore : public QPlatformBackingStore | 31 | class BackingStore : public QPlatformBackingStore | ||
40 | { | 32 | { | ||
41 | public: | 33 | public: | ||
42 | explicit BackingStore(QWindow *w, KWayland::Client::ShmPool *shm); | 34 | explicit BackingStore(QWindow *window); | ||
43 | ~BackingStore() override; | 35 | ~BackingStore() override; | ||
44 | 36 | | |||
45 | QPaintDevice *paintDevice() override; | 37 | QPaintDevice *paintDevice() override; | ||
46 | void flush(QWindow *window, const QRegion ®ion, const QPoint &offset) override; | 38 | void flush(QWindow *window, const QRegion ®ion, const QPoint &offset) override; | ||
47 | void resize(const QSize &size, const QRegion &staticContents) override; | 39 | void resize(const QSize &size, const QRegion &staticContents) override; | ||
48 | void beginPaint(const QRegion &) override; | | |||
49 | 40 | | |||
50 | private: | 41 | private: | ||
51 | int scale() const; | | |||
52 | KWayland::Client::ShmPool *m_shm; | | |||
53 | QWeakPointer<KWayland::Client::Buffer> m_buffer; | | |||
54 | QImage m_backBuffer; | 42 | QImage m_backBuffer; | ||
55 | QSize m_size; | 43 | QImage m_frontBuffer; | ||
56 | }; | 44 | }; | ||
57 | 45 | | |||
58 | } | 46 | } | ||
59 | } | 47 | } | ||
60 | 48 | | |||
61 | #endif | 49 | #endif |