Changeset View
Changeset View
Standalone View
Standalone View
platformsupport/scenes/qpainter/backend.cpp
- This file was copied from plugins/platforms/fbdev/scene_qpainter_fb_backend.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) 2013 Martin Gräßlin <mgraesslin@kde.org> | ||
6 | 6 | | |||
7 | This program is free software; you can redistribute it and/or modify | 7 | 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 | 8 | 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 | 9 | the Free Software Foundation; either version 2 of the License, or | ||
10 | (at your option) any later version. | 10 | (at your option) any later version. | ||
11 | 11 | | |||
12 | This program is distributed in the hope that it will be useful, | 12 | This program is distributed in the hope that it will be useful, | ||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | GNU General Public License for more details. | 15 | GNU General Public License for more details. | ||
16 | 16 | | |||
17 | You should have received a copy of the GNU General Public License | 17 | 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/>. | 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
19 | *********************************************************************/ | 19 | *********************************************************************/ | ||
20 | #ifndef KWIN_SCENE_QPAINTER_FB_BACKEND_H | 20 | #include "backend.h" | ||
21 | #define KWIN_SCENE_QPAINTER_FB_BACKEND_H | 21 | #include <logging.h> | ||
22 | #include "scene_qpainter.h" | | |||
23 | 22 | | |||
24 | #include <QObject> | 23 | #include <QtGlobal> | ||
25 | 24 | | |||
26 | namespace KWin | 25 | namespace KWin | ||
27 | { | 26 | { | ||
28 | class FramebufferBackend; | | |||
29 | 27 | | |||
30 | class FramebufferQPainterBackend : public QObject, public QPainterBackend | 28 | QPainterBackend::QPainterBackend() | ||
29 | : m_failed(false) | ||||
31 | { | 30 | { | ||
32 | Q_OBJECT | 31 | } | ||
33 | public: | | |||
34 | FramebufferQPainterBackend(FramebufferBackend *backend); | | |||
35 | virtual ~FramebufferQPainterBackend(); | | |||
36 | 32 | | |||
37 | QImage *buffer() override; | 33 | QPainterBackend::~QPainterBackend() | ||
38 | bool needsFullRepaint() const override; | 34 | { | ||
39 | bool usesOverlayWindow() const override; | 35 | } | ||
40 | void prepareRenderingFrame() override; | 36 | | ||
41 | void present(int mask, const QRegion &damage) override; | 37 | OverlayWindow* QPainterBackend::overlayWindow() | ||
38 | { | ||||
39 | return nullptr; | ||||
40 | } | ||||
42 | 41 | | |||
43 | private: | 42 | void QPainterBackend::showOverlay() | ||
44 | QImage m_renderBuffer; | 43 | { | ||
45 | QImage m_backBuffer; | 44 | } | ||
46 | FramebufferBackend *m_backend; | | |||
47 | }; | | |||
48 | 45 | | |||
46 | void QPainterBackend::screenGeometryChanged(const QSize &size) | ||||
47 | { | ||||
48 | Q_UNUSED(size) | ||||
49 | } | 49 | } | ||
50 | 50 | | |||
51 | #endif | 51 | void QPainterBackend::setFailed(const QString &reason) | ||
52 | { | ||||
53 | qCWarning(KWIN_QPAINTER) << "Creating the QPainter backend failed: " << reason; | ||||
54 | m_failed = true; | ||||
55 | } | ||||
56 | | ||||
57 | bool QPainterBackend::perScreenRendering() const | ||||
58 | { | ||||
59 | return false; | ||||
60 | } | ||||
61 | | ||||
62 | QImage *QPainterBackend::bufferForScreen(int screenId) | ||||
63 | { | ||||
64 | Q_UNUSED(screenId) | ||||
65 | return buffer(); | ||||
66 | } | ||||
67 | | ||||
68 | } |