Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qsgabstractsoftwarerenderer_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 QSGABSTRACTSOFTWARERENDERER_H
5#define QSGABSTRACTSOFTWARERENDERER_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/qsgrenderer_p.h>
19
20#include <QtCore/QHash>
21
22QT_BEGIN_NAMESPACE
23
24class QSGSimpleRectNode;
25
26class QSGSoftwareRenderableNode;
28
29class Q_QUICK_EXPORT QSGAbstractSoftwareRenderer : public QSGRenderer
30{
31public:
32 QSGAbstractSoftwareRenderer(QSGRenderContext *context);
33 virtual ~QSGAbstractSoftwareRenderer();
34
35 QSGSoftwareRenderableNode *renderableNode(QSGNode *node) const;
36 void addNodeMapping(QSGNode *node, QSGSoftwareRenderableNode *renderableNode);
37 void appendRenderableNode(QSGSoftwareRenderableNode *node);
38
39 void nodeChanged(QSGNode *node, QSGNode::DirtyState state) override;
40
41 void markDirty();
42
43 void setClearColorEnabled(bool enable);
44 bool clearColorEnabled() const;
45
46protected:
47 QRegion renderNodes(QPainter *painter);
48 void buildRenderList();
49 QRegion optimizeRenderList();
50
51 void setBackgroundColor(const QColor &color);
52 void setBackgroundRect(const QRect &rect, qreal devicePixelRatio);
53 QColor backgroundColor();
54 QRect backgroundRect();
55 // only known after calling optimizeRenderList()
56 bool isOpaque() const { return m_isOpaque; }
57 const QVector<QSGSoftwareRenderableNode*> &renderableNodes() const;
58
59private:
60 void nodeAdded(QSGNode *node);
61 void nodeRemoved(QSGNode *node);
62 void nodeGeometryUpdated(QSGNode *node);
63 void nodeMaterialUpdated(QSGNode *node);
64 void nodeMatrixUpdated(QSGNode *node);
65 void nodeOpacityUpdated(QSGNode *node);
66
67 QHash<QSGNode*, QSGSoftwareRenderableNode*> m_nodes;
68 QVector<QSGSoftwareRenderableNode*> m_renderableNodes;
69
70 QSGSimpleRectNode *m_background;
71
72 QRegion m_dirtyRegion;
73 QRegion m_obscuredRegion;
74 qreal m_devicePixelRatio = 1;
75 bool m_isOpaque = false;
76 bool m_clearColorEnabled = true;
77
78 QSGSoftwareRenderableNodeUpdater *m_nodeUpdater;
79};
80
81QT_END_NAMESPACE
82
83#endif // QSGABSTRACTSOFTWARERENDERER_H
Q_STATIC_LOGGING_CATEGORY(lcAccessibilityCore, "qt.accessibility.core")