aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/coreapi
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2018-02-21 11:52:59 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2018-02-26 13:08:30 +0000
commit06e962f263a86c4b66e1c6195b3d2615695fea1e (patch)
tree3669793f9983762538a9cb12a07ce49d461f066d /src/quick/scenegraph/coreapi
parent78e875e6dbd4991fe22c194d8608b3d66c96e036 (diff)
init variables where they are declared when possible (clang-tidy)
clang-tidy -p compile_commands.json $file -checks='-*,modernize-use-default-member-init,readability-redundant-member-init' -config='{CheckOptions: [{key: modernize-use-default-member-init.UseAssignment, value: "1"}]}' -header-filter='qtdeclarative' -fix Change-Id: I705f3235ff129ba68b0d8dad54a083e29fcead5f Reviewed-by: Johan Helsing <johan.helsing@qt.io>
Diffstat (limited to 'src/quick/scenegraph/coreapi')
-rw-r--r--src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h41
-rw-r--r--src/quick/scenegraph/coreapi/qsgnode.cpp15
-rw-r--r--src/quick/scenegraph/coreapi/qsgnode.h26
-rw-r--r--src/quick/scenegraph/coreapi/qsgnode_p.h8
-rw-r--r--src/quick/scenegraph/coreapi/qsgrenderer_p.h4
5 files changed, 35 insertions, 59 deletions
diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h b/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h
index 46753e8087..918f3ce82c 100644
--- a/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h
+++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h
@@ -125,7 +125,6 @@ template <typename Type, int PageSize> class Allocator
{
public:
Allocator()
- : m_freePage(0)
{
pages.push_back(new AllocatorPage<Type, PageSize>());
}
@@ -209,7 +208,7 @@ public:
}
QVector<AllocatorPage<Type, PageSize> *> pages;
- int m_freePage;
+ int m_freePage = 0;
};
@@ -306,12 +305,7 @@ struct Buffer {
struct Element {
Element()
- : node(nullptr)
- , batch(nullptr)
- , nextInBatch(nullptr)
- , root(nullptr)
- , order(0)
- , boundsComputed(false)
+ : boundsComputed(false)
, boundsOutsideFloatRange(false)
, translateOnlyToRoot(false)
, removed(false)
@@ -332,14 +326,14 @@ struct Element {
}
void computeBounds();
- QSGGeometryNode *node;
- Batch *batch;
- Element *nextInBatch;
- Node *root;
+ QSGGeometryNode *node = nullptr;
+ Batch *batch = nullptr;
+ Element *nextInBatch = nullptr;
+ Node *root = nullptr;
Rect bounds; // in device coordinates
- int order;
+ int order = 0;
uint boundsComputed : 1;
uint boundsOutsideFloatRange : 1;
@@ -362,12 +356,12 @@ struct RenderNodeElement : public Element {
};
struct BatchRootInfo {
- BatchRootInfo() : parentRoot(nullptr), lastOrder(-1), firstOrder(-1), availableOrders(0) { }
+ BatchRootInfo() {}
QSet<Node *> subRoots;
- Node *parentRoot;
- int lastOrder;
- int firstOrder;
- int availableOrders;
+ Node *parentRoot = nullptr;
+ int lastOrder = -1;
+ int firstOrder = -1;
+ int availableOrders = 0;
};
struct ClipBatchRootInfo : public BatchRootInfo
@@ -381,14 +375,13 @@ struct DrawSet
: vertices(v)
, zorders(z)
, indices(i)
- , indexCount(0)
{
}
- DrawSet() : vertices(0), zorders(0), indices(0), indexCount(0) {}
- int vertices;
- int zorders;
- int indices;
- int indexCount;
+ DrawSet() {}
+ int vertices = 0;
+ int zorders = 0;
+ int indices = 0;
+ int indexCount = 0;
};
enum BatchCompatibility
diff --git a/src/quick/scenegraph/coreapi/qsgnode.cpp b/src/quick/scenegraph/coreapi/qsgnode.cpp
index 10d4e2a3eb..9717862baa 100644
--- a/src/quick/scenegraph/coreapi/qsgnode.cpp
+++ b/src/quick/scenegraph/coreapi/qsgnode.cpp
@@ -244,14 +244,7 @@ static void qt_print_node_count()
* Constructs a new node
*/
QSGNode::QSGNode()
- : m_parent(nullptr)
- , m_type(BasicNodeType)
- , m_firstChild(nullptr)
- , m_lastChild(nullptr)
- , m_nextSibling(nullptr)
- , m_previousSibling(nullptr)
- , m_subtreeRenderableCount(0)
- , m_nodeFlags(OwnedByParent)
+ : m_nodeFlags(OwnedByParent)
, m_dirtyState(nullptr)
{
init();
@@ -870,10 +863,6 @@ void QSGBasicGeometryNode::setGeometry(QSGGeometry *geometry)
QSGGeometryNode::QSGGeometryNode()
: QSGBasicGeometryNode(GeometryNodeType)
- , m_render_order(0)
- , m_material(nullptr)
- , m_opaque_material(nullptr)
- , m_opacity(1)
{
}
@@ -1326,8 +1315,6 @@ void QSGRootNode::notifyNodeChange(QSGNode *node, DirtyState state)
*/
QSGOpacityNode::QSGOpacityNode()
: QSGNode(OpacityNodeType)
- , m_opacity(1)
- , m_combined_opacity(1)
{
}
diff --git a/src/quick/scenegraph/coreapi/qsgnode.h b/src/quick/scenegraph/coreapi/qsgnode.h
index cd9d689dc1..528f100f8e 100644
--- a/src/quick/scenegraph/coreapi/qsgnode.h
+++ b/src/quick/scenegraph/coreapi/qsgnode.h
@@ -168,13 +168,13 @@ private:
void init();
void destroy();
- QSGNode *m_parent;
- NodeType m_type;
- QSGNode *m_firstChild;
- QSGNode *m_lastChild;
- QSGNode *m_nextSibling;
- QSGNode *m_previousSibling;
- int m_subtreeRenderableCount;
+ QSGNode *m_parent = nullptr;
+ NodeType m_type = BasicNodeType;
+ QSGNode *m_firstChild = nullptr;
+ QSGNode *m_lastChild = nullptr;
+ QSGNode *m_nextSibling = nullptr;
+ QSGNode *m_previousSibling = nullptr;
+ int m_subtreeRenderableCount = 0;
Flags m_nodeFlags;
DirtyState m_dirtyState; // Obsolete, remove in Qt 6
@@ -246,11 +246,11 @@ protected:
private:
friend class QSGNodeUpdater;
- int m_render_order;
- QSGMaterial *m_material;
- QSGMaterial *m_opaque_material;
+ int m_render_order = 0;
+ QSGMaterial *m_material = nullptr;
+ QSGMaterial *m_opaque_material = nullptr;
- qreal m_opacity;
+ qreal m_opacity = 1;
};
class Q_QUICK_EXPORT QSGClipNode : public QSGBasicGeometryNode
@@ -323,8 +323,8 @@ public:
bool isSubtreeBlocked() const override;
private:
- qreal m_opacity;
- qreal m_combined_opacity;
+ qreal m_opacity = 1;
+ qreal m_combined_opacity = 1;
};
class Q_QUICK_EXPORT QSGNodeVisitor {
diff --git a/src/quick/scenegraph/coreapi/qsgnode_p.h b/src/quick/scenegraph/coreapi/qsgnode_p.h
index 84d5477085..f81128f51a 100644
--- a/src/quick/scenegraph/coreapi/qsgnode_p.h
+++ b/src/quick/scenegraph/coreapi/qsgnode_p.h
@@ -78,18 +78,14 @@ public:
class QSGBasicGeometryNodePrivate : public QSGNodePrivate
{
public:
- QSGBasicGeometryNodePrivate()
- : QSGNodePrivate()
- {}
+ QSGBasicGeometryNodePrivate() {}
};
class QSGGeometryNodePrivate: public QSGBasicGeometryNodePrivate
{
public:
- QSGGeometryNodePrivate()
- : QSGBasicGeometryNodePrivate()
- {}
+ QSGGeometryNodePrivate() {}
};
QT_END_NAMESPACE
diff --git a/src/quick/scenegraph/coreapi/qsgrenderer_p.h b/src/quick/scenegraph/coreapi/qsgrenderer_p.h
index b890728fd8..d4ff6ea9fe 100644
--- a/src/quick/scenegraph/coreapi/qsgrenderer_p.h
+++ b/src/quick/scenegraph/coreapi/qsgrenderer_p.h
@@ -162,12 +162,12 @@ class Q_QUICK_PRIVATE_EXPORT QSGNodeDumper : public QSGNodeVisitor {
public:
static void dump(QSGNode *n);
- QSGNodeDumper() : m_indent(0) {}
+ QSGNodeDumper() {}
void visitNode(QSGNode *n) override;
void visitChildren(QSGNode *n) override;
private:
- int m_indent;
+ int m_indent = 0;
};