diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2018-02-21 10:41:54 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2018-02-26 07:13:18 +0000 |
commit | 499ec43937e926e4f2fa57a9baa455fcb3862262 (patch) | |
tree | 206c90d47387f8322b68f5e3db613189397e1af3 /src/quick/scenegraph/coreapi | |
parent | 53d1e9ed21d25e65a2f13606af479838f5f21fe7 (diff) |
use nullptr consistently (clang-tidy)
From now on we prefer nullptr instead of 0 to clarify cases where
we are assigning or testing a pointer rather than a numeric zero.
Also, replaced cases where 0 was passed as Qt::KeyboardModifiers
with Qt::NoModifier (clang-tidy replaced them with nullptr, which
waas wrong, so it was just as well to make the tests more readable
rather than to revert those lines).
Change-Id: I4735d35e4d9f42db5216862ce091429eadc6e65d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/quick/scenegraph/coreapi')
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgabstractrenderer.cpp | 2 | ||||
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp | 98 | ||||
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h | 34 | ||||
-rw-r--r-- | src/quick/scenegraph/coreapi/qsggeometry.cpp | 8 | ||||
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgmaterial.cpp | 2 | ||||
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgnode.cpp | 82 | ||||
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgnodeupdater.cpp | 6 | ||||
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgrenderer.cpp | 8 | ||||
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgrendernode.cpp | 8 |
9 files changed, 124 insertions, 124 deletions
diff --git a/src/quick/scenegraph/coreapi/qsgabstractrenderer.cpp b/src/quick/scenegraph/coreapi/qsgabstractrenderer.cpp index 3d4ce24716..fddac7ed71 100644 --- a/src/quick/scenegraph/coreapi/qsgabstractrenderer.cpp +++ b/src/quick/scenegraph/coreapi/qsgabstractrenderer.cpp @@ -97,7 +97,7 @@ QT_BEGIN_NAMESPACE \internal */ QSGAbstractRendererPrivate::QSGAbstractRendererPrivate() - : m_root_node(0) + : m_root_node(nullptr) , m_clear_color(Qt::transparent) , m_clear_mode(QSGAbstractRenderer::ClearColorBuffer | QSGAbstractRenderer::ClearDepthBuffer) { diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp index 27b374e47f..ba71551302 100644 --- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp +++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp @@ -155,10 +155,10 @@ ShaderManager::Shader *ShaderManager::prepareMaterial(QSGMaterial *material) p->bindAttributeLocation(attr[i], i); } p->bindAttributeLocation("_qt_order", i); - context->compileShader(s, material, qsgShaderRewriter_insertZAttributes(s->vertexShader(), profile), 0); + context->compileShader(s, material, qsgShaderRewriter_insertZAttributes(s->vertexShader(), profile), nullptr); context->initializeShader(s); if (!p->isLinked()) - return 0; + return nullptr; shader = new Shader; shader->program = s; @@ -215,7 +215,7 @@ void ShaderManager::invalidated() qDeleteAll(rewrittenShaders); rewrittenShaders.clear(); delete blitProgram; - blitProgram = 0; + blitProgram = nullptr; } void qsg_dumpShadowRoots(BatchRootInfo *i, int indent) @@ -280,7 +280,7 @@ Updater::Updater(Renderer *r) void Updater::updateStates(QSGNode *n) { - m_current_clip = 0; + m_current_clip = nullptr; m_added = 0; m_transformChange = 0; @@ -347,7 +347,7 @@ void Updater::visitNode(Node *n) m_added = count; m_force_update = force; - n->dirtyState = 0; + n->dirtyState = nullptr; } void Updater::visitClipNode(Node *n) @@ -473,7 +473,7 @@ void Updater::visitGeometryNode(Node *n) if (e->root) { BatchRootInfo *info = renderer->batchRootInfo(e->root); - while (info != 0) { + while (info != nullptr) { info->availableOrders--; if (info->availableOrders < 0) { renderer->m_rebuild |= Renderer::BuildRenderLists; @@ -481,10 +481,10 @@ void Updater::visitGeometryNode(Node *n) renderer->m_rebuild |= Renderer::BuildRenderListsForTaggedRoots; renderer->m_taggedRoots << e->root; } - if (info->parentRoot != 0) + if (info->parentRoot != nullptr) info = renderer->batchRootInfo(info->parentRoot); else - info = 0; + info = nullptr; } } else { renderer->m_rebuild |= Renderer::FullRebuild; @@ -680,12 +680,12 @@ void Batch::invalidate() // the batch to do an early out.. cleanupRemovedElements(); Element *e = first; - first = 0; - root = 0; + first = nullptr; + root = nullptr; while (e) { - e->batch = 0; + e->batch = nullptr; Element *n = e->nextInBatch; - e->nextInBatch = 0; + e->nextInBatch = nullptr; e = n; } } @@ -756,7 +756,7 @@ Renderer::Renderer(QSGDefaultRenderContext *ctx) , m_alphaRenderList(64) , m_nextRenderOrder(0) , m_partialRebuild(false) - , m_partialRebuildRoot(0) + , m_partialRebuildRoot(nullptr) , m_useDepthBuffer(true) , m_opaqueBatches(16) , m_alphaBatches(16) @@ -768,17 +768,17 @@ Renderer::Renderer(QSGDefaultRenderContext *ctx) , m_zRange(0) , m_renderOrderRebuildLower(-1) , m_renderOrderRebuildUpper(-1) - , m_currentMaterial(0) - , m_currentShader(0) + , m_currentMaterial(nullptr) + , m_currentShader(nullptr) , m_currentStencilValue(0) , m_clipMatrixId(0) - , m_currentClip(0) + , m_currentClip(nullptr) , m_currentClipType(NoClip) , m_vertexUploadPool(256) #ifdef QSG_SEPARATE_INDEX_BUFFER , m_indexUploadPool(64) #endif - , m_vao(0) + , m_vao(nullptr) , m_visualizeMode(VisualizeNothing) { initializeOpenGLFunctions(); @@ -916,7 +916,7 @@ void Renderer::unmap(Buffer *buffer, bool isIndexBuf) glBufferData(target, buffer->size, buffer->data, m_bufferStrategy); if (!m_context->hasBrokenIndexBufferObjects() && m_visualizeMode == VisualizeNothing) { - buffer->data = 0; + buffer->data = nullptr; } } @@ -944,7 +944,7 @@ void Renderer::removeBatchRootFromParent(Node *childRoot) Q_ASSERT(parentInfo->subRoots.contains(childRoot)); parentInfo->subRoots.remove(childRoot); - childInfo->parentRoot = 0; + childInfo->parentRoot = nullptr; } void Renderer::registerBatchRoot(Node *subRoot, Node *parentRoot) @@ -1072,7 +1072,7 @@ void Renderer::nodeWasRemoved(Node *node) if (e) { e->removed = true; m_elementsToDelete.add(e); - e->node = 0; + e->node = nullptr; if (e->root) { BatchRootInfo *info = batchRootInfo(e->root); info->availableOrders++; @@ -1185,7 +1185,7 @@ void Renderer::nodeChanged(QSGNode *node, QSGNode::DirtyState state) return; } if (node == rootNode()) - nodeWasAdded(node, 0); + nodeWasAdded(node, nullptr); else nodeWasAdded(node, m_nodes.value(node->parent())); } @@ -1438,7 +1438,7 @@ void Renderer::buildRenderListsForTaggedRoots() } } m_partialRebuild = false; - m_partialRebuildRoot = 0; + m_partialRebuildRoot = nullptr; m_taggedRoots.clear(); m_nextRenderOrder = qMax(m_nextRenderOrder, maxRenderOrder); @@ -2144,7 +2144,7 @@ Renderer::ClipType Renderer::updateStencilClip(const QSGClipNode *clip) glBufferSubData(GL_ARRAY_BUFFER, 0, vertexByteSize, g->vertexData()); } - pointer = 0; + pointer = nullptr; } glVertexAttribPointer(0, a->tupleSize, a->type, GL_FALSE, g->sizeOfVertex(), pointer); @@ -2186,7 +2186,7 @@ void Renderer::updateClip(const QSGClipNode *clipList, const Batch *batch) m_currentClip = clipList; // updateClip sets another program, so force-reactivate our own if (m_currentShader) - setActiveShader(0, 0); + setActiveShader(nullptr, nullptr); glBindBuffer(GL_ARRAY_BUFFER, 0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); if (batch->isOpaque) @@ -2207,8 +2207,8 @@ void Renderer::updateClip(const QSGClipNode *clipList, const Batch *batch) */ void Renderer::setActiveShader(QSGMaterialShader *program, ShaderManager::Shader *shader) { - const char * const *c = m_currentProgram ? m_currentProgram->attributeNames() : 0; - const char * const *n = program ? program->attributeNames() : 0; + const char * const *c = m_currentProgram ? m_currentProgram->attributeNames() : nullptr; + const char * const *n = program ? program->attributeNames() : nullptr; int cza = m_currentShader ? m_currentShader->pos_order : -1; int nza = shader ? shader->pos_order : -1; @@ -2219,18 +2219,18 @@ void Renderer::setActiveShader(QSGMaterialShader *program, ShaderManager::Shader bool was = c; if (cza == i) { was = true; - c = 0; + c = nullptr; } else if (c && !c[i]) { // end of the attribute array names - c = 0; + c = nullptr; was = false; } bool is = n; if (nza == i) { is = true; - n = 0; + n = nullptr; } else if (n && !n[i]) { - n = 0; + n = nullptr; is = false; } @@ -2246,7 +2246,7 @@ void Renderer::setActiveShader(QSGMaterialShader *program, ShaderManager::Shader m_currentProgram->deactivate(); m_currentProgram = program; m_currentShader = shader; - m_currentMaterial = 0; + m_currentMaterial = nullptr; if (m_currentProgram) { m_currentProgram->program()->bind(); m_currentProgram->activate(); @@ -2298,7 +2298,7 @@ void Renderer::renderMergedBatch(const Batch *batch) glBindBuffer(GL_ARRAY_BUFFER, batch->vbo.id); - char *indexBase = 0; + char *indexBase = nullptr; #ifdef QSG_SEPARATE_INDEX_BUFFER const Buffer *indexBuf = &batch->ibo; #else @@ -2394,7 +2394,7 @@ void Renderer::renderUnmergedBatch(const Batch *batch) updateClip(gn->clipList(), batch); glBindBuffer(GL_ARRAY_BUFFER, batch->vbo.id); - char *indexBase = 0; + char *indexBase = nullptr; #ifdef QSG_SEPARATE_INDEX_BUFFER const Buffer *indexBuf = &batch->ibo; #else @@ -2500,8 +2500,8 @@ void Renderer::updateLineWidth(QSGGeometry *g) else { QOpenGLContext *ctx = m_context->openglContext(); if (!ctx->isOpenGLES() && g->drawingMode() == GL_POINTS) { - QOpenGLFunctions_1_0 *gl1funcs = 0; - QOpenGLFunctions_3_2_Core *gl3funcs = 0; + QOpenGLFunctions_1_0 *gl1funcs = nullptr; + QOpenGLFunctions_3_2_Core *gl3funcs = nullptr; if (ctx->format().profile() == QSurfaceFormat::CoreProfile) gl3funcs = ctx->versionFunctions<QOpenGLFunctions_3_2_Core>(); else @@ -2546,10 +2546,10 @@ void Renderer::renderBatches() bindable()->clear(clearMode()); m_current_opacity = 1; - m_currentMaterial = 0; - m_currentShader = 0; - m_currentProgram = 0; - m_currentClip = 0; + m_currentMaterial = nullptr; + m_currentShader = nullptr; + m_currentProgram = nullptr; + m_currentClip = nullptr; bool renderOpaque = !debug_noopaque(); bool renderAlpha = !debug_noalpha(); @@ -2582,8 +2582,8 @@ void Renderer::renderBatches() } if (m_currentShader) - setActiveShader(0, 0); - updateStencilClip(0); + setActiveShader(nullptr, nullptr); + updateStencilClip(nullptr); glBindBuffer(GL_ARRAY_BUFFER, 0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); glDepthMask(true); @@ -2597,12 +2597,12 @@ void Renderer::deleteRemovedElements() for (int i=0; i<m_opaqueRenderList.size(); ++i) { Element **e = m_opaqueRenderList.data() + i; if (*e && (*e)->removed) - *e = 0; + *e = nullptr; } for (int i=0; i<m_alphaRenderList.size(); ++i) { Element **e = m_alphaRenderList.data() + i; if (*e && (*e)->removed) - *e = 0; + *e = nullptr; } for (int i=0; i<m_elementsToDelete.size(); ++i) { @@ -2815,11 +2815,11 @@ void Renderer::renderRenderNode(Batch *batch) Q_ASSERT(batch->first->isRenderNode); RenderNodeElement *e = (RenderNodeElement *) batch->first; - setActiveShader(0, 0); + setActiveShader(nullptr, nullptr); QSGNode *clip = e->renderNode->parent(); QSGRenderNodePrivate *rd = QSGRenderNodePrivate::get(e->renderNode); - rd->m_clip_list = 0; + rd->m_clip_list = nullptr; while (clip != rootNode()) { if (clip->type() == QSGNode::ClipNodeType) { rd->m_clip_list = static_cast<QSGClipNode *>(clip); @@ -2883,8 +2883,8 @@ void Renderer::renderRenderNode(Batch *batch) e->renderNode->render(&state); - rd->m_matrix = 0; - rd->m_clip_list = 0; + rd->m_matrix = nullptr; + rd->m_clip_list = nullptr; if (changes & QSGRenderNode::ViewportState) { QRect r = viewportRect(); @@ -2899,7 +2899,7 @@ void Renderer::renderRenderNode(Batch *batch) if (changes & (QSGRenderNode::StencilState | QSGRenderNode::ScissorState)) { glDisable(GL_SCISSOR_TEST); - m_currentClip = 0; + m_currentClip = nullptr; m_currentClipType = NoClip; } @@ -3069,7 +3069,7 @@ void Renderer::visualizeChanges(Node *n) // This is because many changes don't propegate their dirty state to the // parent so the node updater will not unset these states. They are // not used for anything so, unsetting it should have no side effects. - n->dirtyState = 0; + n->dirtyState = nullptr; } SHADOWNODE_TRAVERSE(n) { diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h b/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h index e99af2f4ef..46753e8087 100644 --- a/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h +++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h @@ -306,10 +306,10 @@ struct Buffer { struct Element { Element() - : node(0) - , batch(0) - , nextInBatch(0) - , root(0) + : node(nullptr) + , batch(nullptr) + , nextInBatch(nullptr) + , root(nullptr) , order(0) , boundsComputed(false) , boundsOutsideFloatRange(false) @@ -362,7 +362,7 @@ struct RenderNodeElement : public Element { }; struct BatchRootInfo { - BatchRootInfo() : parentRoot(0), lastOrder(-1), firstOrder(-1), availableOrders(0) { } + BatchRootInfo() : parentRoot(nullptr), lastOrder(-1), firstOrder(-1), availableOrders(0) { } QSet<Node *> subRoots; Node *parentRoot; int lastOrder; @@ -410,8 +410,8 @@ struct Batch // pseudo-constructor... void init() { - first = 0; - root = 0; + first = nullptr; + root = nullptr; vertexCount = 0; indexCount = 0; isOpaque = false; @@ -463,9 +463,9 @@ struct Node void append(Node *child) { Q_ASSERT(child); Q_ASSERT(!hasChild(child)); - Q_ASSERT(child->m_parent == 0); - Q_ASSERT(child->m_next == 0); - Q_ASSERT(child->m_prev == 0); + Q_ASSERT(child->m_parent == nullptr); + Q_ASSERT(child->m_next == nullptr); + Q_ASSERT(child->m_prev == nullptr); if (!m_child) { child->m_next = child; @@ -486,27 +486,27 @@ struct Node // only child.. if (child->m_next == child) { - m_child = 0; + m_child = nullptr; } else { if (m_child == child) m_child = child->m_next; child->m_next->m_prev = child->m_prev; child->m_prev->m_next = child->m_next; } - child->m_next = 0; - child->m_prev = 0; - child->setParent(0); + child->m_next = nullptr; + child->m_prev = nullptr; + child->setParent(nullptr); } Node *firstChild() const { return m_child; } Node *sibling() const { Q_ASSERT(m_parent); - return m_next == m_parent->m_child ? 0 : m_next; + return m_next == m_parent->m_child ? nullptr : m_next; } void setParent(Node *p) { - Q_ASSERT(m_parent == 0 || p == 0); + Q_ASSERT(m_parent == nullptr || p == nullptr); m_parent = p; } @@ -591,7 +591,7 @@ public: float lastOpacity; }; - ShaderManager(QSGDefaultRenderContext *ctx) : visualizeProgram(0), blitProgram(0), context(ctx) { } + ShaderManager(QSGDefaultRenderContext *ctx) : visualizeProgram(nullptr), blitProgram(nullptr), context(ctx) { } ~ShaderManager() { qDeleteAll(rewrittenShaders); qDeleteAll(stockShaders); diff --git a/src/quick/scenegraph/coreapi/qsggeometry.cpp b/src/quick/scenegraph/coreapi/qsggeometry.cpp index 52366bfc35..226709094d 100644 --- a/src/quick/scenegraph/coreapi/qsggeometry.cpp +++ b/src/quick/scenegraph/coreapi/qsggeometry.cpp @@ -430,9 +430,9 @@ QSGGeometry::QSGGeometry(const QSGGeometry::AttributeSet &attributes, , m_index_count(0) , m_index_type(indexType) , m_attributes(attributes) - , m_data(0) + , m_data(nullptr) , m_index_data_offset(-1) - , m_server_data(0) + , m_server_data(nullptr) , m_owns_data(false) , m_index_usage_pattern(AlwaysUploadPattern) , m_vertex_usage_pattern(AlwaysUploadPattern) @@ -529,7 +529,7 @@ QSGGeometry::~QSGGeometry() void *QSGGeometry::indexData() { return m_index_data_offset < 0 - ? 0 + ? nullptr : ((char *) m_data + m_index_data_offset); } @@ -541,7 +541,7 @@ void *QSGGeometry::indexData() const void *QSGGeometry::indexData() const { return m_index_data_offset < 0 - ? 0 + ? nullptr : ((char *) m_data + m_index_data_offset); } diff --git a/src/quick/scenegraph/coreapi/qsgmaterial.cpp b/src/quick/scenegraph/coreapi/qsgmaterial.cpp index 5c28f4c82f..8557de1b1f 100644 --- a/src/quick/scenegraph/coreapi/qsgmaterial.cpp +++ b/src/quick/scenegraph/coreapi/qsgmaterial.cpp @@ -641,7 +641,7 @@ static void qt_print_material_count() */ QSGMaterial::QSGMaterial() - : m_flags(0) + : m_flags(nullptr) { Q_UNUSED(m_reserved); #ifndef QT_NO_DEBUG diff --git a/src/quick/scenegraph/coreapi/qsgnode.cpp b/src/quick/scenegraph/coreapi/qsgnode.cpp index 550a2182f8..10d4e2a3eb 100644 --- a/src/quick/scenegraph/coreapi/qsgnode.cpp +++ b/src/quick/scenegraph/coreapi/qsgnode.cpp @@ -244,15 +244,15 @@ static void qt_print_node_count() * Constructs a new node */ QSGNode::QSGNode() - : m_parent(0) + : m_parent(nullptr) , m_type(BasicNodeType) - , m_firstChild(0) - , m_lastChild(0) - , m_nextSibling(0) - , m_previousSibling(0) + , m_firstChild(nullptr) + , m_lastChild(nullptr) + , m_nextSibling(nullptr) + , m_previousSibling(nullptr) , m_subtreeRenderableCount(0) , m_nodeFlags(OwnedByParent) - , m_dirtyState(0) + , m_dirtyState(nullptr) { init(); } @@ -263,15 +263,15 @@ QSGNode::QSGNode() * \internal */ QSGNode::QSGNode(NodeType type) - : m_parent(0) + : m_parent(nullptr) , m_type(type) - , m_firstChild(0) - , m_lastChild(0) - , m_nextSibling(0) - , m_previousSibling(0) + , m_firstChild(nullptr) + , m_lastChild(nullptr) + , m_nextSibling(nullptr) + , m_previousSibling(nullptr) , m_subtreeRenderableCount(type == GeometryNodeType || type == RenderNodeType ? 1 : 0) , m_nodeFlags(OwnedByParent) - , m_dirtyState(0) + , m_dirtyState(nullptr) { init(); } @@ -282,15 +282,15 @@ QSGNode::QSGNode(NodeType type) * \internal */ QSGNode::QSGNode(QSGNodePrivate &dd, NodeType type) - : m_parent(0) + : m_parent(nullptr) , m_type(type) - , m_firstChild(0) - , m_lastChild(0) - , m_nextSibling(0) - , m_previousSibling(0) + , m_firstChild(nullptr) + , m_lastChild(nullptr) + , m_nextSibling(nullptr) + , m_previousSibling(nullptr) , m_subtreeRenderableCount(type == GeometryNodeType || type == RenderNodeType ? 1 : 0) , m_nodeFlags(OwnedByParent) - , m_dirtyState(0) + , m_dirtyState(nullptr) , d_ptr(&dd) { init(); @@ -388,17 +388,17 @@ void QSGNode::destroy() { if (m_parent) { m_parent->removeChildNode(this); - Q_ASSERT(m_parent == 0); + Q_ASSERT(m_parent == nullptr); } while (m_firstChild) { QSGNode *child = m_firstChild; removeChildNode(child); - Q_ASSERT(child->m_parent == 0); + Q_ASSERT(child->m_parent == nullptr); if (child->flags() & OwnedByParent) delete child; } - Q_ASSERT(m_firstChild == 0 && m_lastChild == 0); + Q_ASSERT(m_firstChild == nullptr && m_lastChild == nullptr); } @@ -557,11 +557,11 @@ void QSGNode::removeChildNode(QSGNode *node) next->m_previousSibling = previous; else m_lastChild = previous; - node->m_previousSibling = 0; - node->m_nextSibling = 0; + node->m_previousSibling = nullptr; + node->m_nextSibling = nullptr; node->markDirty(DirtyNodeRemoved); - node->m_parent = 0; + node->m_parent = nullptr; } @@ -574,13 +574,13 @@ void QSGNode::removeAllChildNodes() while (m_firstChild) { QSGNode *node = m_firstChild; m_firstChild = node->m_nextSibling; - node->m_nextSibling = 0; + node->m_nextSibling = nullptr; if (m_firstChild) - m_firstChild->m_previousSibling = 0; + m_firstChild->m_previousSibling = nullptr; else - m_lastChild = 0; + m_lastChild = nullptr; node->markDirty(DirtyNodeRemoved); - node->m_parent = 0; + node->m_parent = nullptr; } } @@ -714,9 +714,9 @@ void qsgnode_set_description(QSGNode *node, const QString &description) */ QSGBasicGeometryNode::QSGBasicGeometryNode(NodeType type) : QSGNode(type) - , m_geometry(0) - , m_matrix(0) - , m_clip_list(0) + , m_geometry(nullptr) + , m_matrix(nullptr) + , m_clip_list(nullptr) { } @@ -726,9 +726,9 @@ QSGBasicGeometryNode::QSGBasicGeometryNode(NodeType type) */ QSGBasicGeometryNode::QSGBasicGeometryNode(QSGBasicGeometryNodePrivate &dd, NodeType type) : QSGNode(dd, type) - , m_geometry(0) - , m_matrix(0) - , m_clip_list(0) + , m_geometry(nullptr) + , m_matrix(nullptr) + , m_clip_list(nullptr) { } @@ -871,8 +871,8 @@ void QSGBasicGeometryNode::setGeometry(QSGGeometry *geometry) QSGGeometryNode::QSGGeometryNode() : QSGBasicGeometryNode(GeometryNodeType) , m_render_order(0) - , m_material(0) - , m_opaque_material(0) + , m_material(nullptr) + , m_opaque_material(nullptr) , m_opacity(1) { } @@ -884,8 +884,8 @@ QSGGeometryNode::QSGGeometryNode() QSGGeometryNode::QSGGeometryNode(QSGGeometryNodePrivate &dd) : QSGBasicGeometryNode(dd, GeometryNodeType) , m_render_order(0) - , m_material(0) - , m_opaque_material(0) + , m_material(nullptr) + , m_opaque_material(nullptr) , m_opacity(1) { } @@ -979,7 +979,7 @@ void QSGGeometryNode::setMaterial(QSGMaterial *material) delete m_material; m_material = material; #ifndef QT_NO_DEBUG - if (m_material != 0 && m_opaque_material == m_material) + if (m_material != nullptr && m_opaque_material == m_material) qWarning("QSGGeometryNode: using same material for both opaque and translucent"); #endif markDirty(DirtyMaterial); @@ -1010,7 +1010,7 @@ void QSGGeometryNode::setOpaqueMaterial(QSGMaterial *material) delete m_opaque_material; m_opaque_material = material; #ifndef QT_NO_DEBUG - if (m_opaque_material != 0 && m_opaque_material == m_material) + if (m_opaque_material != nullptr && m_opaque_material == m_material) qWarning("QSGGeometryNode: using same material for both opaque and translucent"); #endif @@ -1274,7 +1274,7 @@ QSGRootNode::QSGRootNode() QSGRootNode::~QSGRootNode() { while (!m_renderers.isEmpty()) - m_renderers.constLast()->setRootNode(0); + m_renderers.constLast()->setRootNode(nullptr); destroy(); // Must call destroy() here because markDirty() casts this to QSGRootNode. } diff --git a/src/quick/scenegraph/coreapi/qsgnodeupdater.cpp b/src/quick/scenegraph/coreapi/qsgnodeupdater.cpp index d6d533307e..8bc9ded594 100644 --- a/src/quick/scenegraph/coreapi/qsgnodeupdater.cpp +++ b/src/quick/scenegraph/coreapi/qsgnodeupdater.cpp @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE QSGNodeUpdater::QSGNodeUpdater() : m_combined_matrix_stack(64) , m_opacity_stack(64) - , m_current_clip(0) + , m_current_clip(nullptr) , m_force_update(0) { m_opacity_stack.add(1); @@ -60,7 +60,7 @@ QSGNodeUpdater::~QSGNodeUpdater() void QSGNodeUpdater::updateStates(QSGNode *n) { - m_current_clip = 0; + m_current_clip = nullptr; m_force_update = 0; Q_ASSERT(m_opacity_stack.size() == 1); // The one we added in the constructr... @@ -82,7 +82,7 @@ void QSGNodeUpdater::updateStates(QSGNode *n) bool QSGNodeUpdater::isNodeBlocked(QSGNode *node, QSGNode *root) const { - while (node != root && node != 0) { + while (node != root && node != nullptr) { if (node->isSubtreeBlocked()) return true; node = node->parent(); diff --git a/src/quick/scenegraph/coreapi/qsgrenderer.cpp b/src/quick/scenegraph/coreapi/qsgrenderer.cpp index 3ae79a933f..e1ba001d2d 100644 --- a/src/quick/scenegraph/coreapi/qsgrenderer.cpp +++ b/src/quick/scenegraph/coreapi/qsgrenderer.cpp @@ -132,8 +132,8 @@ QSGRenderer::QSGRenderer(QSGRenderContext *context) , m_current_determinant(1) , m_device_pixel_ratio(1) , m_context(context) - , m_node_updater(0) - , m_bindable(0) + , m_node_updater(nullptr) + , m_bindable(nullptr) , m_changed_emitted(false) , m_is_rendering(false) , m_is_preprocessing(false) @@ -143,7 +143,7 @@ QSGRenderer::QSGRenderer(QSGRenderContext *context) QSGRenderer::~QSGRenderer() { - setRootNode(0); + setRootNode(nullptr); delete m_node_updater; } @@ -249,7 +249,7 @@ void QSGRenderer::renderScene(const QSGBindable &bindable) m_is_rendering = false; m_changed_emitted = false; - m_bindable = 0; + m_bindable = nullptr; qCDebug(QSG_LOG_TIME_RENDERER, "time in renderer: total=%dms, preprocess=%d, updates=%d, binding=%d, rendering=%d", diff --git a/src/quick/scenegraph/coreapi/qsgrendernode.cpp b/src/quick/scenegraph/coreapi/qsgrendernode.cpp index 5e259f2083..df3fa16a32 100644 --- a/src/quick/scenegraph/coreapi/qsgrendernode.cpp +++ b/src/quick/scenegraph/coreapi/qsgrendernode.cpp @@ -74,8 +74,8 @@ QSGRenderNode::~QSGRenderNode() } QSGRenderNodePrivate::QSGRenderNodePrivate() - : m_matrix(0) - , m_clip_list(0) + : m_matrix(nullptr) + , m_clip_list(nullptr) , m_opacity(1) { } @@ -119,7 +119,7 @@ QSGRenderNodePrivate::QSGRenderNodePrivate() */ QSGRenderNode::StateFlags QSGRenderNode::changedStates() const { - return 0; + return nullptr; } /*! @@ -267,7 +267,7 @@ void QSGRenderNode::releaseResources() */ QSGRenderNode::RenderingFlags QSGRenderNode::flags() const { - return 0; + return nullptr; } /*! |