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 QSGSOFTWAREPAINTERNODE_H
5#define QSGSOFTWAREPAINTERNODE_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <private/qsgadaptationlayer_p.h>
19#include <QtQuick/qquickpainteditem.h>
20
21#include <QtGui/QPixmap>
22
23QT_BEGIN_NAMESPACE
24
25class QSGSoftwarePainterNode : public QSGPainterNode
26{
27public:
28 QSGSoftwarePainterNode(QQuickPaintedItem *item);
29 ~QSGSoftwarePainterNode();
30
31 void setPreferredRenderTarget(QQuickPaintedItem::RenderTarget target) override;
32
33 void setSize(const QSize &size) override;
34 QSize size() const { return m_size; }
35
36 void setDirty(const QRect &dirtyRect = QRect()) override;
37
38 void setOpaquePainting(bool opaque) override;
39 bool opaquePainting() const { return m_opaquePainting; }
40
41 void setLinearFiltering(bool linearFiltering) override;
42 bool linearFiltering() const { return m_linear_filtering; }
43
44 void setMipmapping(bool mipmapping) override;
45 bool mipmapping() const { return m_mipmapping; }
46
47 void setSmoothPainting(bool s) override;
48 bool smoothPainting() const { return m_smoothPainting; }
49
50 void setFillColor(const QColor &c) override;
51 QColor fillColor() const { return m_fillColor; }
52
53 void setContentsScale(qreal s) override;
54 qreal contentsScale() const { return m_contentsScale; }
55
56 void setFastFBOResizing(bool dynamic) override;
57 bool fastFBOResizing() const { return m_fastFBOResizing; }
58
59 QImage toImage() const override;
60 void update() override;
61 QSGTexture *texture() const override { return m_texture; }
62
63 void paint(QPainter *painter);
64
65 void paint();
66
67 void setTextureSize(const QSize &size) override;
68 QSize textureSize() const { return m_textureSize; }
69
70private:
71
72 QQuickPaintedItem::RenderTarget m_preferredRenderTarget;
73
74 QQuickPaintedItem *m_item;
75
76 QPixmap m_pixmap;
77 QSGTexture *m_texture;
78
79 QSize m_size;
80 bool m_dirtyContents;
81 QRect m_dirtyRect;
82 bool m_opaquePainting;
83 bool m_linear_filtering;
84 bool m_mipmapping;
85 bool m_smoothPainting;
86 bool m_fastFBOResizing;
87 QColor m_fillColor;
88 qreal m_contentsScale;
89 QSize m_textureSize;
90
91 bool m_dirtyGeometry;
92};
93
94QT_END_NAMESPACE
95
96#endif // QSGSOFTWAREPAINTERNODE_H
97

source code of qtdeclarative/src/quick/scenegraph/adaptations/software/qsgsoftwarepainternode_p.h