forked from linuxdeepin/qt5platform-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdbackingstoreproxy.h
83 lines (65 loc) · 2.79 KB
/
dbackingstoreproxy.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// SPDX-FileCopyrightText: 2020 - 2022 Uniontech Software Technology Co.,Ltd.
//
// SPDX-License-Identifier: LGPL-3.0-or-later
#ifndef DBACKINGSTOREPROXY_H
#define DBACKINGSTOREPROXY_H
#include "global.h"
#include <qpa/qplatformbackingstore.h>
QT_BEGIN_NAMESPACE
class QSharedMemory;
QT_END_NAMESPACE
DPP_BEGIN_NAMESPACE
class DOpenGLPaintDevice;
class DBackingStoreProxy : public QPlatformBackingStore
{
public:
static bool useGLPaint(const QWindow *w);
static bool useWallpaperPaint(const QWindow *w);
DBackingStoreProxy(QPlatformBackingStore *proxy, bool useGLPaint = false, bool useWallpaper = false);
~DBackingStoreProxy() override;
QPaintDevice *paintDevice() override;
void flush(QWindow *window, const QRegion ®ion, const QPoint &offset) override;
#ifndef QT_NO_OPENGL
#if QT_VERSION < QT_VERSION_CHECK(5, 4, 0)
void composeAndFlush(QWindow *window, const QRegion ®ion, const QPoint &offset,
QPlatformTextureList *textures, QOpenGLContext *context) override;
#elif QT_VERSION < QT_VERSION_CHECK(5, 10, 0)
void composeAndFlush(QWindow *window, const QRegion ®ion, const QPoint &offset,
QPlatformTextureList *textures, QOpenGLContext *context,
bool translucentBackground) override;
#elif QT_VERSION <= QT_VERSION_CHECK(6, 2, 4)
void composeAndFlush(QWindow *window, const QRegion ®ion, const QPoint &offset,
QPlatformTextureList *textures,
bool translucentBackground) override;
#else
FlushResult rhiFlush(QWindow *window, qreal sourceDevicePixelRatio, const QRegion ®ion,
const QPoint &offset, QPlatformTextureList *textures,
bool translucentBackground) override;
#endif
#if QT_VERSION <= QT_VERSION_CHECK(6, 2, 4)
GLuint toTexture(const QRegion &dirtyRegion, QSize *textureSize, TextureFlags *flags) const override;
#else
QRhiTexture *toTexture(QRhiResourceUpdateBatch *resourceUpdates, const QRegion &dirtyRegion, TextureFlags *flags) const override;
#endif
#endif
QImage toImage() const override;
QPlatformGraphicsBuffer *graphicsBuffer() const override;
void resize(const QSize &size, const QRegion &staticContents) override;
bool scroll(const QRegion &area, int dx, int dy) override;
void beginPaint(const QRegion ®ion) override;
void endPaint() override;
private:
void updateWallpaperShared();
private:
QPlatformBackingStore *m_proxy = nullptr;
QImage m_image;
QRectF m_dirtyWindowRect;
QRect m_dirtyRect;
QScopedPointer<DOpenGLPaintDevice> glDevice;
bool enableGL = false;
bool enableWallpaper = false;
QSharedMemory *m_sharedMemory = nullptr;
QImage m_wallpaper;
};
DPP_END_NAMESPACE
#endif // DBACKINGSTOREPROXY_H