forked from linuxdeepin/qt5platform-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdopenglpaintdevice.h
59 lines (42 loc) · 1.54 KB
/
dopenglpaintdevice.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
// SPDX-FileCopyrightText: 2020 - 2022 Uniontech Software Technology Co.,Ltd.
//
// SPDX-License-Identifier: LGPL-3.0-or-later
#ifndef DOPENGLPAINTDEVICE_H
#define DOPENGLPAINTDEVICE_H
#include "global.h"
#include <QOffscreenSurface>
#include <QOpenGLPaintDevice>
#include <QImage>
DPP_BEGIN_NAMESPACE
class DOpenGLPaintDevicePrivate;
class DOpenGLPaintDevice : public QOpenGLPaintDevice
{
Q_DECLARE_PRIVATE(DOpenGLPaintDevice)
public:
enum UpdateBehavior {
NoPartialUpdate,
PartialUpdateBlit,
PartialUpdateBlend
};
explicit DOpenGLPaintDevice(QSurface *surface, UpdateBehavior updateBehavior = PartialUpdateBlit);
explicit DOpenGLPaintDevice(const QSize &size, UpdateBehavior updateBehavior = PartialUpdateBlit);
explicit DOpenGLPaintDevice(QOpenGLContext *shareContext, QSurface *surface = nullptr, UpdateBehavior updateBehavior = PartialUpdateBlit);
explicit DOpenGLPaintDevice(QOpenGLContext *shareContext, const QSize &size, UpdateBehavior updateBehavior = PartialUpdateBlit);
~DOpenGLPaintDevice();
void resize(const QSize &size);
UpdateBehavior updateBehavior() const;
bool isValid() const;
void makeCurrent();
void doneCurrent();
void flush();
QOpenGLContext *context() const;
QOpenGLContext *shareContext() const;
GLuint defaultFramebufferObject() const;
QImage grabFramebuffer();
private:
using QOpenGLPaintDevice::setSize;
void ensureActiveTarget() override;
Q_DISABLE_COPY(DOpenGLPaintDevice)
};
DPP_END_NAMESPACE
#endif // DOPENGLPAINTDEVICE_H