Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qsgsoftwarerenderablenode_p.h
Go to the documentation of this file.
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 QSGSOFTWARERENDERABLENODE_H
5#define QSGSOFTWARERENDERABLENODE_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 <QtQuick/private/qtquickglobal_p.h>
19
20#include <QtGui/QRegion>
21#include <QtCore/QRect>
22#include <QtGui/QTransform>
23#include <QtQuick/qsgrectanglenode.h>
24#include <QtQuick/qsgimagenode.h>
25#include <QtQuick/qsgninepatchnode.h>
26
28
37class QSGRenderNode;
38
39class Q_QUICK_EXPORT QSGSoftwareRenderableNode
40{
41public:
42 enum NodeType {
43 Invalid = -1,
53#if QT_CONFIG(quick_sprite)
54 SpriteNode,
55#endif
56 RenderNode
57 };
58
59 QSGSoftwareRenderableNode(NodeType type, QSGNode *node);
61
62 void update();
63
64 QRegion renderNode(QPainter *painter, bool forceOpaquePainting = false);
65 QRect boundingRectMin() const { return m_boundingRectMin; }
66 QRect boundingRectMax() const { return m_boundingRectMax; }
67 NodeType type() const { return m_nodeType; }
68 bool isOpaque() const { return m_isOpaque; }
69 bool isDirty() const { return m_isDirty; }
70 bool isDirtyRegionEmpty() const;
71 QSGNode *handle() const { return m_handle.node; }
72
73 void setTransform(const QTransform &transform);
74 void setClipRegion(const QRegion &clipRegion, bool hasClipRegion = true);
75 void setOpacity(float opacity);
76 QTransform transform() const { return m_transform; }
77 QRegion clipRegion() const { return m_clipRegion; }
78 float opacity() const { return m_opacity; }
79
80 void markGeometryDirty();
81 void markMaterialDirty();
82
83 void addDirtyRegion(const QRegion &dirtyRegion, bool forceDirty = true);
84 void subtractDirtyRegion(const QRegion &dirtyRegion);
85
86 QRegion previousDirtyRegion(bool wasRemoved = false) const;
87 QRegion dirtyRegion() const;
88
89private:
90 union RenderableNodeHandle {
91 QSGNode *node;
92 QSGSimpleRectNode *simpleRectNode;
93 QSGSimpleTextureNode *simpleTextureNode;
95 QSGSoftwarePainterNode *painterNode;
97 QSGSoftwareGlyphNode *glpyhNode;
98 QSGSoftwareNinePatchNode *ninePatchNode;
99 QSGRectangleNode *simpleRectangleNode;
100 QSGImageNode *simpleImageNode;
101 QSGSoftwareSpriteNode *spriteNode;
102 QSGRenderNode *renderNode;
103 };
104
105 const NodeType m_nodeType;
106 RenderableNodeHandle m_handle;
107
108 bool m_isOpaque;
109
110 bool m_isDirty;
111 QRegion m_dirtyRegion;
112 QRegion m_previousDirtyRegion;
113
114 QTransform m_transform;
115 QRegion m_clipRegion;
116 bool m_hasClipRegion;
117 float m_opacity;
118
119 QRect m_boundingRectMin;
120 QRect m_boundingRectMax;
121};
122
124
125#endif // QSGSOFTWARERENDERABLENODE_H
The QPainter class performs low-level painting on widgets and other paint devices.
Definition qpainter.h:46
\inmodule QtCore\reentrant
Definition qrect.h:30
The QRegion class specifies a clip region for a painter.
Definition qregion.h:27
The QSGImageNode class is provided for convenience to easily draw textured content using the QML scen...
\group qtquick-scenegraph-nodes \title Qt Quick Scene Graph Node classes
Definition qsgnode.h:37
The QSGRectangleNode class is a convenience class for drawing solid filled rectangles using scenegrap...
The QSGRenderNode class represents a set of custom rendering commands targeting the graphics API that...
The QSGSimpleRectNode class is a convenience class for drawing solid filled rectangles using scenegra...
The QSGSimpleTextureNode class is provided for convenience to easily draw textured content using the ...
The QTransform class specifies 2D transformations of a coordinate system.
Definition qtransform.h:20
Combined button and popup list for selecting options.
@ Invalid
GLenum type
GLuint GLenum GLenum transform
QPainter painter(this)
[7]