aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2018-02-21 10:41:54 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2018-02-26 07:13:18 +0000
commit499ec43937e926e4f2fa57a9baa455fcb3862262 (patch)
tree206c90d47387f8322b68f5e3db613189397e1af3 /src/quick/scenegraph
parent53d1e9ed21d25e65a2f13606af479838f5f21fe7 (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')
-rw-r--r--src/quick/scenegraph/adaptations/software/qsgsoftwareadaptation.cpp2
-rw-r--r--src/quick/scenegraph/adaptations/software/qsgsoftwareadaptation_p.h2
-rw-r--r--src/quick/scenegraph/adaptations/software/qsgsoftwarecontext.cpp4
-rw-r--r--src/quick/scenegraph/adaptations/software/qsgsoftwareinternalimagenode.cpp6
-rw-r--r--src/quick/scenegraph/adaptations/software/qsgsoftwarelayer.cpp6
-rw-r--r--src/quick/scenegraph/adaptations/software/qsgsoftwarepainternode.cpp2
-rw-r--r--src/quick/scenegraph/adaptations/software/qsgsoftwarepublicnodes.cpp2
-rw-r--r--src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp4
-rw-r--r--src/quick/scenegraph/compressedtexture/qsgcompressedatlastexture.cpp6
-rw-r--r--src/quick/scenegraph/coreapi/qsgabstractrenderer.cpp2
-rw-r--r--src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp98
-rw-r--r--src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h34
-rw-r--r--src/quick/scenegraph/coreapi/qsggeometry.cpp8
-rw-r--r--src/quick/scenegraph/coreapi/qsgmaterial.cpp2
-rw-r--r--src/quick/scenegraph/coreapi/qsgnode.cpp82
-rw-r--r--src/quick/scenegraph/coreapi/qsgnodeupdater.cpp6
-rw-r--r--src/quick/scenegraph/coreapi/qsgrenderer.cpp8
-rw-r--r--src/quick/scenegraph/coreapi/qsgrendernode.cpp8
-rw-r--r--src/quick/scenegraph/qsgadaptationlayer_p.h4
-rw-r--r--src/quick/scenegraph/qsgbasicglyphnode.cpp6
-rw-r--r--src/quick/scenegraph/qsgcontext.cpp2
-rw-r--r--src/quick/scenegraph/qsgcontext_p.h2
-rw-r--r--src/quick/scenegraph/qsgcontextplugin.cpp6
-rw-r--r--src/quick/scenegraph/qsgcontextplugin_p.h6
-rw-r--r--src/quick/scenegraph/qsgdefaultcontext_p.h2
-rw-r--r--src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp10
-rw-r--r--src/quick/scenegraph/qsgdefaultglyphnode_p.cpp30
-rw-r--r--src/quick/scenegraph/qsgdefaultinternalimagenode.cpp6
-rw-r--r--src/quick/scenegraph/qsgdefaultinternalrectanglenode.cpp4
-rw-r--r--src/quick/scenegraph/qsgdefaultlayer.cpp26
-rw-r--r--src/quick/scenegraph/qsgdefaultrendercontext.cpp6
-rw-r--r--src/quick/scenegraph/qsgdefaultrendercontext_p.h2
-rw-r--r--src/quick/scenegraph/qsgdefaultspritenode.cpp4
-rw-r--r--src/quick/scenegraph/qsgdistancefieldglyphnode.cpp12
-rw-r--r--src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp28
-rw-r--r--src/quick/scenegraph/qsgrenderloop.cpp14
-rw-r--r--src/quick/scenegraph/qsgthreadedrenderloop.cpp30
-rw-r--r--src/quick/scenegraph/qsgwindowsrenderloop.cpp12
-rw-r--r--src/quick/scenegraph/util/qsgareaallocator.cpp18
-rw-r--r--src/quick/scenegraph/util/qsgareaallocator_p.h2
-rw-r--r--src/quick/scenegraph/util/qsgatlastexture.cpp16
-rw-r--r--src/quick/scenegraph/util/qsgdefaultpainternode.cpp14
-rw-r--r--src/quick/scenegraph/util/qsgdepthstencilbuffer.cpp6
-rw-r--r--src/quick/scenegraph/util/qsgengine.cpp6
-rw-r--r--src/quick/scenegraph/util/qsgflatcolormaterial.cpp6
-rw-r--r--src/quick/scenegraph/util/qsgshadersourcebuilder.cpp10
-rw-r--r--src/quick/scenegraph/util/qsgsimplematerial.h2
-rw-r--r--src/quick/scenegraph/util/qsgtexture.cpp2
-rw-r--r--src/quick/scenegraph/util/qsgtexturematerial.cpp10
-rw-r--r--src/quick/scenegraph/util/qsgvertexcolormaterial.cpp2
50 files changed, 294 insertions, 294 deletions
diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwareadaptation.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwareadaptation.cpp
index 92c02b4966..a8b5944974 100644
--- a/src/quick/scenegraph/adaptations/software/qsgsoftwareadaptation.cpp
+++ b/src/quick/scenegraph/adaptations/software/qsgsoftwareadaptation.cpp
@@ -87,6 +87,6 @@ QSGRenderLoop *QSGSoftwareAdaptation::createWindowManager()
return new QSGSoftwareRenderLoop();
}
-QSGSoftwareContext *QSGSoftwareAdaptation::instance = 0;
+QSGSoftwareContext *QSGSoftwareAdaptation::instance = nullptr;
QT_END_NAMESPACE
diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwareadaptation_p.h b/src/quick/scenegraph/adaptations/software/qsgsoftwareadaptation_p.h
index ffe54b5d4b..8b2a545033 100644
--- a/src/quick/scenegraph/adaptations/software/qsgsoftwareadaptation_p.h
+++ b/src/quick/scenegraph/adaptations/software/qsgsoftwareadaptation_p.h
@@ -62,7 +62,7 @@ class QSGSoftwareContext;
class QSGSoftwareAdaptation : public QSGContextPlugin
{
public:
- QSGSoftwareAdaptation(QObject *parent = 0);
+ QSGSoftwareAdaptation(QObject *parent = nullptr);
QStringList keys() const override;
QSGContext *create(const QString &key) const override;
diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarecontext.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarecontext.cpp
index aa850a80db..5b5bf005d8 100644
--- a/src/quick/scenegraph/adaptations/software/qsgsoftwarecontext.cpp
+++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarecontext.cpp
@@ -205,12 +205,12 @@ QSGRendererInterface::ShaderType QSGSoftwareContext::shaderType() const
QSGRendererInterface::ShaderCompilationTypes QSGSoftwareContext::shaderCompilationType() const
{
- return 0;
+ return nullptr;
}
QSGRendererInterface::ShaderSourceTypes QSGSoftwareContext::shaderSourceType() const
{
- return 0;
+ return nullptr;
}
void *QSGSoftwareContext::getResource(QQuickWindow *window, Resource resource) const
diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwareinternalimagenode.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwareinternalimagenode.cpp
index 8843b6450a..3b0f3c48ff 100644
--- a/src/quick/scenegraph/adaptations/software/qsgsoftwareinternalimagenode.cpp
+++ b/src/quick/scenegraph/adaptations/software/qsgsoftwareinternalimagenode.cpp
@@ -318,7 +318,7 @@ void qDrawBorderPixmap(QPainter *painter, const QRect &targetRect, const QMargin
QSGSoftwareInternalImageNode::QSGSoftwareInternalImageNode()
: m_innerSourceRect(0, 0, 1, 1)
, m_subSourceRect(0, 0, 1, 1)
- , m_texture(0)
+ , m_texture(nullptr)
, m_mirror(false)
, m_smooth(true)
, m_tileHorizontal(false)
@@ -462,7 +462,7 @@ void QSGSoftwareInternalImageNode::paint(QPainter *painter)
m_targetRect.right() - m_innerTargetRect.right(), m_targetRect.bottom() - m_innerTargetRect.bottom());
QSGSoftwareHelpers::QTileRules tilerules(getTileRule(m_subSourceRect.width()), getTileRule(m_subSourceRect.height()));
QSGSoftwareHelpers::qDrawBorderPixmap(painter, m_targetRect.toRect(), margins, pm, QRect(0, 0, pm.width(), pm.height()),
- margins, tilerules, QSGSoftwareHelpers::QDrawBorderPixmap::DrawingHints(0));
+ margins, tilerules, QSGSoftwareHelpers::QDrawBorderPixmap::DrawingHints(nullptr));
return;
}
@@ -494,7 +494,7 @@ const QPixmap &QSGSoftwareInternalImageNode::pixmap() const
return pt->pixmap();
if (QSGSoftwareLayer *layer = qobject_cast<QSGSoftwareLayer*>(m_texture))
return layer->pixmap();
- Q_ASSERT(m_texture == 0);
+ Q_ASSERT(m_texture == nullptr);
static const QPixmap nullPixmap;
return nullPixmap;
}
diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarelayer.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarelayer.cpp
index 9d30c43f87..b4301451d8 100644
--- a/src/quick/scenegraph/adaptations/software/qsgsoftwarelayer.cpp
+++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarelayer.cpp
@@ -45,9 +45,9 @@
QT_BEGIN_NAMESPACE
QSGSoftwareLayer::QSGSoftwareLayer(QSGRenderContext *renderContext)
- : m_item(0)
+ : m_item(nullptr)
, m_context(renderContext)
- , m_renderer(0)
+ , m_renderer(nullptr)
, m_device_pixel_ratio(1)
, m_mirrorHorizontal(false)
, m_mirrorVertical(true)
@@ -203,7 +203,7 @@ void QSGSoftwareLayer::markDirtyTexture()
void QSGSoftwareLayer::invalidated()
{
delete m_renderer;
- m_renderer = 0;
+ m_renderer = nullptr;
}
void QSGSoftwareLayer::grab()
diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarepainternode.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarepainternode.cpp
index 34b0cd5b72..60ae06dd94 100644
--- a/src/quick/scenegraph/adaptations/software/qsgsoftwarepainternode.cpp
+++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarepainternode.cpp
@@ -47,7 +47,7 @@ QSGSoftwarePainterNode::QSGSoftwarePainterNode(QQuickPaintedItem *item)
: QSGPainterNode()
, m_preferredRenderTarget(QQuickPaintedItem::Image)
, m_item(item)
- , m_texture(0)
+ , m_texture(nullptr)
, m_dirtyContents(false)
, m_opaquePainting(false)
, m_linear_filtering(false)
diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarepublicnodes.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarepublicnodes.cpp
index 77d21ec042..1463681fa3 100644
--- a/src/quick/scenegraph/adaptations/software/qsgsoftwarepublicnodes.cpp
+++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarepublicnodes.cpp
@@ -188,7 +188,7 @@ void QSGSoftwareNinePatchNode::paint(QPainter *painter)
painter->drawPixmap(m_bounds, m_pixmap, QRectF(0, 0, m_pixmap.width(), m_pixmap.height()));
else
QSGSoftwareHelpers::qDrawBorderPixmap(painter, m_bounds.toRect(), m_margins, m_pixmap, QRect(0, 0, m_pixmap.width(), m_pixmap.height()),
- m_margins, Qt::StretchTile, QSGSoftwareHelpers::QDrawBorderPixmap::DrawingHints(0));
+ m_margins, Qt::StretchTile, QSGSoftwareHelpers::QDrawBorderPixmap::DrawingHints(nullptr));
}
QRectF QSGSoftwareNinePatchNode::bounds() const
diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp
index a7485a90eb..f8973af2fb 100644
--- a/src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp
+++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp
@@ -294,7 +294,7 @@ bool QSGSoftwareRenderThread::event(QEvent *e)
}
rc->invalidate();
QCoreApplication::processEvents();
- QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete);
if (wme->destroying)
delete wd->animationController;
}
@@ -456,7 +456,7 @@ void QSGSoftwareRenderThread::sync(bool inExpose)
// Process deferred deletes now, directly after the sync as deleteLater
// on the GUI must now also have resulted in SG changes and the delete
// is a safe operation.
- QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete);
}
if (!inExpose) {
diff --git a/src/quick/scenegraph/compressedtexture/qsgcompressedatlastexture.cpp b/src/quick/scenegraph/compressedtexture/qsgcompressedatlastexture.cpp
index 301f2826dc..e868a4380e 100644
--- a/src/quick/scenegraph/compressedtexture/qsgcompressedatlastexture.cpp
+++ b/src/quick/scenegraph/compressedtexture/qsgcompressedatlastexture.cpp
@@ -84,7 +84,7 @@ Texture *Atlas::create(const QByteArray &data, int dataLength, int dataOffset, c
m_pending_uploads << t;
return t;
}
- return 0;
+ return nullptr;
}
void Atlas::generateTexture()
@@ -93,7 +93,7 @@ void Atlas::generateTexture()
funcs->glCompressedTexImage2D(GL_TEXTURE_2D, 0, m_format,
m_size.width(), m_size.height(), 0,
(m_size.width() * m_size.height()) / 2,
- 0);
+ nullptr);
}
void Atlas::uploadPendingTexture(int i)
@@ -119,7 +119,7 @@ void Atlas::uploadPendingTexture(int i)
Texture::Texture(Atlas *atlas, const QRect &textureRect, const QByteArray &data, int dataLength, int dataOffset, const QSize &size)
: QSGAtlasTexture::TextureBase(atlas, textureRect)
- , m_nonatlas_texture(0)
+ , m_nonatlas_texture(nullptr)
, m_data(data)
, m_size(size)
, m_dataLength(dataLength)
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;
}
/*!
diff --git a/src/quick/scenegraph/qsgadaptationlayer_p.h b/src/quick/scenegraph/qsgadaptationlayer_p.h
index ba146b884f..f1d8493e85 100644
--- a/src/quick/scenegraph/qsgadaptationlayer_p.h
+++ b/src/quick/scenegraph/qsgadaptationlayer_p.h
@@ -373,7 +373,7 @@ public:
HighQualitySubPixelAntialiasing
};
- QSGGlyphNode() : m_ownerElement(0) {}
+ QSGGlyphNode() : m_ownerElement(nullptr) {}
virtual void setGlyphs(const QPointF &position, const QGlyphRun &glyphs) = 0;
virtual void setColor(const QColor &color) = 0;
@@ -484,7 +484,7 @@ protected:
QPainterPath path;
quint32 ref;
- GlyphData() : texture(0), ref(0) { }
+ GlyphData() : texture(nullptr), ref(0) { }
};
virtual void requestGlyphs(const QSet<glyph_t> &glyphs) = 0;
diff --git a/src/quick/scenegraph/qsgbasicglyphnode.cpp b/src/quick/scenegraph/qsgbasicglyphnode.cpp
index 38f650a82c..4559b7951c 100644
--- a/src/quick/scenegraph/qsgbasicglyphnode.cpp
+++ b/src/quick/scenegraph/qsgbasicglyphnode.cpp
@@ -44,7 +44,7 @@ QT_BEGIN_NAMESPACE
QSGBasicGlyphNode::QSGBasicGlyphNode()
: m_style(QQuickText::Normal)
- , m_material(0)
+ , m_material(nullptr)
, m_geometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 0)
{
m_geometry.setDrawingMode(QSGGeometry::DrawTriangles);
@@ -59,7 +59,7 @@ QSGBasicGlyphNode::~QSGBasicGlyphNode()
void QSGBasicGlyphNode::setColor(const QColor &color)
{
m_color = color;
- if (m_material != 0) {
+ if (m_material != nullptr) {
setMaterialColor(color);
markDirty(DirtyMaterial);
}
@@ -67,7 +67,7 @@ void QSGBasicGlyphNode::setColor(const QColor &color)
void QSGBasicGlyphNode::setGlyphs(const QPointF &position, const QGlyphRun &glyphs)
{
- if (m_material != 0)
+ if (m_material != nullptr)
delete m_material;
m_position = position;
diff --git a/src/quick/scenegraph/qsgcontext.cpp b/src/quick/scenegraph/qsgcontext.cpp
index a6819b338d..d9ed25c099 100644
--- a/src/quick/scenegraph/qsgcontext.cpp
+++ b/src/quick/scenegraph/qsgcontext.cpp
@@ -372,7 +372,7 @@ void QSGRenderContext::registerFontengineForCleanup(QFontEngine *engine)
QSGTexture *QSGRenderContext::textureForFactory(QQuickTextureFactory *factory, QQuickWindow *window)
{
if (!factory)
- return 0;
+ return nullptr;
m_mutex.lock();
QSGTexture *texture = m_textures.value(factory);
diff --git a/src/quick/scenegraph/qsgcontext_p.h b/src/quick/scenegraph/qsgcontext_p.h
index da0adcd5d7..00c23be60c 100644
--- a/src/quick/scenegraph/qsgcontext_p.h
+++ b/src/quick/scenegraph/qsgcontext_p.h
@@ -110,7 +110,7 @@ public:
MsaaAntialiasing
};
- explicit QSGContext(QObject *parent = 0);
+ explicit QSGContext(QObject *parent = nullptr);
virtual ~QSGContext();
virtual void renderContextInitialized(QSGRenderContext *renderContext);
diff --git a/src/quick/scenegraph/qsgcontextplugin.cpp b/src/quick/scenegraph/qsgcontextplugin.cpp
index 634a492aa3..a697c315a3 100644
--- a/src/quick/scenegraph/qsgcontextplugin.cpp
+++ b/src/quick/scenegraph/qsgcontextplugin.cpp
@@ -87,7 +87,7 @@ struct QSGAdaptationBackendData
QSGAdaptationBackendData::QSGAdaptationBackendData()
: tried(false)
, factory(nullptr)
- , flags(0)
+ , flags(nullptr)
{
// Fill in the table with the built-in adaptations.
builtIns.append(new QSGSoftwareAdaptation);
@@ -209,7 +209,7 @@ QQuickTextureFactory *QSGContext::createTextureFactoryFromImage(const QImage &im
QSGAdaptationBackendData *backendData = contextFactory();
if (backendData->factory)
return backendData->factory->createTextureFactoryFromImage(image);
- return 0;
+ return nullptr;
}
@@ -223,7 +223,7 @@ QSGRenderLoop *QSGContext::createWindowManager()
QSGAdaptationBackendData *backendData = contextFactory();
if (backendData->factory)
return backendData->factory->createWindowManager();
- return 0;
+ return nullptr;
}
void QSGContext::setBackend(const QString &backend)
diff --git a/src/quick/scenegraph/qsgcontextplugin_p.h b/src/quick/scenegraph/qsgcontextplugin_p.h
index 02d4b79b76..d37d4df270 100644
--- a/src/quick/scenegraph/qsgcontextplugin_p.h
+++ b/src/quick/scenegraph/qsgcontextplugin_p.h
@@ -87,13 +87,13 @@ class Q_QUICK_PRIVATE_EXPORT QSGContextPlugin : public QObject, public QSGContex
Q_OBJECT
Q_INTERFACES(QSGContextFactoryInterface:QFactoryInterface)
public:
- explicit QSGContextPlugin(QObject *parent = 0);
+ explicit QSGContextPlugin(QObject *parent = nullptr);
virtual ~QSGContextPlugin();
QStringList keys() const override = 0;
- QQuickTextureFactory *createTextureFactoryFromImage(const QImage &) override { return 0; }
- QSGRenderLoop *createWindowManager() override { return 0; }
+ QQuickTextureFactory *createTextureFactoryFromImage(const QImage &) override { return nullptr; }
+ QSGRenderLoop *createWindowManager() override { return nullptr; }
};
QT_END_NAMESPACE
diff --git a/src/quick/scenegraph/qsgdefaultcontext_p.h b/src/quick/scenegraph/qsgdefaultcontext_p.h
index b2964bf403..6dfd197cf6 100644
--- a/src/quick/scenegraph/qsgdefaultcontext_p.h
+++ b/src/quick/scenegraph/qsgdefaultcontext_p.h
@@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE
class Q_QUICK_PRIVATE_EXPORT QSGDefaultContext : public QSGContext, public QSGRendererInterface
{
public:
- QSGDefaultContext(QObject *parent = 0);
+ QSGDefaultContext(QObject *parent = nullptr);
~QSGDefaultContext();
void renderContextInitialized(QSGRenderContext *renderContext) override;
diff --git a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp
index 7789ef8fb1..ef189ba461 100644
--- a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp
+++ b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp
@@ -63,12 +63,12 @@ QSGDefaultDistanceFieldGlyphCache::QSGDefaultDistanceFieldGlyphCache(QOpenGLCont
: QSGDistanceFieldGlyphCache(c, font)
, m_maxTextureSize(0)
, m_maxTextureCount(3)
- , m_blitProgram(0)
+ , m_blitProgram(nullptr)
, m_blitBuffer(QOpenGLBuffer::VertexBuffer)
- , m_fboGuard(0)
+ , m_fboGuard(nullptr)
, m_funcs(c->functions())
#if !defined(QT_OPENGL_ES_2)
- , m_coreFuncs(0)
+ , m_coreFuncs(nullptr)
#endif
{
if (Q_LIKELY(m_blitBuffer.create())) {
@@ -89,7 +89,7 @@ QSGDefaultDistanceFieldGlyphCache::~QSGDefaultDistanceFieldGlyphCache()
for (int i = 0; i < m_textures.count(); ++i)
m_funcs->glDeleteTextures(1, &m_textures[i].texture);
- if (m_fboGuard != 0)
+ if (m_fboGuard != nullptr)
m_fboGuard->free();
delete m_blitProgram;
@@ -400,7 +400,7 @@ void QSGDefaultDistanceFieldGlyphCache::resizeTexture(TextureInfo *texInfo, int
m_funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
#endif
m_funcs->glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, oldWidth, oldHeight, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
m_funcs->glBindTexture(GL_TEXTURE_2D, 0);
m_funcs->glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
GL_TEXTURE_2D, tmp_texture, 0);
diff --git a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
index 0169f097bc..dc473a6640 100644
--- a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
+++ b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
@@ -107,7 +107,7 @@ protected:
char const *const *QSGTextMaskShader::attributeNames() const
{
- static char const *const attr[] = { "vCoord", "tCoord", 0 };
+ static char const *const attr[] = { "vCoord", "tCoord", nullptr };
return attr;
}
@@ -141,13 +141,13 @@ void QSGTextMaskShader::updateState(const RenderState &state, QSGMaterial *newEf
{
QSGTextMaskMaterial *material = static_cast<QSGTextMaskMaterial *>(newEffect);
QSGTextMaskMaterial *oldMaterial = static_cast<QSGTextMaskMaterial *>(oldEffect);
- Q_ASSERT(oldEffect == 0 || newEffect->type() == oldEffect->type());
+ Q_ASSERT(oldEffect == nullptr || newEffect->type() == oldEffect->type());
bool updated = material->ensureUpToDate();
Q_ASSERT(material->texture());
- Q_ASSERT(oldMaterial == 0 || oldMaterial->texture());
+ Q_ASSERT(oldMaterial == nullptr || oldMaterial->texture());
if (updated
- || oldMaterial == 0
+ || oldMaterial == nullptr
|| oldMaterial->texture()->textureId() != material->texture()->textureId()) {
program()->setUniformValue(m_textureScale_id, QVector2D(1.0 / material->cacheTextureWidth(),
1.0 / material->cacheTextureHeight()));
@@ -190,7 +190,7 @@ void QSG8BitTextMaskShader::updateState(const RenderState &state, QSGMaterial *n
QSGTextMaskMaterial *material = static_cast<QSGTextMaskMaterial *>(newEffect);
QSGTextMaskMaterial *oldMaterial = static_cast<QSGTextMaskMaterial *>(oldEffect);
- if (oldMaterial == 0 || material->color() != oldMaterial->color() || state.isOpacityDirty()) {
+ if (oldMaterial == nullptr || material->color() != oldMaterial->color() || state.isOpacityDirty()) {
QVector4D color = qsg_premultiply(material->color(), state.opacity());
program()->setUniformValue(m_color_id, color);
}
@@ -282,7 +282,7 @@ void QSG24BitTextMaskShader::updateState(const RenderState &state, QSGMaterial *
QSGTextMaskMaterial *material = static_cast<QSGTextMaskMaterial *>(newEffect);
QSGTextMaskMaterial *oldMaterial = static_cast<QSGTextMaskMaterial *>(oldEffect);
- if (oldMaterial == 0 || material->color() != oldMaterial->color() || state.isOpacityDirty()) {
+ if (oldMaterial == nullptr || material->color() != oldMaterial->color() || state.isOpacityDirty()) {
QVector4D color = material->color();
if (useSRGB())
color = qt_sRGB_to_linear_RGB(color);
@@ -346,20 +346,20 @@ void QSGStyledTextShader::updateState(const RenderState &state,
QSGMaterial *newEffect,
QSGMaterial *oldEffect)
{
- Q_ASSERT(oldEffect == 0 || newEffect->type() == oldEffect->type());
+ Q_ASSERT(oldEffect == nullptr || newEffect->type() == oldEffect->type());
QSGStyledTextMaterial *material = static_cast<QSGStyledTextMaterial *>(newEffect);
QSGStyledTextMaterial *oldMaterial = static_cast<QSGStyledTextMaterial *>(oldEffect);
- if (oldMaterial == 0 || oldMaterial->styleShift() != material->styleShift())
+ if (oldMaterial == nullptr || oldMaterial->styleShift() != material->styleShift())
program()->setUniformValue(m_shift_id, material->styleShift());
- if (oldMaterial == 0 || material->color() != oldMaterial->color() || state.isOpacityDirty()) {
+ if (oldMaterial == nullptr || material->color() != oldMaterial->color() || state.isOpacityDirty()) {
QVector4D color = qsg_premultiply(material->color(), state.opacity());
program()->setUniformValue(m_color_id, color);
}
- if (oldMaterial == 0 || material->styleColor() != oldMaterial->styleColor() || state.isOpacityDirty()) {
+ if (oldMaterial == nullptr || material->styleColor() != oldMaterial->styleColor() || state.isOpacityDirty()) {
QVector4D styleColor = qsg_premultiply(material->styleColor(), state.opacity());
program()->setUniformValue(m_styleColor_id, styleColor);
}
@@ -367,9 +367,9 @@ void QSGStyledTextShader::updateState(const RenderState &state,
bool updated = material->ensureUpToDate();
Q_ASSERT(material->texture());
- Q_ASSERT(oldMaterial == 0 || oldMaterial->texture());
+ Q_ASSERT(oldMaterial == nullptr || oldMaterial->texture());
if (updated
- || oldMaterial == 0
+ || oldMaterial == nullptr
|| oldMaterial->texture()->textureId() != material->texture()->textureId()) {
program()->setUniformValue(m_textureScale_id, QVector2D(1.0 / material->cacheTextureWidth(),
1.0 / material->cacheTextureHeight()));
@@ -400,8 +400,8 @@ public:
};
QSGTextMaskMaterial::QSGTextMaskMaterial(const QRawFont &font, QFontEngine::GlyphFormat glyphFormat)
- : m_texture(0)
- , m_glyphCache(0)
+ : m_texture(nullptr)
+ , m_glyphCache(nullptr)
, m_font(font)
{
init(glyphFormat);
@@ -419,7 +419,7 @@ void QSGTextMaskMaterial::init(QFontEngine::GlyphFormat glyphFormat)
setFlag(Blending, true);
QOpenGLContext *ctx = const_cast<QOpenGLContext *>(QOpenGLContext::currentContext());
- Q_ASSERT(ctx != 0);
+ Q_ASSERT(ctx != nullptr);
// The following piece of code will read/write to the font engine's caches,
// potentially from different threads. However, this is safe because this
diff --git a/src/quick/scenegraph/qsgdefaultinternalimagenode.cpp b/src/quick/scenegraph/qsgdefaultinternalimagenode.cpp
index a5a6da06a7..7e6d6d0d07 100644
--- a/src/quick/scenegraph/qsgdefaultinternalimagenode.cpp
+++ b/src/quick/scenegraph/qsgdefaultinternalimagenode.cpp
@@ -91,7 +91,7 @@ SmoothTextureMaterialShader::SmoothTextureMaterialShader()
void SmoothTextureMaterialShader::updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect)
{
- if (oldEffect == 0) {
+ if (oldEffect == nullptr) {
// The viewport is constant, so set the pixel size uniform only once.
QRect r = state.viewportRect();
program()->setUniformValue(m_pixelSizeLoc, 2.0f / r.width(), 2.0f / r.height());
@@ -106,7 +106,7 @@ char const *const *SmoothTextureMaterialShader::attributeNames() const
"multiTexCoord",
"vertexOffset",
"texCoordOffset",
- 0
+ nullptr
};
return attributes;
}
@@ -171,7 +171,7 @@ void QSGDefaultInternalImageNode::updateMaterialAntialiasing()
{
if (m_antialiasing) {
setMaterial(&m_smoothMaterial);
- setOpaqueMaterial(0);
+ setOpaqueMaterial(nullptr);
} else {
setMaterial(&m_materialO);
setOpaqueMaterial(&m_material);
diff --git a/src/quick/scenegraph/qsgdefaultinternalrectanglenode.cpp b/src/quick/scenegraph/qsgdefaultinternalrectanglenode.cpp
index e52dcaad52..ef8a13931e 100644
--- a/src/quick/scenegraph/qsgdefaultinternalrectanglenode.cpp
+++ b/src/quick/scenegraph/qsgdefaultinternalrectanglenode.cpp
@@ -81,7 +81,7 @@ void SmoothColorMaterialShader::updateState(const RenderState &state, QSGMateria
if (state.isMatrixDirty())
program()->setUniformValue(m_matrixLoc, state.combinedMatrix());
- if (oldEffect == 0) {
+ if (oldEffect == nullptr) {
// The viewport is constant, so set the pixel size uniform only once.
QRect r = state.viewportRect();
program()->setUniformValue(m_pixelSizeLoc, 2.0f / r.width(), 2.0f / r.height());
@@ -94,7 +94,7 @@ char const *const *SmoothColorMaterialShader::attributeNames() const
"vertex",
"vertexColor",
"vertexOffset",
- 0
+ nullptr
};
return attributes;
}
diff --git a/src/quick/scenegraph/qsgdefaultlayer.cpp b/src/quick/scenegraph/qsgdefaultlayer.cpp
index cd9c4a9a90..b2b123912f 100644
--- a/src/quick/scenegraph/qsgdefaultlayer.cpp
+++ b/src/quick/scenegraph/qsgdefaultlayer.cpp
@@ -90,15 +90,15 @@ namespace
QSGDefaultLayer::QSGDefaultLayer(QSGRenderContext *context)
: QSGLayer()
- , m_item(0)
+ , m_item(nullptr)
, m_device_pixel_ratio(1)
, m_format(GL_RGBA)
- , m_renderer(0)
- , m_fbo(0)
- , m_secondaryFbo(0)
+ , m_renderer(nullptr)
+ , m_fbo(nullptr)
+ , m_secondaryFbo(nullptr)
, m_transparentTexture(0)
#ifdef QSG_DEBUG_FBO_OVERLAY
- , m_debugOverlay(0)
+ , m_debugOverlay(nullptr)
#endif
, m_samples(0)
, m_mipmap(false)
@@ -122,13 +122,13 @@ QSGDefaultLayer::~QSGDefaultLayer()
void QSGDefaultLayer::invalidated()
{
delete m_renderer;
- m_renderer = 0;
+ m_renderer = nullptr;
delete m_fbo;
delete m_secondaryFbo;
- m_fbo = m_secondaryFbo = 0;
+ m_fbo = m_secondaryFbo = nullptr;
#ifdef QSG_DEBUG_FBO_OVERLAY
delete m_debugOverlay;
- m_debugOverlay = 0;
+ m_debugOverlay = nullptr;
#endif
if (m_transparentTexture) {
QOpenGLContext::currentContext()->functions()->glDeleteTextures(1, &m_transparentTexture);
@@ -204,7 +204,7 @@ void QSGDefaultLayer::setItem(QSGNode *item)
if (m_live && !m_item) {
delete m_fbo;
delete m_secondaryFbo;
- m_fbo = m_secondaryFbo = 0;
+ m_fbo = m_secondaryFbo = nullptr;
m_depthStencilBuffer.clear();
}
@@ -228,7 +228,7 @@ void QSGDefaultLayer::setSize(const QSize &size)
if (m_live && m_size.isNull()) {
delete m_fbo;
delete m_secondaryFbo;
- m_fbo = m_secondaryFbo = 0;
+ m_fbo = m_secondaryFbo = nullptr;
m_depthStencilBuffer.clear();
}
@@ -252,7 +252,7 @@ void QSGDefaultLayer::setLive(bool live)
if (m_live && (!m_item || m_size.isNull())) {
delete m_fbo;
delete m_secondaryFbo;
- m_fbo = m_secondaryFbo = 0;
+ m_fbo = m_secondaryFbo = nullptr;
m_depthStencilBuffer.clear();
}
@@ -295,7 +295,7 @@ void QSGDefaultLayer::grab()
if (!m_item || m_size.isNull()) {
delete m_fbo;
delete m_secondaryFbo;
- m_fbo = m_secondaryFbo = 0;
+ m_fbo = m_secondaryFbo = nullptr;
m_depthStencilBuffer.clear();
m_dirtyTexture = false;
return;
@@ -362,7 +362,7 @@ void QSGDefaultLayer::grab()
delete m_fbo;
delete m_secondaryFbo;
m_fbo = new QOpenGLFramebufferObject(m_size, format);
- m_secondaryFbo = 0;
+ m_secondaryFbo = nullptr;
funcs->glBindTexture(GL_TEXTURE_2D, m_fbo->texture());
updateBindOptions(true);
m_depthStencilBuffer = m_context->depthStencilBufferForFbo(m_fbo);
diff --git a/src/quick/scenegraph/qsgdefaultrendercontext.cpp b/src/quick/scenegraph/qsgdefaultrendercontext.cpp
index 12357f12c7..7882496062 100644
--- a/src/quick/scenegraph/qsgdefaultrendercontext.cpp
+++ b/src/quick/scenegraph/qsgdefaultrendercontext.cpp
@@ -157,14 +157,14 @@ void QSGDefaultRenderContext::invalidate()
m_fontEnginesToClean.clear();
delete m_depthStencilManager;
- m_depthStencilManager = 0;
+ m_depthStencilManager = nullptr;
qDeleteAll(m_glyphCaches);
m_glyphCaches.clear();
if (m_gl->property(QSG_RENDERCONTEXT_PROPERTY) == QVariant::fromValue(this))
m_gl->setProperty(QSG_RENDERCONTEXT_PROPERTY, QVariant());
- m_gl = 0;
+ m_gl = nullptr;
if (m_sg)
m_sg->renderContextInvalidated(this);
@@ -211,7 +211,7 @@ QSharedPointer<QSGDepthStencilBuffer> QSGDefaultRenderContext::depthStencilBuffe
QSGDepthStencilBufferManager *QSGDefaultRenderContext::depthStencilBufferManager()
{
if (!m_gl)
- return 0;
+ return nullptr;
if (!m_depthStencilManager)
m_depthStencilManager = new QSGDepthStencilBufferManager(m_gl);
return m_depthStencilManager;
diff --git a/src/quick/scenegraph/qsgdefaultrendercontext_p.h b/src/quick/scenegraph/qsgdefaultrendercontext_p.h
index 68329256f1..eb62586a94 100644
--- a/src/quick/scenegraph/qsgdefaultrendercontext_p.h
+++ b/src/quick/scenegraph/qsgdefaultrendercontext_p.h
@@ -86,7 +86,7 @@ public:
QSGRenderer *createRenderer() override;
QSGTexture *compressedTextureForFactory(const QSGCompressedTextureFactory *factory) const override;
- virtual void compileShader(QSGMaterialShader *shader, QSGMaterial *material, const char *vertexCode = 0, const char *fragmentCode = 0);
+ virtual void compileShader(QSGMaterialShader *shader, QSGMaterial *material, const char *vertexCode = nullptr, const char *fragmentCode = nullptr);
virtual void initializeShader(QSGMaterialShader *shader);
void setAttachToGraphicsContext(bool attach) override;
diff --git a/src/quick/scenegraph/qsgdefaultspritenode.cpp b/src/quick/scenegraph/qsgdefaultspritenode.cpp
index 7fe6048d59..c9a9625f2b 100644
--- a/src/quick/scenegraph/qsgdefaultspritenode.cpp
+++ b/src/quick/scenegraph/qsgdefaultspritenode.cpp
@@ -82,7 +82,7 @@ public:
};
QQuickSpriteMaterial::QQuickSpriteMaterial()
- : texture(0)
+ : texture(nullptr)
, animT(0.0f)
, animX1(0.0f)
, animY1(0.0f)
@@ -133,7 +133,7 @@ public:
static const char *attr[] = {
"vPos",
"vTex",
- 0
+ nullptr
};
return attr;
}
diff --git a/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp b/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp
index 32eda2d142..ae6336718e 100644
--- a/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp
+++ b/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp
@@ -46,12 +46,12 @@ QT_BEGIN_NAMESPACE
QSGDistanceFieldGlyphNode::QSGDistanceFieldGlyphNode(QSGRenderContext *context)
: m_glyphNodeType(RootGlyphNode)
, m_context(context)
- , m_material(0)
- , m_glyph_cache(0)
+ , m_material(nullptr)
+ , m_glyph_cache(nullptr)
, m_geometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 0)
, m_style(QQuickText::Normal)
, m_antialiasingMode(GrayAntialiasing)
- , m_texture(0)
+ , m_texture(nullptr)
, m_dirtyGeometry(false)
, m_dirtyMaterial(false)
{
@@ -80,7 +80,7 @@ QSGDistanceFieldGlyphNode::~QSGDistanceFieldGlyphNode()
void QSGDistanceFieldGlyphNode::setColor(const QColor &color)
{
m_color = color;
- if (m_material != 0) {
+ if (m_material != nullptr) {
m_material->setColor(color);
markDirty(DirtyMaterial);
} else {
@@ -113,7 +113,7 @@ void QSGDistanceFieldGlyphNode::setGlyphs(const QPointF &position, const QGlyphR
return;
if (m_glyph_cache != oldCache) {
- Q_ASSERT(ownerElement() != 0);
+ Q_ASSERT(ownerElement() != nullptr);
if (oldCache) {
oldCache->unregisterGlyphNode(this);
oldCache->unregisterOwnerElement(ownerElement());
@@ -181,7 +181,7 @@ void QSGDistanceFieldGlyphNode::updateGeometry()
// Remove previously created sub glyph nodes
// We assume all the children are sub glyph nodes
QSGNode *subnode = firstChild();
- QSGNode *nextNode = 0;
+ QSGNode *nextNode = nullptr;
while (subnode) {
nextNode = subnode->nextSibling();
delete subnode;
diff --git a/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp b/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp
index 03c5738e56..dd2d787495 100644
--- a/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp
+++ b/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp
@@ -77,7 +77,7 @@ protected:
};
char const *const *QSGDistanceFieldTextMaterialShader::attributeNames() const {
- static char const *const attr[] = { "vCoord", "tCoord", 0 };
+ static char const *const attr[] = { "vCoord", "tCoord", nullptr };
return attr;
}
@@ -166,13 +166,13 @@ void QSGDistanceFieldTextMaterialShader::initialize()
void QSGDistanceFieldTextMaterialShader::updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect)
{
- Q_ASSERT(oldEffect == 0 || newEffect->type() == oldEffect->type());
+ Q_ASSERT(oldEffect == nullptr || newEffect->type() == oldEffect->type());
QSGDistanceFieldTextMaterial *material = static_cast<QSGDistanceFieldTextMaterial *>(newEffect);
QSGDistanceFieldTextMaterial *oldMaterial = static_cast<QSGDistanceFieldTextMaterial *>(oldEffect);
bool updated = material->updateTextureSize();
- if (oldMaterial == 0
+ if (oldMaterial == nullptr
|| material->color() != oldMaterial->color()
|| state.isOpacityDirty()) {
QVector4D color = material->color();
@@ -181,7 +181,7 @@ void QSGDistanceFieldTextMaterialShader::updateState(const RenderState &state, Q
}
bool updateRange = false;
- if (oldMaterial == 0
+ if (oldMaterial == nullptr
|| material->fontScale() != oldMaterial->fontScale()) {
m_fontScale = material->fontScale();
updateRange = true;
@@ -198,7 +198,7 @@ void QSGDistanceFieldTextMaterialShader::updateState(const RenderState &state, Q
Q_ASSERT(material->glyphCache());
if (updated
- || oldMaterial == 0
+ || oldMaterial == nullptr
|| oldMaterial->texture()->textureId != material->texture()->textureId) {
updateTextureScale(QVector2D(1.0 / material->textureSize().width(),
1.0 / material->textureSize().height()));
@@ -218,8 +218,8 @@ void QSGDistanceFieldTextMaterialShader::updateState(const RenderState &state, Q
}
QSGDistanceFieldTextMaterial::QSGDistanceFieldTextMaterial()
- : m_glyph_cache(0)
- , m_texture(0)
+ : m_glyph_cache(nullptr)
+ , m_texture(nullptr)
, m_fontScale(1.0)
{
setFlag(Blending | RequiresDeterminant, true);
@@ -310,7 +310,7 @@ void DistanceFieldStyledTextMaterialShader::updateState(const RenderState &state
QSGDistanceFieldStyledTextMaterial *material = static_cast<QSGDistanceFieldStyledTextMaterial *>(newEffect);
QSGDistanceFieldStyledTextMaterial *oldMaterial = static_cast<QSGDistanceFieldStyledTextMaterial *>(oldEffect);
- if (oldMaterial == 0
+ if (oldMaterial == nullptr
|| material->styleColor() != oldMaterial->styleColor()
|| (state.isOpacityDirty())) {
QVector4D color = material->styleColor();
@@ -398,7 +398,7 @@ void DistanceFieldOutlineTextMaterialShader::updateState(const RenderState &stat
QSGDistanceFieldOutlineTextMaterial *material = static_cast<QSGDistanceFieldOutlineTextMaterial *>(newEffect);
QSGDistanceFieldOutlineTextMaterial *oldMaterial = static_cast<QSGDistanceFieldOutlineTextMaterial *>(oldEffect);
- if (oldMaterial == 0
+ if (oldMaterial == nullptr
|| material->fontScale() != oldMaterial->fontScale()
|| state.isMatrixDirty())
updateOutlineAlphaRange(material->glyphCache()->distanceFieldRadius());
@@ -462,7 +462,7 @@ void DistanceFieldShiftedStyleTextMaterialShader::updateState(const RenderState
QSGDistanceFieldShiftedStyleTextMaterial *material = static_cast<QSGDistanceFieldShiftedStyleTextMaterial *>(newEffect);
QSGDistanceFieldShiftedStyleTextMaterial *oldMaterial = static_cast<QSGDistanceFieldShiftedStyleTextMaterial *>(oldEffect);
- if (oldMaterial == 0
+ if (oldMaterial == nullptr
|| oldMaterial->fontScale() != material->fontScale()
|| oldMaterial->shift() != material->shift()
|| oldMaterial->textureSize() != material->textureSize()) {
@@ -550,19 +550,19 @@ void QSGHiQSubPixelDistanceFieldTextMaterialShader::deactivate()
void QSGHiQSubPixelDistanceFieldTextMaterialShader::updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect)
{
- Q_ASSERT(oldEffect == 0 || newEffect->type() == oldEffect->type());
+ Q_ASSERT(oldEffect == nullptr || newEffect->type() == oldEffect->type());
QSGDistanceFieldTextMaterial *material = static_cast<QSGDistanceFieldTextMaterial *>(newEffect);
QSGDistanceFieldTextMaterial *oldMaterial = static_cast<QSGDistanceFieldTextMaterial *>(oldEffect);
- if (oldMaterial == 0 || material->color() != oldMaterial->color()) {
+ if (oldMaterial == nullptr || material->color() != oldMaterial->color()) {
QVector4D c = material->color();
state.context()->functions()->glBlendColor(c.x(), c.y(), c.z(), 1.0f);
}
- if (oldMaterial == 0 || material->fontScale() != oldMaterial->fontScale())
+ if (oldMaterial == nullptr || material->fontScale() != oldMaterial->fontScale())
program()->setUniformValue(m_fontScale_id, GLfloat(material->fontScale()));
- if (oldMaterial == 0 || state.isMatrixDirty()) {
+ if (oldMaterial == nullptr || state.isMatrixDirty()) {
int viewportWidth = state.viewportRect().width();
QMatrix4x4 mat = state.combinedMatrix().inverted();
program()->setUniformValue(m_vecDelta_id, mat.column(0) * (qreal(2) / viewportWidth));
diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp
index e74ba83e7f..60f3538662 100644
--- a/src/quick/scenegraph/qsgrenderloop.cpp
+++ b/src/quick/scenegraph/qsgrenderloop.cpp
@@ -88,7 +88,7 @@ extern Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_
DEFINE_BOOL_CONFIG_OPTION(qmlNoThreadedRenderer, QML_BAD_GUI_RENDER_LOOP);
DEFINE_BOOL_CONFIG_OPTION(qmlForceThreadedRenderer, QML_FORCE_THREADED_RENDERER); // Might trigger graphics driver threading bugs, use at own risk
#endif
-QSGRenderLoop *QSGRenderLoop::s_instance = 0;
+QSGRenderLoop *QSGRenderLoop::s_instance = nullptr;
QSGRenderLoop::~QSGRenderLoop()
{
@@ -107,11 +107,11 @@ void QSGRenderLoop::cleanup()
QQuickWindowPrivate *wd = QQuickWindowPrivate::get(w);
if (wd->windowManager == s_instance) {
s_instance->windowDestroyed(w);
- wd->windowManager = 0;
+ wd->windowManager = nullptr;
}
}
delete s_instance;
- s_instance = 0;
+ s_instance = nullptr;
}
/*!
@@ -155,7 +155,7 @@ public:
void releaseResources(QQuickWindow *) override;
- QAnimationDriver *animationDriver() const override { return 0; }
+ QAnimationDriver *animationDriver() const override { return nullptr; }
QSGContext *sceneGraphContext() const override;
QSGRenderContext *createRenderContext(QSGContext *) const override { return rc; }
@@ -275,7 +275,7 @@ void QSGRenderLoop::handleContextCreationFailure(QQuickWindow *window,
}
#if QT_CONFIG(opengl)
QSGGuiThreadRenderLoop::QSGGuiThreadRenderLoop()
- : gl(0)
+ : gl(nullptr)
{
if (qsg_useConsistentTiming()) {
QUnifiedTimer::instance(true)->setConsistentTiming(true);
@@ -337,7 +337,7 @@ void QSGGuiThreadRenderLoop::windowDestroyed(QQuickWindow *window)
if (m_windows.size() == 0) {
rc->invalidate();
delete gl;
- gl = 0;
+ gl = nullptr;
} else if (gl && window == gl->surface() && current) {
gl->doneCurrent();
}
@@ -364,7 +364,7 @@ void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window)
if (!gl->create()) {
const bool isEs = gl->isOpenGLES();
delete gl;
- gl = 0;
+ gl = nullptr;
handleContextCreationFailure(window, isEs);
} else {
cd->fireOpenGLContextCreated(gl);
diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
index c2f0cc4716..8262708320 100644
--- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp
+++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
@@ -167,7 +167,7 @@ template <typename T> T *windowFor(const QList<T> &list, QQuickWindow *window)
if (t.window == window)
return const_cast<T *>(&t);
}
- return 0;
+ return nullptr;
}
@@ -270,13 +270,13 @@ class QSGRenderThread : public QThread
public:
QSGRenderThread(QSGThreadedRenderLoop *w, QSGRenderContext *renderContext)
: wm(w)
- , gl(0)
- , animatorDriver(0)
+ , gl(nullptr)
+ , animatorDriver(nullptr)
, pendingUpdate(0)
, sleeping(false)
, syncResultedInChanges(false)
, active(false)
- , window(0)
+ , window(nullptr)
, stopEventProcessing(false)
{
sgrc = static_cast<QSGDefaultRenderContext *>(renderContext);
@@ -366,7 +366,7 @@ bool QSGRenderThread::event(QEvent *e)
if (window) {
QQuickWindowPrivate::get(window)->fireAboutToStop();
qCDebug(QSG_LOG_RENDERLOOP, QSG_RT_PAD, "- window removed");
- window = 0;
+ window = nullptr;
}
waitCondition.wakeOne();
mutex.unlock();
@@ -456,7 +456,7 @@ bool QSGRenderThread::event(QEvent *e)
gl->makeCurrent(window);
ce->job->run();
delete ce->job;
- ce->job = 0;
+ ce->job = nullptr;
qCDebug(QSG_LOG_RENDERLOOP, QSG_RT_PAD, "- job done");
}
return true;
@@ -514,7 +514,7 @@ void QSGRenderThread::invalidateOpenGL(QQuickWindow *window, bool inDestructor,
sgrc->invalidate();
QCoreApplication::processEvents();
- QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete);
if (inDestructor)
delete dd->animationController;
if (current)
@@ -523,7 +523,7 @@ void QSGRenderThread::invalidateOpenGL(QQuickWindow *window, bool inDestructor,
if (wipeGL) {
delete gl;
- gl = 0;
+ gl = nullptr;
qCDebug(QSG_LOG_RENDERLOOP, QSG_RT_PAD, "- invalidated OpenGL");
} else {
qCDebug(QSG_LOG_RENDERLOOP, QSG_RT_PAD, "- persistent GL, avoiding cleanup");
@@ -554,7 +554,7 @@ void QSGRenderThread::sync(bool inExpose)
}
if (current) {
QQuickWindowPrivate *d = QQuickWindowPrivate::get(window);
- bool hadRenderer = d->renderer != 0;
+ bool hadRenderer = d->renderer != nullptr;
// If the scene graph was touched since the last sync() make sure it sends the
// changed signal.
if (d->renderer)
@@ -570,7 +570,7 @@ void QSGRenderThread::sync(bool inExpose)
// Process deferred deletes now, directly after the sync as
// deleteLater on the GUI must now also have resulted in SG changes
// and the delete is a safe operation.
- QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete);
} else {
qCDebug(QSG_LOG_RENDERLOOP, QSG_RT_PAD, "- window has bad size, sync aborted");
}
@@ -716,7 +716,7 @@ void QSGRenderThread::processEventsAndWaitForMore()
void QSGRenderThread::run()
{
qCDebug(QSG_LOG_RENDERLOOP, QSG_RT_PAD, "run()");
- animatorDriver = sgrc->sceneGraphContext()->createAnimationDriver(0);
+ animatorDriver = sgrc->sceneGraphContext()->createAnimationDriver(nullptr);
animatorDriver->install();
if (QQmlDebugConnector::service<QQmlProfilerService>())
QQuickProfiler::registerAnimationCallback();
@@ -745,7 +745,7 @@ void QSGRenderThread::run()
qCDebug(QSG_LOG_RENDERLOOP, QSG_RT_PAD, "run() completed");
delete animatorDriver;
- animatorDriver = 0;
+ animatorDriver = nullptr;
sgrc->moveToThread(wm->thread());
moveToThread(wm->thread());
@@ -826,7 +826,7 @@ void QSGThreadedRenderLoop::animationStopped()
void QSGThreadedRenderLoop::startOrStopAnimationTimer()
{
int exposedWindows = 0;
- const Window *theOne = 0;
+ const Window *theOne = nullptr;
for (int i=0; i<m_windows.size(); ++i) {
const Window &w = m_windows.at(i);
if (w.window->isVisible() && w.window->isExposed()) {
@@ -973,7 +973,7 @@ void QSGThreadedRenderLoop::handleExposure(QQuickWindow *window)
if (!w->thread->gl->create()) {
const bool isEs = w->thread->gl->isOpenGLES();
delete w->thread->gl;
- w->thread->gl = 0;
+ w->thread->gl = nullptr;
handleContextCreationFailure(w->window, isEs);
return;
}
@@ -1123,7 +1123,7 @@ void QSGThreadedRenderLoop::releaseResources(Window *w, bool inDestructor)
// and the OpenGL resources.
// QOffscreenSurface must be created on the GUI thread, so we
// create it here and pass it on to QSGRenderThread::invalidateGL()
- QOffscreenSurface *fallback = 0;
+ QOffscreenSurface *fallback = nullptr;
if (!window->handle()) {
qCDebug(QSG_LOG_RENDERLOOP, "- using fallback surface");
fallback = new QOffscreenSurface();
diff --git a/src/quick/scenegraph/qsgwindowsrenderloop.cpp b/src/quick/scenegraph/qsgwindowsrenderloop.cpp
index 8072359e11..3b2737b8e1 100644
--- a/src/quick/scenegraph/qsgwindowsrenderloop.cpp
+++ b/src/quick/scenegraph/qsgwindowsrenderloop.cpp
@@ -78,7 +78,7 @@ static QElapsedTimer qsg_render_timer;
QSGWindowsRenderLoop::QSGWindowsRenderLoop()
- : m_gl(0)
+ : m_gl(nullptr)
, m_sg(QSGContext::createDefaultContext())
, m_updateTimer(0)
, m_animationTimer(0)
@@ -117,7 +117,7 @@ QSGWindowsRenderLoop::WindowData *QSGWindowsRenderLoop::windowData(QQuickWindow
if (wd.window == window)
return &wd;
}
- return 0;
+ return nullptr;
}
void QSGWindowsRenderLoop::maybePostUpdateTimer()
@@ -158,7 +158,7 @@ void QSGWindowsRenderLoop::stopped()
void QSGWindowsRenderLoop::show(QQuickWindow *window)
{
RLDEBUG("show");
- if (windowData(window) != 0)
+ if (windowData(window) != nullptr)
return;
// This happens before the platform window is shown, but after
@@ -178,7 +178,7 @@ void QSGWindowsRenderLoop::show(QQuickWindow *window)
if (!created) {
const bool isEs = m_gl->isOpenGLES();
delete m_gl;
- m_gl = 0;
+ m_gl = nullptr;
handleContextCreationFailure(window, isEs);
return;
}
@@ -253,7 +253,7 @@ void QSGWindowsRenderLoop::windowDestroyed(QQuickWindow *window)
if (m_windows.size() == 0) {
d->context->invalidate();
delete m_gl;
- m_gl = 0;
+ m_gl = nullptr;
} else if (m_gl && current) {
m_gl->doneCurrent();
}
@@ -272,7 +272,7 @@ bool QSGWindowsRenderLoop::anyoneShowing() const
void QSGWindowsRenderLoop::exposureChanged(QQuickWindow *window)
{
- if (windowData(window) == 0)
+ if (windowData(window) == nullptr)
return;
if (window->isExposed() && window->isVisible()) {
diff --git a/src/quick/scenegraph/util/qsgareaallocator.cpp b/src/quick/scenegraph/util/qsgareaallocator.cpp
index 67a9fa285a..cd270a1d63 100644
--- a/src/quick/scenegraph/util/qsgareaallocator.cpp
+++ b/src/quick/scenegraph/util/qsgareaallocator.cpp
@@ -72,8 +72,8 @@ struct QSGAreaAllocatorNode
QSGAreaAllocatorNode::QSGAreaAllocatorNode(QSGAreaAllocatorNode *parent)
: parent(parent)
- , left(0)
- , right(0)
+ , left(nullptr)
+ , right(nullptr)
, isOccupied(false)
{
}
@@ -86,14 +86,14 @@ QSGAreaAllocatorNode::~QSGAreaAllocatorNode()
bool QSGAreaAllocatorNode::isLeaf()
{
- Q_ASSERT((left != 0) == (right != 0));
+ Q_ASSERT((left != nullptr) == (right != nullptr));
return !left;
}
QSGAreaAllocator::QSGAreaAllocator(const QSize &size) : m_size(size)
{
- m_root = new QSGAreaAllocatorNode(0);
+ m_root = new QSGAreaAllocatorNode(nullptr);
}
QSGAreaAllocator::~QSGAreaAllocator()
@@ -179,13 +179,13 @@ bool QSGAreaAllocator::deallocateInNode(const QPoint &pos, QSGAreaAllocatorNode
void QSGAreaAllocator::mergeNodeWithNeighbors(QSGAreaAllocatorNode *node)
{
bool done = false;
- QSGAreaAllocatorNode *parent = 0;
- QSGAreaAllocatorNode *current = 0;
+ QSGAreaAllocatorNode *parent = nullptr;
+ QSGAreaAllocatorNode *current = nullptr;
QSGAreaAllocatorNode *sibling;
while (!done) {
Q_ASSERT(node->isLeaf());
Q_ASSERT(!node->isOccupied);
- if (node->parent == 0)
+ if (node->parent == nullptr)
return; // No neighbours.
SplitType splitType = SplitType(node->parent->splitType);
@@ -238,7 +238,7 @@ void QSGAreaAllocator::mergeNodeWithNeighbors(QSGAreaAllocatorNode *node)
}
sibling->parent = parent->parent;
*nodeRef = sibling;
- parent->left = parent->right = 0;
+ parent->left = parent->right = nullptr;
delete parent;
delete neighbor;
done = false;
@@ -276,7 +276,7 @@ void QSGAreaAllocator::mergeNodeWithNeighbors(QSGAreaAllocatorNode *node)
}
sibling->parent = parent->parent;
*nodeRef = sibling;
- parent->left = parent->right = 0;
+ parent->left = parent->right = nullptr;
delete parent;
delete neighbor;
done = false;
diff --git a/src/quick/scenegraph/util/qsgareaallocator_p.h b/src/quick/scenegraph/util/qsgareaallocator_p.h
index aa40ff0a6e..8bc05a5a5b 100644
--- a/src/quick/scenegraph/util/qsgareaallocator_p.h
+++ b/src/quick/scenegraph/util/qsgareaallocator_p.h
@@ -67,7 +67,7 @@ public:
QRect allocate(const QSize &size);
bool deallocate(const QRect &rect);
- bool isEmpty() const { return m_root == 0; }
+ bool isEmpty() const { return m_root == nullptr; }
QSize size() const { return m_size; }
private:
bool allocateInNode(const QSize &size, QPoint &result, const QRect &currentRect, QSGAreaAllocatorNode *node);
diff --git a/src/quick/scenegraph/util/qsgatlastexture.cpp b/src/quick/scenegraph/util/qsgatlastexture.cpp
index 4ca5fba7de..7608a81ddc 100644
--- a/src/quick/scenegraph/util/qsgatlastexture.cpp
+++ b/src/quick/scenegraph/util/qsgatlastexture.cpp
@@ -75,7 +75,7 @@ namespace QSGAtlasTexture
{
Manager::Manager()
- : m_atlas(0)
+ : m_atlas(nullptr)
{
QOpenGLContext *gl = QOpenGLContext::currentContext();
Q_ASSERT(gl);
@@ -105,7 +105,7 @@ Manager::Manager()
Manager::~Manager()
{
- Q_ASSERT(m_atlas == 0);
+ Q_ASSERT(m_atlas == nullptr);
Q_ASSERT(m_atlases.isEmpty());
}
@@ -114,7 +114,7 @@ void Manager::invalidate()
if (m_atlas) {
m_atlas->invalidate();
m_atlas->deleteLater();
- m_atlas = 0;
+ m_atlas = nullptr;
}
QHash<unsigned int, QSGCompressedAtlasTexture::Atlas*>::iterator i = m_atlases.begin();
@@ -128,7 +128,7 @@ void Manager::invalidate()
QSGTexture *Manager::create(const QImage &image, bool hasAlphaChannel)
{
- Texture *t = 0;
+ Texture *t = nullptr;
if (image.width() < m_atlas_size_limit && image.height() < m_atlas_size_limit) {
if (!m_atlas)
m_atlas = new Atlas(m_atlas_size);
@@ -142,7 +142,7 @@ QSGTexture *Manager::create(const QImage &image, bool hasAlphaChannel)
QSGTexture *Manager::create(const QSGCompressedTextureFactory *factory)
{
- QSGTexture *t = 0;
+ QSGTexture *t = nullptr;
if (!qsgEnableCompressedAtlas() || !factory->m_textureData || !factory->m_textureData->isValid())
return t;
@@ -348,7 +348,7 @@ Texture *Atlas::create(const QImage &image)
m_pending_uploads << t;
return t;
}
- return 0;
+ return nullptr;
}
static void swizzleBGRAToRGBA(QImage *image)
@@ -467,7 +467,7 @@ void Atlas::uploadBgra(Texture *texture)
void Atlas::generateTexture()
{
QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions();
- funcs->glTexImage2D(GL_TEXTURE_2D, 0, m_internalFormat, m_size.width(), m_size.height(), 0, m_externalFormat, GL_UNSIGNED_BYTE, 0);
+ funcs->glTexImage2D(GL_TEXTURE_2D, 0, m_internalFormat, m_size.width(), m_size.height(), 0, m_externalFormat, GL_UNSIGNED_BYTE, nullptr);
#if 0
QImage pink(m_size.width(), m_size.height(), QImage::Format_ARGB32_Premultiplied);
@@ -527,7 +527,7 @@ void TextureBase::bind()
Texture::Texture(Atlas *atlas, const QRect &textureRect, const QImage &image)
: TextureBase(atlas, textureRect)
, m_image(image)
- , m_nonatlas_texture(0)
+ , m_nonatlas_texture(nullptr)
, m_has_alpha(image.hasAlphaChannel())
{
float w = atlas->size().width();
diff --git a/src/quick/scenegraph/util/qsgdefaultpainternode.cpp b/src/quick/scenegraph/util/qsgdefaultpainternode.cpp
index 9ffd1b4b08..981ea089be 100644
--- a/src/quick/scenegraph/util/qsgdefaultpainternode.cpp
+++ b/src/quick/scenegraph/util/qsgdefaultpainternode.cpp
@@ -78,11 +78,11 @@ QSGDefaultPainterNode::QSGDefaultPainterNode(QQuickPaintedItem *item)
, m_preferredRenderTarget(QQuickPaintedItem::Image)
, m_actualRenderTarget(QQuickPaintedItem::Image)
, m_item(item)
- , m_fbo(0)
- , m_multisampledFbo(0)
+ , m_fbo(nullptr)
+ , m_multisampledFbo(nullptr)
, m_geometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 4)
- , m_texture(0)
- , m_gl_device(0)
+ , m_texture(nullptr)
+ , m_gl_device(nullptr)
, m_fillColor(Qt::transparent)
, m_contentsScale(1.0)
, m_dirtyContents(false)
@@ -260,8 +260,8 @@ void QSGDefaultPainterNode::updateRenderTarget()
delete m_fbo;
delete m_multisampledFbo;
delete m_gl_device;
- m_fbo = m_multisampledFbo = 0;
- m_gl_device = 0;
+ m_fbo = m_multisampledFbo = nullptr;
+ m_gl_device = nullptr;
}
if (m_actualRenderTarget == QQuickPaintedItem::FramebufferObject ||
@@ -275,7 +275,7 @@ void QSGDefaultPainterNode::updateRenderTarget()
delete m_fbo;
delete m_multisampledFbo;
- m_fbo = m_multisampledFbo = 0;
+ m_fbo = m_multisampledFbo = nullptr;
if (m_gl_device)
m_gl_device->setSize(m_fboSize);
diff --git a/src/quick/scenegraph/util/qsgdepthstencilbuffer.cpp b/src/quick/scenegraph/util/qsgdepthstencilbuffer.cpp
index ba0207aca8..56508af152 100644
--- a/src/quick/scenegraph/util/qsgdepthstencilbuffer.cpp
+++ b/src/quick/scenegraph/util/qsgdepthstencilbuffer.cpp
@@ -43,7 +43,7 @@ QT_BEGIN_NAMESPACE
QSGDepthStencilBuffer::QSGDepthStencilBuffer(QOpenGLContext *context, const Format &format)
: m_functions(context)
- , m_manager(0)
+ , m_manager(nullptr)
, m_format(format)
, m_depthBuffer(0)
, m_stencilBuffer(0)
@@ -160,7 +160,7 @@ QSGDepthStencilBufferManager::~QSGDepthStencilBufferManager()
for (Hash::const_iterator it = m_buffers.constBegin(), cend = m_buffers.constEnd(); it != cend; ++it) {
QSGDepthStencilBuffer *buffer = it.value().data();
buffer->free();
- buffer->m_manager = 0;
+ buffer->m_manager = nullptr;
}
}
@@ -174,7 +174,7 @@ QSharedPointer<QSGDepthStencilBuffer> QSGDepthStencilBufferManager::bufferForFor
void QSGDepthStencilBufferManager::insertBuffer(const QSharedPointer<QSGDepthStencilBuffer> &buffer)
{
- Q_ASSERT(buffer->m_manager == 0);
+ Q_ASSERT(buffer->m_manager == nullptr);
Q_ASSERT(!m_buffers.contains(buffer->m_format));
buffer->m_manager = this;
m_buffers.insert(buffer->m_format, buffer.toWeakRef());
diff --git a/src/quick/scenegraph/util/qsgengine.cpp b/src/quick/scenegraph/util/qsgengine.cpp
index dffe199224..91fa46033c 100644
--- a/src/quick/scenegraph/util/qsgengine.cpp
+++ b/src/quick/scenegraph/util/qsgengine.cpp
@@ -157,7 +157,7 @@ QSGAbstractRenderer *QSGEngine::createRenderer() const
{
Q_D(const QSGEngine);
if (!d->sgRenderContext->isValid())
- return 0;
+ return nullptr;
QSGRenderer *renderer = d->sgRenderContext->createRenderer();
renderer->setCustomRenderMode(qgetenv("QSG_VISUALIZE"));
@@ -178,7 +178,7 @@ QSGTexture *QSGEngine::createTextureFromImage(const QImage &image, CreateTexture
{
Q_D(const QSGEngine);
if (!d->sgRenderContext->isValid())
- return 0;
+ return nullptr;
uint flags = 0;
if (options & TextureCanUseAtlas) flags |= QSGRenderContext::CreateTexture_Atlas;
if (!(options & TextureIsOpaque)) flags |= QSGRenderContext::CreateTexture_Alpha;
@@ -206,7 +206,7 @@ QSGTexture *QSGEngine::createTextureFromId(uint id, const QSize &size, CreateTex
texture->setTextureSize(size);
return texture;
}
- return 0;
+ return nullptr;
}
/*!
diff --git a/src/quick/scenegraph/util/qsgflatcolormaterial.cpp b/src/quick/scenegraph/util/qsgflatcolormaterial.cpp
index a0c71b5340..28f6113a60 100644
--- a/src/quick/scenegraph/util/qsgflatcolormaterial.cpp
+++ b/src/quick/scenegraph/util/qsgflatcolormaterial.cpp
@@ -77,13 +77,13 @@ FlatColorMaterialShader::FlatColorMaterialShader()
void FlatColorMaterialShader::updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect)
{
#if QT_CONFIG(opengl)
- Q_ASSERT(oldEffect == 0 || newEffect->type() == oldEffect->type());
+ Q_ASSERT(oldEffect == nullptr || newEffect->type() == oldEffect->type());
QSGFlatColorMaterial *oldMaterial = static_cast<QSGFlatColorMaterial *>(oldEffect);
QSGFlatColorMaterial *newMaterial = static_cast<QSGFlatColorMaterial *>(newEffect);
const QColor &c = newMaterial->color();
- if (oldMaterial == 0 || c != oldMaterial->color() || state.isOpacityDirty()) {
+ if (oldMaterial == nullptr || c != oldMaterial->color() || state.isOpacityDirty()) {
float opacity = state.opacity() * c.alphaF();
QVector4D v(c.redF() * opacity,
c.greenF() * opacity,
@@ -103,7 +103,7 @@ void FlatColorMaterialShader::updateState(const RenderState &state, QSGMaterial
char const *const *FlatColorMaterialShader::attributeNames() const
{
- static char const *const attr[] = { "vCoord", 0 };
+ static char const *const attr[] = { "vCoord", nullptr };
return attr;
}
diff --git a/src/quick/scenegraph/util/qsgshadersourcebuilder.cpp b/src/quick/scenegraph/util/qsgshadersourcebuilder.cpp
index e134a5d4d3..93fc213f2e 100644
--- a/src/quick/scenegraph/util/qsgshadersourcebuilder.cpp
+++ b/src/quick/scenegraph/util/qsgshadersourcebuilder.cpp
@@ -262,8 +262,8 @@ void QSGShaderSourceBuilder::addDefinition(const QByteArray &definition)
tok.initialize(input);
// First find #version, #extension's and "void main() { ... "
- const char *versionPos = 0;
- const char *extensionPos = 0;
+ const char *versionPos = nullptr;
+ const char *extensionPos = nullptr;
bool inSingleLineComment = false;
bool inMultiLineComment = false;
bool foundVersionStart = false;
@@ -325,8 +325,8 @@ void QSGShaderSourceBuilder::removeVersion()
tok.initialize(input);
// First find #version beginning and end (if present)
- const char *versionStartPos = 0;
- const char *versionEndPos = 0;
+ const char *versionStartPos = nullptr;
+ const char *versionEndPos = nullptr;
bool inSingleLineComment = false;
bool inMultiLineComment = false;
bool foundVersionStart = false;
@@ -361,7 +361,7 @@ void QSGShaderSourceBuilder::removeVersion()
t = tok.next();
}
- if (versionStartPos == 0)
+ if (versionStartPos == nullptr)
return;
// Construct a new shader string, inserting the definition
diff --git a/src/quick/scenegraph/util/qsgsimplematerial.h b/src/quick/scenegraph/util/qsgsimplematerial.h
index 8a81917bd2..dcf9b89b21 100644
--- a/src/quick/scenegraph/util/qsgsimplematerial.h
+++ b/src/quick/scenegraph/util/qsgsimplematerial.h
@@ -207,7 +207,7 @@ Q_INLINE_TEMPLATE void QSGSimpleMaterialShader<State>::updateState(const RenderS
Q_UNUSED(state)
#endif
State *ns = static_cast<QSGSimpleMaterial<State> *>(newMaterial)->state();
- State *old = 0;
+ State *old = nullptr;
if (oldMaterial)
old = static_cast<QSGSimpleMaterial<State> *>(oldMaterial)->state();
updateState(ns, old);
diff --git a/src/quick/scenegraph/util/qsgtexture.cpp b/src/quick/scenegraph/util/qsgtexture.cpp
index d2599ebd72..fea92a5121 100644
--- a/src/quick/scenegraph/util/qsgtexture.cpp
+++ b/src/quick/scenegraph/util/qsgtexture.cpp
@@ -399,7 +399,7 @@ QSGTexture::~QSGTexture()
QSGTexture *QSGTexture::removedFromAtlas() const
{
Q_ASSERT_X(!isAtlasTexture(), "QSGTexture::removedFromAtlas()", "Called on a non-atlas texture");
- return 0;
+ return nullptr;
}
/*!
diff --git a/src/quick/scenegraph/util/qsgtexturematerial.cpp b/src/quick/scenegraph/util/qsgtexturematerial.cpp
index 0f9ee9cfde..70a8b321d8 100644
--- a/src/quick/scenegraph/util/qsgtexturematerial.cpp
+++ b/src/quick/scenegraph/util/qsgtexturematerial.cpp
@@ -67,7 +67,7 @@ QSGOpaqueTextureMaterialShader::QSGOpaqueTextureMaterialShader()
char const *const *QSGOpaqueTextureMaterialShader::attributeNames() const
{
- static char const *const attr[] = { "qt_VertexPosition", "qt_VertexTexCoord", 0 };
+ static char const *const attr[] = { "qt_VertexPosition", "qt_VertexTexCoord", nullptr };
return attr;
}
@@ -80,7 +80,7 @@ void QSGOpaqueTextureMaterialShader::initialize()
void QSGOpaqueTextureMaterialShader::updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect)
{
- Q_ASSERT(oldEffect == 0 || newEffect->type() == oldEffect->type());
+ Q_ASSERT(oldEffect == nullptr || newEffect->type() == oldEffect->type());
QSGOpaqueTextureMaterial *tx = static_cast<QSGOpaqueTextureMaterial *>(newEffect);
QSGOpaqueTextureMaterial *oldTx = static_cast<QSGOpaqueTextureMaterial *>(oldEffect);
@@ -112,7 +112,7 @@ void QSGOpaqueTextureMaterialShader::updateState(const RenderState &state, QSGMa
t->setMipmapFiltering(tx->mipmapFiltering());
t->setAnisotropyLevel(tx->anisotropyLevel());
- if (oldTx == 0 || oldTx->texture()->textureId() != t->textureId())
+ if (oldTx == nullptr || oldTx->texture()->textureId() != t->textureId())
t->bind();
else
t->updateBindOptions();
@@ -169,7 +169,7 @@ void QSGOpaqueTextureMaterialShader::updateState(const RenderState &state, QSGMa
*/
QSGOpaqueTextureMaterial::QSGOpaqueTextureMaterial()
- : m_texture(0)
+ : m_texture(nullptr)
, m_filtering(QSGTexture::Nearest)
, m_mipmap_filtering(QSGTexture::None)
, m_horizontal_wrap(QSGTexture::ClampToEdge)
@@ -398,7 +398,7 @@ QSGTextureMaterialShader::QSGTextureMaterialShader()
void QSGTextureMaterialShader::updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect)
{
- Q_ASSERT(oldEffect == 0 || newEffect->type() == oldEffect->type());
+ Q_ASSERT(oldEffect == nullptr || newEffect->type() == oldEffect->type());
#if QT_CONFIG(opengl)
if (state.isOpacityDirty())
program()->setUniformValue(m_opacity_id, state.opacity());
diff --git a/src/quick/scenegraph/util/qsgvertexcolormaterial.cpp b/src/quick/scenegraph/util/qsgvertexcolormaterial.cpp
index 42c589b14a..f1ad73af1b 100644
--- a/src/quick/scenegraph/util/qsgvertexcolormaterial.cpp
+++ b/src/quick/scenegraph/util/qsgvertexcolormaterial.cpp
@@ -87,7 +87,7 @@ void QSGVertexColorMaterialShader::updateState(const RenderState &state, QSGMate
char const *const *QSGVertexColorMaterialShader::attributeNames() const
{
- static const char *const attr[] = { "vertexCoord", "vertexColor", 0 };
+ static const char *const attr[] = { "vertexCoord", "vertexColor", nullptr };
return attr;
}