From 499ec43937e926e4f2fa57a9baa455fcb3862262 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Wed, 21 Feb 2018 10:41:54 +0100 Subject: 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 --- src/particles/qquickimageparticle.cpp | 36 +++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'src/particles/qquickimageparticle.cpp') diff --git a/src/particles/qquickimageparticle.cpp b/src/particles/qquickimageparticle.cpp index 37bf323f42..d2fb78d72a 100644 --- a/src/particles/qquickimageparticle.cpp +++ b/src/particles/qquickimageparticle.cpp @@ -67,7 +67,7 @@ class ImageMaterialData { public: ImageMaterialData() - : texture(0), colorTable(0) + : texture(nullptr), colorTable(nullptr) {} ~ImageMaterialData(){ @@ -701,7 +701,7 @@ void fillUniformArrayFromImage(float* array, const QImage& img, int size) QQuickImageParticle::QQuickImageParticle(QQuickItem* parent) : QQuickParticlePainter(parent) , m_color_variation(0.0) - , m_material(0) + , m_material(nullptr) , m_alphaVariation(0.0) , m_alpha(1.0) , m_redVariation(0.0) @@ -712,9 +712,9 @@ QQuickImageParticle::QQuickImageParticle(QQuickItem* parent) , m_rotationVelocity(0) , m_rotationVelocityVariation(0) , m_autoRotation(false) - , m_xVector(0) - , m_yVector(0) - , m_spriteEngine(0) + , m_xVector(nullptr) + , m_yVector(nullptr) + , m_spriteEngine(nullptr) , m_spritesInterpolate(true) , m_explicitColor(false) , m_explicitRotation(false) @@ -743,7 +743,7 @@ QQmlListProperty QQuickImageParticle::sprites() void QQuickImageParticle::sceneGraphInvalidated() { m_nodes.clear(); - m_material = 0; + m_material = nullptr; } void QQuickImageParticle::setImage(const QUrl &image) @@ -1011,7 +1011,7 @@ void QQuickImageParticle::resetColor() for (auto groupId : groupIds()) { for (QQuickParticleData* d : qAsConst(m_system->groupData[groupId]->data)) { if (d->colorOwner == this) { - d->colorOwner = 0; + d->colorOwner = nullptr; } } } @@ -1030,7 +1030,7 @@ void QQuickImageParticle::resetRotation() for (auto groupId : groupIds()) { for (QQuickParticleData* d : qAsConst(m_system->groupData[groupId]->data)) { if (d->rotationOwner == this) { - d->rotationOwner = 0; + d->rotationOwner = nullptr; } } } @@ -1047,7 +1047,7 @@ void QQuickImageParticle::resetDeformation() for (auto groupId : groupIds()) { for (QQuickParticleData* d : qAsConst(m_system->groupData[groupId]->data)) { if (d->deformationOwner == this) { - d->deformationOwner = 0; + d->deformationOwner = nullptr; } } } @@ -1055,8 +1055,8 @@ void QQuickImageParticle::resetDeformation() delete m_xVector; if (m_yVector) delete m_yVector; - m_xVector = 0; - m_yVector = 0; + m_xVector = nullptr; + m_yVector = nullptr; } void QQuickImageParticle::reset() @@ -1076,7 +1076,7 @@ void QQuickImageParticle::createEngine() this, SLOT(spriteAdvance(int)), Qt::DirectConnection); m_explicitAnimation = true; } else { - m_spriteEngine = 0; + m_spriteEngine = nullptr; m_explicitAnimation = false; } reset(); @@ -1298,7 +1298,7 @@ void QQuickImageParticle::finishBuildParticleNodes(QSGNode** node) clearShadows(); if (m_material) - m_material = 0; + m_material = nullptr; //Setup material QImage colortable; @@ -1473,12 +1473,12 @@ static inline bool isOpenGL(QSGRenderContext *rc) QSGNode *QQuickImageParticle::updatePaintNode(QSGNode *node, UpdatePaintNodeData *) { if (!node && !isOpenGL(QQuickItemPrivate::get(this)->sceneGraphRenderContext())) - return 0; + return nullptr; if (m_pleaseReset){ if (node) delete node; - node = 0; + node = nullptr; m_lastLevel = perfLevel; m_nodes.clear(); @@ -1487,7 +1487,7 @@ QSGNode *QQuickImageParticle::updatePaintNode(QSGNode *node, UpdatePaintNodeData m_startsIdx.clear(); m_lastIdxStart = 0; - m_material = 0; + m_material = nullptr; m_pleaseReset = false; m_startedImageLoading = 0;//Cancel a part-way build (may still have a pending load) @@ -1509,7 +1509,7 @@ QSGNode *QQuickImageParticle::updatePaintNode(QSGNode *node, UpdatePaintNodeData void QQuickImageParticle::prepareNextFrame(QSGNode **node) { - if (*node == 0){//TODO: Staggered loading (as emitted) + if (*node == nullptr){//TODO: Staggered loading (as emitted) buildParticleNodes(node); if (m_debugMode) { qDebug() << "QQuickImageParticle Feature level: " << perfLevel; @@ -1522,7 +1522,7 @@ void QQuickImageParticle::prepareNextFrame(QSGNode **node) } qDebug() << "Total count: " << count; } - if (*node == 0) + if (*node == nullptr) return; } qint64 timeStamp = m_system->systemSync(this); -- cgit v1.2.3