1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the QtQuick module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40#ifndef QSGSOFTWAREPAINTERNODE_H
41#define QSGSOFTWAREPAINTERNODE_H
42
43//
44// W A R N I N G
45// -------------
46//
47// This file is not part of the Qt API. It exists purely as an
48// implementation detail. This header file may change from version to
49// version without notice, or even be removed.
50//
51// We mean it.
52//
53
54#include <private/qsgadaptationlayer_p.h>
55#include <QtQuick/qquickpainteditem.h>
56
57#include <QtGui/QPixmap>
58
59QT_BEGIN_NAMESPACE
60
61class QSGSoftwarePainterNode : public QSGPainterNode
62{
63public:
64 QSGSoftwarePainterNode(QQuickPaintedItem *item);
65 ~QSGSoftwarePainterNode();
66
67 void setPreferredRenderTarget(QQuickPaintedItem::RenderTarget target) override;
68
69 void setSize(const QSize &size) override;
70 QSize size() const { return m_size; }
71
72 void setDirty(const QRect &dirtyRect = QRect()) override;
73
74 void setOpaquePainting(bool opaque) override;
75 bool opaquePainting() const { return m_opaquePainting; }
76
77 void setLinearFiltering(bool linearFiltering) override;
78 bool linearFiltering() const { return m_linear_filtering; }
79
80 void setMipmapping(bool mipmapping) override;
81 bool mipmapping() const { return m_mipmapping; }
82
83 void setSmoothPainting(bool s) override;
84 bool smoothPainting() const { return m_smoothPainting; }
85
86 void setFillColor(const QColor &c) override;
87 QColor fillColor() const { return m_fillColor; }
88
89 void setContentsScale(qreal s) override;
90 qreal contentsScale() const { return m_contentsScale; }
91
92 void setFastFBOResizing(bool dynamic) override;
93 bool fastFBOResizing() const { return m_fastFBOResizing; }
94
95 QImage toImage() const override;
96 void update() override;
97 QSGTexture *texture() const override { return m_texture; }
98
99 void paint(QPainter *painter);
100
101 void paint();
102
103 void setTextureSize(const QSize &size) override;
104 QSize textureSize() const { return m_textureSize; }
105
106private:
107
108 QQuickPaintedItem::RenderTarget m_preferredRenderTarget;
109
110 QQuickPaintedItem *m_item;
111
112 QPixmap m_pixmap;
113 QSGTexture *m_texture;
114
115 QSize m_size;
116 bool m_dirtyContents;
117 QRect m_dirtyRect;
118 bool m_opaquePainting;
119 bool m_linear_filtering;
120 bool m_mipmapping;
121 bool m_smoothPainting;
122 bool m_fastFBOResizing;
123 QColor m_fillColor;
124 qreal m_contentsScale;
125 QSize m_textureSize;
126
127 bool m_dirtyGeometry;
128};
129
130QT_END_NAMESPACE
131
132#endif // QSGSOFTWAREPAINTERNODE_H
133

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