1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QOPENGLPAINTDEVICE_H
5#define QOPENGLPAINTDEVICE_H
6
7#include <QtOpenGL/qtopenglglobal.h>
8
9#ifndef QT_NO_OPENGL
10
11#include <QtGui/qpaintdevice.h>
12#include <QtGui/qopengl.h>
13#include <QtGui/qopenglcontext.h>
14
15QT_BEGIN_NAMESPACE
16
17class QOpenGLPaintDevicePrivate;
18
19class Q_OPENGL_EXPORT QOpenGLPaintDevice : public QPaintDevice
20{
21 Q_DECLARE_PRIVATE(QOpenGLPaintDevice)
22public:
23 QOpenGLPaintDevice();
24 explicit QOpenGLPaintDevice(const QSize &size);
25 QOpenGLPaintDevice(int width, int height);
26 ~QOpenGLPaintDevice();
27
28 int devType() const override { return QInternal::OpenGL; }
29 QPaintEngine *paintEngine() const override;
30
31 QOpenGLContext *context() const;
32 QSize size() const;
33 void setSize(const QSize &size);
34 void setDevicePixelRatio(qreal devicePixelRatio);
35
36 qreal dotsPerMeterX() const;
37 qreal dotsPerMeterY() const;
38
39 void setDotsPerMeterX(qreal);
40 void setDotsPerMeterY(qreal);
41
42 void setPaintFlipped(bool flipped);
43 bool paintFlipped() const;
44
45 virtual void ensureActiveTarget();
46
47protected:
48 QOpenGLPaintDevice(QOpenGLPaintDevicePrivate &dd);
49 int metric(QPaintDevice::PaintDeviceMetric metric) const override;
50
51 Q_DISABLE_COPY(QOpenGLPaintDevice)
52 QScopedPointer<QOpenGLPaintDevicePrivate> d_ptr;
53};
54
55QT_END_NAMESPACE
56
57#endif // QT_NO_OPENGL
58
59#endif // QOPENGLPAINTDEVICE_H
60

source code of qtbase/src/opengl/qopenglpaintdevice.h